Add iOS message date grouping
This commit is contained in:
@@ -31,6 +31,7 @@ public actor FakeSessionBridge: SessionBridge {
|
||||
private var messages: [Int64: [Message]]
|
||||
private var events: [SessionEvent]
|
||||
private var nextMessageId: Int64
|
||||
private static let baseMessageDate: Int32 = 1_700_000_000
|
||||
|
||||
public init(auth: AuthState = .waitPhoneNumber) {
|
||||
self.auth = auth
|
||||
@@ -54,10 +55,25 @@ public actor FakeSessionBridge: SessionBridge {
|
||||
self.chats = [saved, team]
|
||||
self.messages = [
|
||||
1: [
|
||||
Message(id: 1, chatId: 1, senderName: "Alice", text: "Hello from fake TDLib", isOutgoing: false, isRead: false)
|
||||
Message(
|
||||
id: 1,
|
||||
chatId: 1,
|
||||
senderName: "Alice",
|
||||
text: "Hello from fake TDLib",
|
||||
date: Self.baseMessageDate,
|
||||
isOutgoing: false,
|
||||
isRead: false
|
||||
)
|
||||
],
|
||||
2: [
|
||||
Message(id: 2, chatId: 2, senderName: "Mikhail", text: "Bridge smoke is green", isOutgoing: true)
|
||||
Message(
|
||||
id: 2,
|
||||
chatId: 2,
|
||||
senderName: "Mikhail",
|
||||
text: "Bridge smoke is green",
|
||||
date: Self.baseMessageDate + 60,
|
||||
isOutgoing: true
|
||||
)
|
||||
],
|
||||
]
|
||||
self.events = [.chatListChanged([saved, team])]
|
||||
@@ -145,6 +161,7 @@ public actor FakeSessionBridge: SessionBridge {
|
||||
chatId: chatId,
|
||||
senderName: "Me",
|
||||
text: text,
|
||||
date: Int32(Date().timeIntervalSince1970),
|
||||
isOutgoing: true,
|
||||
replyText: replyToMessageId.map { "Reply to #\($0)" }
|
||||
)
|
||||
@@ -182,6 +199,7 @@ public actor FakeSessionBridge: SessionBridge {
|
||||
chatId: toChatId,
|
||||
senderName: "Me",
|
||||
text: source.text,
|
||||
date: Int32(Date().timeIntervalSince1970),
|
||||
isOutgoing: true,
|
||||
forwardSenderName: source.senderName
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user