made open first unread more stable

This commit is contained in:
Diogo
2024-10-22 15:25:49 +01:00
parent bafaf0f0ee
commit a360da4828
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -316,6 +316,12 @@ final class ChatModel: ObservableObject {
chats[i].created = Date.now
}
}
func updateChatStats(id: String, cStats: ChatStats) {
if let i = getChatIndex(id) {
chats[i].chatStats = cStats
}
}
func updateContactConnection(_ contactConnection: PendingContactConnection) {
updateChat(.contactConnection(contactConnection: contactConnection))
+1
View File
@@ -344,6 +344,7 @@ func loadChat(chat: Chat, search: String = "", clearItems: Bool = true) async {
let chat = try await apiGetChat(type: cInfo.chatType, id: cInfo.apiId, search: search)
await MainActor.run {
im.reversedChatItems = chat.chatItems.reversed()
m.updateChatStats(id: chat.chatInfo.id, cStats: chat.chatStats)
m.updateChatInfo(chat.chatInfo)
}
} catch let error {