mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-15 09:00:44 +00:00
android: fix showing connection alert when app is opened via link (#6333)
* android: fix showing connection alert when app is opened via link * opened on onboarding * cleanup logs * cleanup logs * restore log
This commit is contained in:
@@ -243,9 +243,9 @@ fun MainScreen() {
|
||||
ModalManager.fullscreen.showOneTimePasscodeInView()
|
||||
AlertManager.privacySensitive.showInView()
|
||||
if (onboarding == OnboardingStage.OnboardingComplete) {
|
||||
LaunchedEffect(chatModel.currentUser.value, chatModel.appOpenUrl.value) {
|
||||
LaunchedEffect(chatModel.chatRunning.value, chatModel.currentUser.value, chatModel.appOpenUrl.value) {
|
||||
val (rhId, url) = chatModel.appOpenUrl.value ?: (null to null)
|
||||
if (url != null) {
|
||||
if (url != null && chatModel.chatRunning.value == true) {
|
||||
chatModel.appOpenUrl.value = null
|
||||
connectIfOpenedViaUri(rhId, url, chatModel)
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ object ChatModel {
|
||||
|
||||
// set when app is opened via contact or invitation URI (rhId, uri)
|
||||
val appOpenUrl = mutableStateOf<Pair<Long?, String>?>(null)
|
||||
val appOpenUrlConnecting = mutableStateOf<Boolean>(false)
|
||||
|
||||
// Needed to check for bottom nav bar and to apply or not navigation bar color on Android
|
||||
val newChatSheetVisible = mutableStateOf(false)
|
||||
|
||||
+5
-2
@@ -601,7 +601,8 @@ fun connectIfOpenedViaUri(rhId: Long?, uri: String, chatModel: ChatModel) {
|
||||
chatModel.appOpenUrl.value = rhId to uri
|
||||
} else {
|
||||
withBGApi {
|
||||
planAndConnect(rhId, uri, close = null)
|
||||
chatModel.appOpenUrlConnecting.value = true
|
||||
planAndConnect(rhId, uri, close = null, cleanup = { chatModel.appOpenUrlConnecting.value = false })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,7 +671,9 @@ private fun ChatListSearchBar(listState: LazyListState, searchText: MutableState
|
||||
// if some other text is pasted, enter search mode
|
||||
focusRequester.requestFocus()
|
||||
} else {
|
||||
connectProgressManager.cancelConnectProgress()
|
||||
if (!chatModel.appOpenUrlConnecting.value) {
|
||||
connectProgressManager.cancelConnectProgress()
|
||||
}
|
||||
if (listState.layoutInfo.totalItemsCount > 0) {
|
||||
listState.scrollToItem(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user