diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/App.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/App.kt index 7154c5424..a7ce7bae2 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/App.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/App.kt @@ -223,6 +223,9 @@ fun AndroidScreen(settingsState: SettingsViewState) { } } } + LaunchedEffect(Unit) { + testUserSwitching() + } } @Composable @@ -331,3 +334,31 @@ fun InitializationView() { } } } + +private suspend fun testUserSwitching() { + val users = chatModel.controller.listUsers().map { it.user.userId } + testChatSwitching() + delay(3000) + chatModel.controller.changeActiveUser(users[0], null) + testChatSwitching() + chatModel.controller.changeActiveUser(users[1], null) + testChatSwitching() + chatModel.controller.changeActiveUser(users[0], null) + testChatSwitching() + chatModel.controller.changeActiveUser(users[1], null) + testChatSwitching() +} + +private suspend fun testChatSwitching() { + openChat(chatModel.getChat(chatModel.chats[0].id)!!.chatInfo, chatModel) + delay(300) + openChat(chatModel.getChat(chatModel.chats[1].id)!!.chatInfo, chatModel) + delay(1000) + openChat(chatModel.getChat(chatModel.chats[2].id)!!.chatInfo, chatModel) + delay(500) + openChat(chatModel.getChat(chatModel.chats[1].id)!!.chatInfo, chatModel) + delay(10) + openChat(chatModel.getChat(chatModel.chats[0].id)!!.chatInfo, chatModel) + delay(10) + openChat(chatModel.getChat(chatModel.chats[2].id)!!.chatInfo, chatModel) +}