mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-09 01:45:51 +00:00
diff
This commit is contained in:
@@ -289,7 +289,6 @@ final class ChatModel: ObservableObject {
|
||||
}
|
||||
|
||||
func updateChats(with newChats: [ChatData]) {
|
||||
var chatsToPop: Set<ChatId> = []
|
||||
for i in 0..<newChats.count {
|
||||
let c = newChats[i]
|
||||
if let j = getChatIndex(c.id) {
|
||||
@@ -301,14 +300,13 @@ final class ChatModel: ObservableObject {
|
||||
if chatId != c.chatInfo.id {
|
||||
popChat_(j, to: i)
|
||||
} else if i == 0 {
|
||||
chatsToPop.insert(c.chatInfo.id)
|
||||
popChatCollector.addChat(c.chatInfo.id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addChat(Chat(c), at: i)
|
||||
}
|
||||
}
|
||||
popChatCollector.addChats(chatsToPop)
|
||||
NtfManager.shared.setNtfBadgeCount(totalUnreadCountForAllUsers())
|
||||
}
|
||||
|
||||
@@ -628,12 +626,7 @@ final class ChatModel: ObservableObject {
|
||||
chatsToPop.insert(chatId)
|
||||
subject.send()
|
||||
}
|
||||
|
||||
func addChats(_ chatIds: Set<ChatId>) {
|
||||
chatsToPop = chatsToPop.union(chatIds)
|
||||
subject.send()
|
||||
}
|
||||
|
||||
|
||||
func popRecentChats() {
|
||||
let m = ChatModel.shared
|
||||
var chs: [(Int, Chat)] = []
|
||||
@@ -676,11 +669,6 @@ final class ChatModel: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
private func popChat_(_ i: Int, to position: Int = 0) {
|
||||
let chat = chats.remove(at: i)
|
||||
chats.insert(chat, at: position)
|
||||
}
|
||||
|
||||
private func markChatItemRead_(_ i: Int) {
|
||||
let meta = im.reversedChatItems[i].meta
|
||||
if case .rcvNew = meta.itemStatus {
|
||||
@@ -774,6 +762,11 @@ final class ChatModel: ObservableObject {
|
||||
return (prevMember, memberIds.count)
|
||||
}
|
||||
|
||||
private func popChat_(_ i: Int, to position: Int = 0) {
|
||||
let chat = chats.remove(at: i)
|
||||
chats.insert(chat, at: position)
|
||||
}
|
||||
|
||||
func dismissConnReqView(_ id: String) {
|
||||
if id == showingInvitation?.connId {
|
||||
markShowingInvitationUsed()
|
||||
|
||||
Reference in New Issue
Block a user