mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Fix navigator to ensure we don't end up with a weird backstack.
This commit is contained in:
committed by
Greyson Parrelli
parent
bf3135b2d0
commit
53a6b0c719
@@ -347,13 +347,17 @@ class MainActivity : PassphraseRequiredActivity(), VoiceNoteMediaControllerOwner
|
||||
val mutableInteractionSource = remember { MutableInteractionSource() }
|
||||
|
||||
LaunchedEffect(mainNavigationDetailLocation) {
|
||||
println("Detail Location Changed pane:${wrappedNavigator.currentDestination?.pane}")
|
||||
if (paneExpansionState.currentAnchor == listOnlyAnchor && wrappedNavigator.currentDestination?.pane == ThreePaneScaffoldRole.Primary) {
|
||||
println("Animate detail")
|
||||
paneExpansionState.animateTo(detailOnlyAnchor)
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(mainNavigationState.currentListLocation) {
|
||||
println("List Location Changed pane:${wrappedNavigator.currentDestination?.pane}")
|
||||
if (paneExpansionState.currentAnchor == detailOnlyAnchor && wrappedNavigator.currentDestination?.pane == ThreePaneScaffoldRole.Secondary) {
|
||||
println("Animate list")
|
||||
paneExpansionState.animateTo(listOnlyAnchor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,20 @@ class MainNavigationViewModel(
|
||||
}
|
||||
|
||||
navigatorScope?.launch {
|
||||
navigator?.navigateTo(focusedPane)
|
||||
val currentPane: ThreePaneScaffoldRole = navigator?.currentDestination?.pane ?: return@launch
|
||||
|
||||
if (currentPane == focusedPane) {
|
||||
return@launch
|
||||
}
|
||||
|
||||
if (currentPane == ThreePaneScaffoldRole.Secondary) {
|
||||
navigator?.navigateTo(focusedPane)
|
||||
} else {
|
||||
navigator?.navigateBack()
|
||||
if (navigator?.currentDestination == null) {
|
||||
navigator?.navigateTo(ThreePaneScaffoldRole.Secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +182,15 @@ class MainNavigationViewModel(
|
||||
}
|
||||
|
||||
navigatorScope?.launch {
|
||||
navigator?.navigateTo(ThreePaneScaffoldRole.Secondary)
|
||||
val currentPane = navigator?.currentDestination?.pane ?: return@launch
|
||||
if (currentPane == ThreePaneScaffoldRole.Secondary) {
|
||||
return@launch
|
||||
} else {
|
||||
navigator?.navigateBack()
|
||||
if (navigator?.currentDestination == null) {
|
||||
navigator?.navigateTo(ThreePaneScaffoldRole.Secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user