desktop, android: pass remote host to API from the loaded objects, to prevent race conditions (#3397)

* desktop, android: pass remote host explicitely to API calls

* use remote host ID in model updates

* add remote host to chat console

* add remote host to notifications functions
This commit is contained in:
Evgeny Poberezkin
2023-11-20 10:20:10 +00:00
committed by GitHub
parent 68cbc605be
commit 5b7de8f8c1
60 changed files with 853 additions and 776 deletions
@@ -126,7 +126,7 @@ fun processIntent(intent: Intent?) {
when (intent?.action) {
"android.intent.action.VIEW" -> {
val uri = intent.data
if (uri != null) connectIfOpenedViaUri(uri.toURI(), ChatModel)
if (uri != null) connectIfOpenedViaUri(chatModel.remoteHostId, uri.toURI(), ChatModel)
}
}
}
@@ -57,7 +57,7 @@ class SimplexApp: Application(), LifecycleEventObserver {
updatingChatsMutex.withLock {
kotlin.runCatching {
val currentUserId = chatModel.currentUser.value?.userId
val chats = ArrayList(chatController.apiGetChats())
val chats = ArrayList(chatController.apiGetChats(chatModel.remoteHostId))
/** Active user can be changed in background while [ChatController.apiGetChats] is executing */
if (chatModel.currentUser.value?.userId == currentUserId) {
val currentChatId = chatModel.chatId.value