diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 161e0af18d..929a0c8cf4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -57,6 +57,9 @@ updates: - dependency-name: "com.google.devtools.ksp*" - dependency-name: "com.github.skydoves.compose.stability.analyzer*" - dependency-name: "androidx.compose:compose-bom" + # Navigation 2.10 breaks predictive back transitions (wrong pair, then a snap); stay on 2.9.x. + - dependency-name: "androidx.navigation:*" + versions: [">= 2.10.0"] groups: gradle: patterns: diff --git a/app/src/main/java/to/bitkit/ui/MainActivity.kt b/app/src/main/java/to/bitkit/ui/MainActivity.kt index cf0fe8b3eb..df8e69d790 100644 --- a/app/src/main/java/to/bitkit/ui/MainActivity.kt +++ b/app/src/main/java/to/bitkit/ui/MainActivity.kt @@ -114,6 +114,7 @@ class MainActivity : FragmentActivity() { importance = NotificationManager.IMPORTANCE_LOW ) + intent.removeNavDestinationExtras() val consumedLaunchIntent = savedInstanceState?.getString(KEY_CONSUMED_LAUNCH_INTENT) val currentLaunchIntent = intent.launchKey() if (currentLaunchIntent == null || currentLaunchIntent != consumedLaunchIntent) { @@ -282,11 +283,21 @@ class MainActivity : FragmentActivity() { return } + intent.removeNavDestinationExtras() super.onNewIntent(intent) setIntent(intent) handleLaunchIntent(intent) } + /** + * Navigation 2.9 opens the destination these extras name for any caller; 2.10 trusts them only from this app. + * Bitkit never sets them, so drop them: an exported launch can then reach only the declared deep links. + */ + private fun Intent.removeNavDestinationExtras() { + removeExtra("android-support-nav:controller:deepLinkIds") + removeExtra("android-support-nav:controller:deepLinkArgs") + } + private fun handleLaunchIntent(intent: Intent) { if (intent.getBooleanExtra(EXTRA_PAYKIT_SUBSCRIPTION_PAYMENT_DUE, false)) { intent.removeExtra(EXTRA_PAYKIT_SUBSCRIPTION_PAYMENT_DUE) diff --git a/changelog.d/next/1853.fixed.md b/changelog.d/next/1853.fixed.md new file mode 100644 index 0000000000..5bac566802 --- /dev/null +++ b/changelog.d/next/1853.fixed.md @@ -0,0 +1 @@ +Swiping back from a screen slides it out like the Back button does, and other apps can no longer open Bitkit's internal screens. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c9f42e1e39..2c02319d15 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,9 @@ hiltAndroidx = "1.4.0" kotlin = "2.3.21" ktor = "3.6.1" lifecycle = "2.10.0" -navCompose = "2.10.2" +# 2.10 breaks predictive back: a swipe soon after a navigation seeks with the forward transitions, +# then snaps. Stay on 2.9.x until a release fixes it (see .github/dependabot.yml). +navCompose = "2.9.8" room = "2.8.5" slf4j = "2.0.20" haze = "1.7.3"