diff --git a/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt b/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt index 8da1c7d7227..0fcf8944426 100644 --- a/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt +++ b/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt @@ -21,6 +21,7 @@ package com.wire.android.ui import android.app.Activity import android.content.Intent import android.net.Uri +import android.os.Build import android.os.Bundle import android.view.WindowManager import android.widget.Toast @@ -65,8 +66,8 @@ import com.wire.android.navigation.NavigationGraph import com.wire.android.navigation.navigateToItem import com.wire.android.navigation.rememberNavigator import com.wire.android.ui.calling.getIncomingCallIntent -import com.wire.android.ui.calling.ongoing.getOngoingCallIntent import com.wire.android.ui.calling.getOutgoingCallIntent +import com.wire.android.ui.calling.ongoing.getOngoingCallIntent import com.wire.android.ui.common.snackbar.LocalSnackbarHostState import com.wire.android.ui.common.topappbar.CommonTopAppBar import com.wire.android.ui.common.topappbar.CommonTopAppBarViewModel @@ -514,17 +515,26 @@ class WireActivity : AppCompatActivity() { override fun onSaveInstanceState(outState: Bundle) { outState.putBoolean(HANDLED_DEEPLINK_FLAG, true) + outState.putParcelable(ORIGINAL_SAVED_INTENT_FLAG, intent) super.onSaveInstanceState(outState) } + override fun onRestoreInstanceState(savedInstanceState: Bundle) { + super.onRestoreInstanceState(savedInstanceState) + savedInstanceState.getOriginalIntent()?.let { + this.intent = it + } + } + @Suppress("ComplexCondition") private fun handleDeepLink( intent: Intent?, savedInstanceState: Bundle? = null ) { + val originalIntent = savedInstanceState.getOriginalIntent() if (intent == null || intent.flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0 - || savedInstanceState?.getBoolean(HANDLED_DEEPLINK_FLAG, false) == true + || originalIntent == intent // This is the case when the activity is recreated and already handled || intent.getBooleanExtra(HANDLED_DEEPLINK_FLAG, false) ) { return @@ -561,6 +571,15 @@ class WireActivity : AppCompatActivity() { } } + private fun Bundle?.getOriginalIntent(): Intent? { + return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + @Suppress("DEPRECATION") // API 33 + this?.getParcelable(ORIGINAL_SAVED_INTENT_FLAG) + } else { + this?.getParcelable(ORIGINAL_SAVED_INTENT_FLAG, Intent::class.java) + } + } + private fun handleDeepLinkResult(result: DeepLinkResult) { val navigate: (NavigationCommand) -> Unit = { lifecycleScope.launch { navigationCommands.emit(it) } } when (result) { @@ -598,6 +617,7 @@ class WireActivity : AppCompatActivity() { companion object { private const val HANDLED_DEEPLINK_FLAG = "deeplink_handled_flag_key" + private const val ORIGINAL_SAVED_INTENT_FLAG = "original_saved_intent" private const val TAG = "WireActivity" } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b20b4fc7beb..c42cc120752 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1164,7 +1164,7 @@ In group conversations, the group admin can overwrite this setting. Are you sure you want to cancel? Consent to share user data - Help to improve Wire by sharing your usage data via a pseudonymous ID. The data is neither linked to your personal information nor shared with third parties besides Zeta Project Germany GmbH. It includes, for example, when you use a feature, your app version, device type, or your operating system. This data will be deleted at the latest after 365 days.\n\nFind further details in our Privacy Policy. You can revoke your consent at any time. + Help to improve Wire by sharing your usage data via a pseudonymous ID. The data is neither linked to your personal information nor shared with third parties besides Wire Group. It includes, for example, when you use a feature, your app version, device type, or your operating system. This data will be deleted at the latest after 365 days.\n\nFind further details in our Privacy Policy. You can revoke your consent at any time. Agree Decline Privacy Policy diff --git a/kalium b/kalium index ee50e4ceeeb..b12a05b9942 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit ee50e4ceeebaffc9183445972f8f37991019b346 +Subproject commit b12a05b994244f270bc2271d97ef49c232172f2e