Skip to content

Commit

Permalink
Clean up launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed May 28, 2024
1 parent 85796ab commit 7987141
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,12 @@ fun Connect(
popUpTo(NavGraphs.root) { inclusive = true }
}
is ConnectViewModel.UiSideEffect.NoVpnPermission -> launchVpnPermission.launch(Unit)
is ConnectViewModel.UiSideEffect.ConnectError -> {
is ConnectViewModel.UiSideEffect.ConnectError ->
launch {
snackbarHostState.showSnackbarImmediately(
message = sideEffect.toMessage(context),
)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fun CustomLists(
NavResult.Canceled -> {
/* Do nothing */
}
is NavResult.Value -> {
is NavResult.Value ->
scope.launch {
snackbarHostState.showSnackbarImmediately(
message =
Expand All @@ -87,7 +87,6 @@ fun CustomLists(
onAction = { viewModel.undoDeleteCustomList(result.value.undo) }
)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,29 @@ fun SelectLocation(
LaunchedEffectCollect(vm.uiSideEffect) {
when (it) {
SelectLocationSideEffect.CloseScreen -> backNavigator.navigateBack(result = true, true)
is SelectLocationSideEffect.LocationAddedToCustomList -> {
is SelectLocationSideEffect.LocationAddedToCustomList ->
launch {
snackbarHostState.showResultSnackbar(
context = context,
result = it.result,
onUndo = vm::performAction
)
}
}
is SelectLocationSideEffect.LocationRemovedFromCustomList -> {
is SelectLocationSideEffect.LocationRemovedFromCustomList ->
launch {
snackbarHostState.showResultSnackbar(
context = context,
result = it.result,
onUndo = vm::performAction
)
}
}
SelectLocationSideEffect.GenericError -> {
SelectLocationSideEffect.GenericError ->
launch {
snackbarHostState.showSnackbarImmediately(
message = context.getString(R.string.error_occurred),
duration = SnackbarDuration.Short
)
}
}
}
}

Expand Down

0 comments on commit 7987141

Please sign in to comment.