android, desktop: moving chats changing in main thread (#5461)

* android, desktop: moving chats changing in main thread

* modifying chat items in main thread only

* comment
This commit is contained in:
Stanislav Dmitrenko
2025-01-02 04:31:06 +07:00
committed by GitHub
parent e27f8a8d6a
commit 0dfcd60490
11 changed files with 74 additions and 41 deletions
@@ -14,6 +14,7 @@ import androidx.compose.runtime.*
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import chat.simplex.common.AppScreen
import chat.simplex.common.model.ChatModel.withChats
import chat.simplex.common.model.clear
import chat.simplex.common.model.clearAndNotify
import chat.simplex.common.views.helpers.*
@@ -74,9 +75,13 @@ actual class GlobalExceptionsHandler: Thread.UncaughtExceptionHandler {
if (ModalManager.start.hasModalsOpen()) {
ModalManager.start.closeModal()
} else if (chatModel.chatId.value != null) {
// Since no modals are open, the problem is probably in ChatView
chatModel.chatId.value = null
chatModel.chatItems.clearAndNotify()
withApi {
withChats {
// Since no modals are open, the problem is probably in ChatView
chatModel.chatId.value = null
chatItems.clearAndNotify()
}
}
} else {
// ChatList, nothing to do. Maybe to show other view except ChatList
}