From 3469bc75144db8fe506b1b9a41e30b64e237d780 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:57:32 +0000 Subject: [PATCH] ui: update list filters when a chat is added (#8107) * ui: update list filters when a chat is added * ui: count list filters on the main thread and after chat list reloads * android, desktop: check and add a known chat on the main thread * docs: list filter counts in the apps' specs * docs: correct the list filter gaps in the apps' specs * ui: revert the recounts, replaceChat change and main-thread moves * docs: revert the list filter notes in the apps' specs --------- Co-authored-by: spaced4ndy-agents <342056592+spaced4ndy-agents@users.noreply.github.com> --- apps/ios/Shared/Model/ChatModel.swift | 2 +- .../commonMain/kotlin/chat/simplex/common/model/ChatModel.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/ios/Shared/Model/ChatModel.swift b/apps/ios/Shared/Model/ChatModel.swift index 1e9205473d..c2004bc10b 100644 --- a/apps/ios/Shared/Model/ChatModel.swift +++ b/apps/ios/Shared/Model/ChatModel.swift @@ -612,6 +612,7 @@ final class ChatModel: ObservableObject { } else { addChat_(chat, at: 0) } + ChatTagsModel.shared.addPresetChatTags(chat.chatInfo, chat.chatStats) popChatCollector.throttlePopChat(chat.chatInfo.id, currentPosition: 0) } @@ -656,7 +657,6 @@ final class ChatModel: ObservableObject { updateChatInfo(cInfo) } else if addMissing { addChat(Chat(chatInfo: cInfo, chatItems: [])) - ChatTagsModel.shared.addPresetChatTags(cInfo, ChatStats()) } } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index b7655a2d27..0d5e97caaf 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -458,6 +458,9 @@ object ChatModel { suspend fun addChat(chat: Chat) { chats.add(index = 0, chat) + if (secondaryContextFilter == null) { + addPresetChatTags(chat.chatInfo, chat.chatStats) + } popChatCollector.throttlePopChat(chat.remoteHostId, chat.id, currentPosition = 0) } @@ -519,7 +522,6 @@ object ChatModel { updateChatInfo(rhId, cInfo) } else if (addMissing) { addChat(Chat(remoteHostId = rhId, chatInfo = cInfo, chatItems = arrayListOf())) - addPresetChatTags(cInfo, Chat.ChatStats()) } }