Commit 9cdd7983 authored by shigemi miura's avatar shigemi miura

チャット期限対応 (30日間)

parent ea771d63
......@@ -1307,7 +1307,7 @@
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53;
CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1353,7 +1353,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53;
CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......@@ -1536,7 +1536,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53;
CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES;
......
......@@ -31,19 +31,21 @@ struct ChatView: View {
.frame(height: 20)
ForEach(message.messages, id: \.messageId) { msg in
if msg.message != nil {
if msg.from == Preferences.UserName {
//自分のメッセージ
MyChatContentView(message: msg)
.padding(.bottom, 24)
}else{
//他人のメッセージ
OtherChatContentView(message: msg)
if displayPeriod(messageTime: msg.time) {
if msg.message != nil {
if msg.from == Preferences.UserName {
//自分のメッセージ
MyChatContentView(message: msg)
.padding(.bottom, 24)
}else{
//他人のメッセージ
OtherChatContentView(message: msg)
.padding(.bottom, 24)
}
} else {
AlertChatMessage(message: msg)
.padding(.bottom, 24)
}
} else {
AlertChatMessage(message: msg)
.padding(.bottom, 24)
}
}
}
......@@ -111,6 +113,21 @@ struct ChatView: View {
}
.background(ColorSet.BackgroundPrimary.color)
}
func displayPeriod(messageTime: String) -> Bool {
var period = false
var interval = 0.0
if let megTime = DateTextLib.ISO8601Text2Date(messageTime) {
interval = Date.now.timeIntervalSince(megTime)
}
if interval <= unixTimeMonth { //2,592,000.0
period = true
}
return period
}
}
struct AlertChatMessage: View {
......
......@@ -9,6 +9,12 @@
//import UIKit
import Foundation
let unixTimeHour = 3600.0
let unixTimeDay = 86400.0
let unixTimeMonth = 2592000.0
let unixTimeYear = 31536000.0
class DateTextLib: NSObject {
/// Date型をグレゴリオ暦日付文字列にする
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment