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

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

parent ea771d63
...@@ -1307,7 +1307,7 @@ ...@@ -1307,7 +1307,7 @@
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements; CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53; CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8; DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
...@@ -1353,7 +1353,7 @@ ...@@ -1353,7 +1353,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements; CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53; CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8; DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
...@@ -1536,7 +1536,7 @@ ...@@ -1536,7 +1536,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements; CODE_SIGN_ENTITLEMENTS = Sailassist/Sailassist.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 53; CURRENT_PROJECT_VERSION = 54;
DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Sailassist/Preview Content\"";
DEVELOPMENT_TEAM = D2DC7QNNJ8; DEVELOPMENT_TEAM = D2DC7QNNJ8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
......
...@@ -31,6 +31,7 @@ struct ChatView: View { ...@@ -31,6 +31,7 @@ struct ChatView: View {
.frame(height: 20) .frame(height: 20)
ForEach(message.messages, id: \.messageId) { msg in ForEach(message.messages, id: \.messageId) { msg in
if displayPeriod(messageTime: msg.time) {
if msg.message != nil { if msg.message != nil {
if msg.from == Preferences.UserName { if msg.from == Preferences.UserName {
//自分のメッセージ //自分のメッセージ
...@@ -47,6 +48,7 @@ struct ChatView: View { ...@@ -47,6 +48,7 @@ struct ChatView: View {
} }
} }
} }
}
.onAppear { .onAppear {
if let id = message.messages.last?.messageId { if let id = message.messages.last?.messageId {
proxy.scrollTo(id, anchor: .bottom) proxy.scrollTo(id, anchor: .bottom)
...@@ -111,6 +113,21 @@ struct ChatView: View { ...@@ -111,6 +113,21 @@ struct ChatView: View {
} }
.background(ColorSet.BackgroundPrimary.color) .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 { struct AlertChatMessage: View {
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
//import UIKit //import UIKit
import Foundation import Foundation
let unixTimeHour = 3600.0
let unixTimeDay = 86400.0
let unixTimeMonth = 2592000.0
let unixTimeYear = 31536000.0
class DateTextLib: NSObject { class DateTextLib: NSObject {
/// Date型をグレゴリオ暦日付文字列にする /// 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