Skip to content

Commit

Permalink
update drawer (api, impl, ui)
Browse files Browse the repository at this point in the history
- show global success message after instance/account change
- close menu on account change
  • Loading branch information
AkesiSeli committed Feb 9, 2025
1 parent 0bc3821 commit 13b5e7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class DrawerContent : Screen {
var manageAccountsDialogOpened by remember { mutableStateOf(false) }
var changeInstanceDialogOpened by remember { mutableStateOf(false) }
var aboutDialogOpened by remember { mutableStateOf(false) }
val successMessage = LocalStrings.current.messageSuccess

fun handleAction(action: suspend () -> Unit) {
scope.launch {
Expand All @@ -108,6 +109,12 @@ class DrawerContent : Screen {
DrawerMviModel.Effect.AnonymousChangeNodeSuccess -> {
changeInstanceDialogOpened = false
drawerCoordinator.closeDrawer()
navigationCoordinator.showGlobalMessage(successMessage)
}

DrawerMviModel.Effect.AccountChangeSuccess -> {
drawerCoordinator.closeDrawer()
navigationCoordinator.showGlobalMessage(successMessage)
}
}
}.launchIn(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ interface DrawerMviModel :

sealed interface Effect {
data object AnonymousChangeNodeSuccess : Effect

data object AccountChangeSuccess : Effect
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class DrawerViewModel(
}
screenModelScope.launch {
switchAccountUseCase(account)
emitEffect(DrawerMviModel.Effect.AccountChangeSuccess)
}
}

Expand Down

0 comments on commit 13b5e7e

Please sign in to comment.