android: don't show alert when not needed after changing user concurrently

This commit is contained in:
Avently
2024-01-10 22:06:23 +07:00
parent 25a4719414
commit 677eedfa8d
2 changed files with 10 additions and 1 deletions
@@ -80,7 +80,7 @@ class SimplexApp: Application(), LifecycleEventObserver {
updatingChatsMutex.withLock {
kotlin.runCatching {
val currentUserId = chatModel.currentUser.value?.userId
val chats = ArrayList(chatController.apiGetChats(chatModel.remoteHostId()))
val chats = ArrayList(chatController.apiGetChatsWithoutAlert(chatModel.remoteHostId()) ?: return@runCatching)
/** Active user can be changed in background while [ChatController.apiGetChats] is executing */
if (chatModel.currentUser.value?.userId == currentUserId) {
val currentChatId = chatModel.chatId.value