mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
Clean up VaultScreen Dialogs (#1356)
This commit is contained in:
parent
2d80a215c5
commit
8e1ecd1e6c
1 changed files with 29 additions and 26 deletions
|
@ -173,34 +173,13 @@ private fun VaultScreenScaffold(
|
||||||
onDimBottomNavBarRequest(shouldShowMenu)
|
onDimBottomNavBarRequest(shouldShowMenu)
|
||||||
}
|
}
|
||||||
var shouldShowExitConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
var shouldShowExitConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
val scrollBehavior =
|
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(
|
||||||
TopAppBarDefaults.exitUntilCollapsedScrollBehavior(
|
|
||||||
state = rememberTopAppBarState(),
|
state = rememberTopAppBarState(),
|
||||||
canScroll = { !accountMenuVisible },
|
canScroll = { !accountMenuVisible },
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dynamic dialogs
|
// Dynamic dialogs
|
||||||
when (val dialog = state.dialog) {
|
VaultDialogs(dialogState = state.dialog, vaultHandlers = vaultHandlers)
|
||||||
is VaultState.DialogState.Syncing -> {
|
|
||||||
BitwardenLoadingDialog(
|
|
||||||
visibilityState = LoadingDialogState.Shown(
|
|
||||||
text = R.string.syncing.asText(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
is VaultState.DialogState.Error -> {
|
|
||||||
BitwardenBasicDialog(
|
|
||||||
visibilityState = BasicDialogState.Shown(
|
|
||||||
title = dialog.title,
|
|
||||||
message = dialog.message,
|
|
||||||
),
|
|
||||||
onDismissRequest = vaultHandlers.dialogDismiss,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
null -> Unit
|
|
||||||
}
|
|
||||||
|
|
||||||
// Static dialogs
|
// Static dialogs
|
||||||
if (shouldShowExitConfirmationDialog) {
|
if (shouldShowExitConfirmationDialog) {
|
||||||
|
@ -355,3 +334,27 @@ private fun VaultScreenScaffold(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun VaultDialogs(
|
||||||
|
dialogState: VaultState.DialogState?,
|
||||||
|
vaultHandlers: VaultHandlers,
|
||||||
|
) {
|
||||||
|
when (dialogState) {
|
||||||
|
is VaultState.DialogState.Syncing -> BitwardenLoadingDialog(
|
||||||
|
visibilityState = LoadingDialogState.Shown(
|
||||||
|
text = R.string.syncing.asText(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
is VaultState.DialogState.Error -> BitwardenBasicDialog(
|
||||||
|
visibilityState = BasicDialogState.Shown(
|
||||||
|
title = dialogState.title,
|
||||||
|
message = dialogState.message,
|
||||||
|
),
|
||||||
|
onDismissRequest = vaultHandlers.dialogDismiss,
|
||||||
|
)
|
||||||
|
|
||||||
|
null -> Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue