Skip to content

Commit

Permalink
chore: upgrade compose to fix NavBackStackEntry crashes [RC] [WPB-232…
Browse files Browse the repository at this point in the history
…1] (#1971)
  • Loading branch information
saleniuk authored Jul 19, 2023
1 parent c0ca379 commit 4f3247b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,34 @@

package com.wire.android.navigation

import android.annotation.SuppressLint
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavController
import com.wire.android.appLogger
import com.wire.kalium.logger.obfuscateId

@SuppressLint("RestrictedApi")
internal fun NavController.navigateToItem(command: NavigationCommand) {
appLogger.d("[$TAG] -> command: ${command.destination.obfuscateId()}")
currentBackStackEntry?.savedStateHandle?.remove<Map<String, Any>>(EXTRA_BACK_NAVIGATION_ARGUMENTS)
navigate(command.destination) {
when (command.backStackMode) {
BackStackMode.CLEAR_WHOLE, BackStackMode.CLEAR_TILL_START -> {
val inclusive = command.backStackMode == BackStackMode.CLEAR_WHOLE
popBackStack(inclusive) { backQueue.firstOrNull { it.destination.route != null } }
popBackStack(inclusive) { currentBackStack.value.firstOrNull { it.destination.route != null } }
}
BackStackMode.REMOVE_CURRENT -> {
popBackStack(true) { backQueue.lastOrNull { it.destination.route != null } }
popBackStack(true) { currentBackStack.value.lastOrNull { it.destination.route != null } }
}
BackStackMode.REMOVE_CURRENT_AND_REPLACE -> {
popBackStack(true) { backQueue.lastOrNull { it.destination.route != null } }
popBackStack(true) { currentBackStack.value.lastOrNull { it.destination.route != null } }
NavigationItem.fromRoute(command.destination)?.let { navItem ->
popBackStack(true) { backQueue.firstOrNull { it.destination.route == navItem.getCanonicalRoute() } }
popBackStack(true) { currentBackStack.value.firstOrNull { it.destination.route == navItem.getCanonicalRoute() } }
}
}
BackStackMode.UPDATE_EXISTED -> {
NavigationItem.fromRoute(command.destination)?.let { navItem ->
popBackStack(true) { backQueue.firstOrNull { it.destination.route == navItem.getCanonicalRoute() } }
popBackStack(true) { currentBackStack.value.firstOrNull { it.destination.route == navItem.getCanonicalRoute() } }
}
}
BackStackMode.NONE -> {
Expand Down
7 changes: 4 additions & 3 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ object Libraries {
const val desugaring = "1.1.5"
const val workManager = "2.8.1"
const val fragment = "1.5.6"
const val compose = "1.4.1"
const val compose = "1.5.0-beta03"
const val composeCompiler = "1.4.6"
const val composeMaterial = "1.4.3"
const val composeMaterial3 = "1.1.0"
const val composeActivity = "1.6.1"
const val composeNavigation = "2.5.3"
const val accompanist = "0.28.0"
const val composeNavigation = "2.6.0"
const val accompanist = "0.31.3-beta"
const val composeConstraint = "1.0.1"
const val hilt = "2.45"
const val hiltWork = "1.0.0"
Expand Down

0 comments on commit 4f3247b

Please sign in to comment.