Skip to content

Commit

Permalink
Fix pledge navigation not working when done too quickly
Browse files Browse the repository at this point in the history
We do not need to care for lifecycle here, as the sliding event should
only happen once anyway. And if we do not handle it otherwise the slider
gets stuck at the end.
  • Loading branch information
StylianosGakis committed Oct 21, 2023
1 parent 3bbf005 commit 542b8a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,8 @@ private fun NavGraphBuilder.nestedHomeGraphs(
windowSizeClass = hedvigAppState.windowSizeClass,
navigator = navigator,
shouldShowRequestPermissionRationale = shouldShowRequestPermissionRationale,
navigateToTriaging = { backStackEntry ->
if (backStackEntry != null) {
with(navigator) { backStackEntry.navigate(ClaimTriagingDestination.ClaimGroups) }
} else {
navigator.navigateUnsafe(ClaimTriagingDestination.ClaimGroups)
}
navigateToTriaging = {
navigator.navigateUnsafe(ClaimTriagingDestination.ClaimGroups)
},
openAppSettings = {
activityNavigator.openAppSettings(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fun NavGraphBuilder.claimFlowGraph(
windowSizeClass: WindowSizeClass,
navigator: Navigator,
shouldShowRequestPermissionRationale: (String) -> Boolean,
navigateToTriaging: (NavBackStackEntry?) -> Unit,
navigateToTriaging: () -> Unit,
openAppSettings: () -> Unit,
closeClaimFlow: () -> Unit,
openChat: (NavBackStackEntry) -> Unit,
Expand All @@ -74,7 +74,7 @@ fun NavGraphBuilder.claimFlowGraph(
with(navigator) { backStackEntry.navigate(ClaimFlowDestination.NotificationPermission) }
},
pledgeAccepted = {
navigateToTriaging(backStackEntry)
navigateToTriaging()
},
navigateUp = navigator::navigateUp,
closeClaimFlow = closeClaimFlow,
Expand All @@ -84,9 +84,7 @@ fun NavGraphBuilder.claimFlowGraph(
NotificationPermissionDestination(
windowSizeClass = windowSizeClass,
onNotificationPermissionDecided = {
// We need to navigate without checking lifecycle, since we want to navigate after accepting the permission.
// That dialog showing means that the app is not Resumed and would otherwise make us not navigate.
navigateToTriaging(null)
navigateToTriaging()
},
openAppSettings = openAppSettings,
navigateUp = navigator::navigateUp,
Expand Down

0 comments on commit 542b8a0

Please sign in to comment.