From 2c46a8ff79a5ea258af8b5e615d7ed5c4d2efc1a Mon Sep 17 00:00:00 2001 From: David Perez Date: Wed, 20 Nov 2024 16:28:49 -0600 Subject: [PATCH] Simplify the usage of basic dialogs --- .../accountsetup/SetupAutofillScreen.kt | 8 +--- .../feature/accountsetup/SetupUnlockScreen.kt | 7 +--- .../EnterpriseSignOnScreen.kt | 11 +++--- .../feature/environment/EnvironmentScreen.kt | 25 +++++------- .../ui/auth/feature/landing/LandingScreen.kt | 8 +--- .../ui/auth/feature/login/LoginScreen.kt | 7 +--- .../loginwithdevice/LoginWithDeviceScreen.kt | 7 +--- .../MasterPasswordHintScreen.kt | 17 ++++---- .../removepassword/RemovePasswordScreen.kt | 7 +--- .../resetpassword/ResetPasswordScreen.kt | 7 +--- .../feature/setpassword/SetPasswordScreen.kt | 7 +--- .../trusteddevice/TrustedDeviceScreen.kt | 7 +--- .../twofactorlogin/TwoFactorLoginScreen.kt | 11 +++--- .../feature/vaultunlock/VaultUnlockScreen.kt | 13 ++----- .../platform/feature/search/SearchScreen.kt | 7 +--- .../accountsecurity/AccountSecurityScreen.kt | 13 ++----- .../deleteaccount/DeleteAccountScreen.kt | 13 ++----- .../DeleteAccountConfirmationScreen.kt | 13 ++----- .../loginapproval/LoginApprovalScreen.kt | 7 +--- .../settings/autofill/AutoFillScreen.kt | 8 +--- .../settings/exportvault/ExportVaultScreen.kt | 7 +--- .../folders/addedit/FolderAddEditScreen.kt | 8 +--- .../ui/tools/feature/send/SendScreen.kt | 7 +--- .../feature/send/addsend/AddSendScreen.kt | 7 +--- .../feature/addedit/VaultAddEditScreen.kt | 39 +++++++------------ .../feature/attachments/AttachmentsScreen.kt | 7 +--- .../ui/vault/feature/item/VaultItemScreen.kt | 7 +--- .../itemlisting/VaultItemListingScreen.kt | 24 ++++-------- .../VaultMoveToOrganizationScreen.kt | 8 +--- .../ui/vault/feature/vault/VaultScreen.kt | 7 +--- 30 files changed, 104 insertions(+), 220 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt index 3398db221..9b9bb90b7 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupAutofillScreen.kt @@ -34,13 +34,11 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.auth.feature.accountsetup.handlers.rememberSetupAutoFillHandler import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog import com.x8bit.bitwarden.ui.platform.components.image.BitwardenGifImage @@ -80,10 +78,8 @@ fun SetupAutoFillScreen( when (state.dialogState) { is SetupAutoFillDialogState.AutoFillFallbackDialog -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = R.string.bitwarden_autofill_go_to_settings.asText(), - ), + title = null, + message = stringResource(id = R.string.bitwarden_autofill_go_to_settings), onDismissRequest = handler.onDismissDialog, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt index c3e748901..cc4b752ba 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockScreen.kt @@ -43,7 +43,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog @@ -328,10 +327,8 @@ private fun SetupUnlockScreenDialogs( ) is SetupUnlockState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt index 8d6515755..4037c1c2f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnScreen.kt @@ -27,10 +27,8 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -80,10 +78,11 @@ fun EnterpriseSignOnScreen( when (val dialog = state.dialogState) { is EnterpriseSignOnState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialog.title ?: R.string.an_error_has_occurred.asText(), - message = dialog.message, - ), + title = dialog + .title + ?.invoke() + ?: stringResource(id = R.string.an_error_has_occurred), + message = dialog.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(EnterpriseSignOnAction.DialogDismiss) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentScreen.kt index e627a6848..5ea32514f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentScreen.kt @@ -28,10 +28,8 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText @@ -59,20 +57,15 @@ fun EnvironmentScreen( } } - BitwardenBasicDialog( - visibilityState = if (state.shouldShowErrorDialog) { - BasicDialogState.Shown( - title = R.string.an_error_has_occurred.asText(), - message = R.string.environment_page_urls_error.asText(), - ) - } else { - BasicDialogState.Hidden - }, - onDismissRequest = remember(viewModel) { - { viewModel.trySendAction(EnvironmentAction.ErrorDialogDismiss) } - }, - ) - + if (state.shouldShowErrorDialog) { + BitwardenBasicDialog( + title = stringResource(id = R.string.an_error_has_occurred), + message = stringResource(id = R.string.environment_page_urls_error), + onDismissRequest = remember(viewModel) { + { viewModel.trySendAction(EnvironmentAction.ErrorDialogDismiss) } + }, + ) + } val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()) BitwardenScaffold( modifier = Modifier diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt index 7643107b5..e271e0a87 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingScreen.kt @@ -39,13 +39,11 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.platform.repository.model.Environment import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.account.BitwardenAccountSwitcher import com.x8bit.bitwarden.ui.platform.components.account.BitwardenPlaceholderAccountActionItem import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog import com.x8bit.bitwarden.ui.platform.components.dropdown.EnvironmentSelector @@ -111,10 +109,8 @@ fun LandingScreen( is LandingState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.an_error_has_occurred.asText(), - message = dialog.message, - ), + title = stringResource(id = R.string.an_error_has_occurred), + message = dialog.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(LandingAction.DialogDismiss) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt index d1c872ada..e434f0988 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt @@ -42,7 +42,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenOverflo import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItemData import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -202,10 +201,8 @@ private fun LoginDialogs( ) { when (dialogState) { is LoginState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt index 87543ee10..6c517e9a8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceScreen.kt @@ -36,7 +36,6 @@ import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -257,10 +256,8 @@ private fun LoginWithDeviceDialogs( ) is LoginWithDeviceState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = state.title, - message = state.message, - ), + title = state.title?.invoke(), + message = state.message(), onDismissRequest = onDismissDialog, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt index 1c72b7a01..71794e944 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordhint/MasterPasswordHintScreen.kt @@ -21,10 +21,8 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -53,10 +51,8 @@ fun MasterPasswordHintScreen( when (val dialogState = state.dialog) { is MasterPasswordHintState.DialogState.PasswordHintSent -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.password_hint.asText(), - message = R.string.password_hint_alert.asText(), - ), + title = stringResource(id = R.string.password_hint), + message = stringResource(id = R.string.password_hint_alert), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(MasterPasswordHintAction.DismissDialog) } }, @@ -73,10 +69,11 @@ fun MasterPasswordHintScreen( is MasterPasswordHintState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title ?: R.string.an_error_has_occurred.asText(), - message = dialogState.message, - ), + title = dialogState + .title + ?.invoke() + ?: stringResource(id = R.string.an_error_has_occurred), + message = dialogState.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(MasterPasswordHintAction.DismissDialog) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt index 62d656b79..db36d37f1 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordScreen.kt @@ -28,7 +28,6 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -137,10 +136,8 @@ private fun RemovePasswordDialogs( when (dialogState) { is RemovePasswordState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/resetpassword/ResetPasswordScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/resetpassword/ResetPasswordScreen.kt index c1caa5618..4725cc30d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/resetpassword/ResetPasswordScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/resetpassword/ResetPasswordScreen.kt @@ -32,7 +32,6 @@ import com.x8bit.bitwarden.data.auth.datasource.disk.model.ForcePasswordResetRea import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.card.BitwardenInfoCalloutCard -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog @@ -55,10 +54,8 @@ fun ResetPasswordScreen( when (val dialog = state.dialogState) { is ResetPasswordState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialog.title, - message = dialog.message, - ), + title = dialog.title?.invoke(), + message = dialog.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(ResetPasswordAction.DialogDismiss) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt index eecf0b875..c83af286d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/setpassword/SetPasswordScreen.kt @@ -31,7 +31,6 @@ import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.card.BitwardenInfoCalloutCard -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -191,10 +190,8 @@ private fun SetPasswordDialogs( when (dialogState) { is SetPasswordState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt index 45f71fb14..cafb41bef 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt @@ -34,7 +34,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -215,10 +214,8 @@ private fun TrustedDeviceDialogs( ) { when (dialogState) { is TrustedDeviceState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = handlers.onDismissDialog, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt index 457b38094..b75388301 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt @@ -41,13 +41,11 @@ import com.x8bit.bitwarden.ui.auth.feature.twofactorlogin.util.description import com.x8bit.bitwarden.ui.auth.feature.twofactorlogin.util.title import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.base.util.LivecycleEventEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenOverflowActionItem import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItemData import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -187,10 +185,11 @@ private fun TwoFactorLoginDialogs( ) { when (dialogState) { is TwoFactorLoginState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title ?: R.string.an_error_has_occurred.asText(), - message = dialogState.message, - ), + title = dialogState + .title + ?.invoke() + ?: stringResource(R.string.an_error_has_occurred), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt index e33e4de84..b09702e9f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt @@ -55,7 +55,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenOverflo import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItemData import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLogoutConfirmationDialog @@ -142,10 +141,8 @@ fun VaultUnlockScreen( // Dynamic dialogs when (val dialog = state.dialog) { is VaultUnlockState.VaultUnlockDialog.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialog.title, - message = dialog.message, - ), + title = dialog.title(), + message = dialog.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(VaultUnlockAction.DismissDialog) } }, @@ -157,10 +154,8 @@ fun VaultUnlockScreen( VaultUnlockState.VaultUnlockDialog.BiometricsNoLongerSupported -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.biometrics_no_longer_supported_title.asText(), - message = R.string.biometrics_no_longer_supported.asText(), - ), + title = stringResource(id = R.string.biometrics_no_longer_supported_title), + message = stringResource(id = R.string.biometrics_no_longer_supported), onDismissRequest = remember { { viewModel.trySendAction( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreen.kt index 37194d61a..4dd2d8fed 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreen.kt @@ -25,7 +25,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenSearchTopAppBa import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -152,10 +151,8 @@ private fun SearchDialogs( ) { when (dialogState) { is SearchState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt index 56f89d749..71e7c6582 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreen.kt @@ -43,7 +43,6 @@ import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.card.BitwardenActionCard import com.x8bit.bitwarden.ui.platform.components.card.BitwardenInfoCalloutCard import com.x8bit.bitwarden.ui.platform.components.card.actionCardExitAnimation -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLogoutConfirmationDialog @@ -423,10 +422,8 @@ private fun AccountSecurityDialogs( ) is AccountSecurityDialog.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) @@ -593,10 +590,8 @@ private fun SessionCustomTimeoutRow( if (shouldShowViolatesPoliciesDialog) { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.warning.asText(), - message = R.string.vault_timeout_to_large.asText(), - ), + title = stringResource(id = R.string.warning), + message = stringResource(id = R.string.vault_timeout_to_large), onDismissRequest = { shouldShowViolatesPoliciesDialog = false vaultTimeoutPolicyMinutes?.let { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt index d2be0f9d0..2b57d9b46 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt @@ -35,7 +35,6 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledErrorButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedErrorButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPasswordDialog @@ -74,20 +73,16 @@ fun DeleteAccountScreen( when (val dialog = state.dialog) { DeleteAccountState.DeleteAccountDialog.DeleteSuccess -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = R.string.your_account_has_been_permanently_deleted.asText(), - ), + title = null, + message = stringResource(id = R.string.your_account_has_been_permanently_deleted), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(DeleteAccountAction.AccountDeletionConfirm) } }, ) is DeleteAccountState.DeleteAccountDialog.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.an_error_has_occurred.asText(), - message = dialog.message, - ), + title = stringResource(id = R.string.an_error_has_occurred), + message = dialog.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(DeleteAccountAction.DismissDialog) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt index d6d28598e..bab3457f5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccountconfirmation/DeleteAccountConfirmationScreen.kt @@ -33,7 +33,6 @@ import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledErrorButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -103,20 +102,16 @@ private fun DeleteAccountConfirmationDialogs( when (dialogState) { is DeleteAccountConfirmationState.DeleteAccountConfirmationDialog.DeleteSuccess -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = dialogState.message, - ), + title = null, + message = dialogState.message(), onDismissRequest = onDeleteAccountAcknowledge, ) } is DeleteAccountConfirmationState.DeleteAccountConfirmationDialog.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title(), + message = dialogState.message(), onDismissRequest = onDismissDialog, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt index 5e4d1a6ba..3f2a85a7e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalScreen.kt @@ -36,7 +36,6 @@ import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold @@ -295,10 +294,8 @@ private fun LoginApprovalDialogs( ) is LoginApprovalState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = state.title, - message = state.message, - ), + title = state.title?.invoke(), + message = state.message(), onDismissRequest = onDismissError, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt index be7c5938c..ffeeafff8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillScreen.kt @@ -31,13 +31,11 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.platform.repository.model.UriMatchType import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.badge.NotificationBadge import com.x8bit.bitwarden.ui.platform.components.card.BitwardenActionCard import com.x8bit.bitwarden.ui.platform.components.card.actionCardExitAnimation -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenSelectionDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog @@ -102,10 +100,8 @@ fun AutoFillScreen( if (shouldShowAutofillFallbackDialog) { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = R.string.bitwarden_autofill_go_to_settings.asText(), - ), + title = null, + message = stringResource(id = R.string.bitwarden_autofill_go_to_settings), onDismissRequest = { shouldShowAutofillFallbackDialog = false }, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt index 39936431b..65b012114 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/exportvault/ExportVaultScreen.kt @@ -38,7 +38,6 @@ import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton import com.x8bit.bitwarden.ui.platform.components.card.BitwardenInfoCalloutCard -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog @@ -123,10 +122,8 @@ fun ExportVaultScreen( when (val dialog = state.dialogState) { is ExportVaultState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialog.title, - message = dialog.message, - ), + title = dialog.title?.invoke(), + message = dialog.message(), onDismissRequest = remember(viewModel) { { viewModel.trySendAction(ExportVaultAction.DialogDismiss) } }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt index fd50478df..6a3ded415 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/addedit/FolderAddEditScreen.kt @@ -24,14 +24,12 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenOverflowActionItem import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItemData import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog @@ -172,10 +170,8 @@ private fun FolderAddEditItemDialogs( } is FolderAddEditState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.an_error_has_occurred.asText(), - message = dialogState.message, - ), + title = stringResource(id = R.string.an_error_has_occurred), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreen.kt index df6027502..7f303bdd8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreen.kt @@ -28,7 +28,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenSearchA import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItemData import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -200,10 +199,8 @@ private fun SendDialogs( ) { when (dialogState) { is SendState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendScreen.kt index 393c6907a..0609ffd20 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendScreen.kt @@ -31,7 +31,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItem import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog @@ -254,10 +253,8 @@ private fun AddSendDialogs( ) { when (dialogState) { is AddSendState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt index f33e0b751..7560a0e70 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt @@ -23,7 +23,6 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.autofill.fido2.manager.Fido2CompletionManager import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenOverflowActionItem @@ -31,7 +30,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItem import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPasswordDialog @@ -386,30 +384,24 @@ private fun VaultAddEditItemDialogs( is VaultAddEditState.DialogState.Generic -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) } is VaultAddEditState.DialogState.InitialAutofillPrompt -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.bitwarden_autofill_service.asText(), - message = R.string.bitwarden_autofill_service_alert2.asText(), - ), + title = stringResource(id = R.string.bitwarden_autofill_service), + message = stringResource(id = R.string.bitwarden_autofill_service_alert2), onDismissRequest = onAutofillDismissRequest, ) } is VaultAddEditState.DialogState.Fido2Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.an_error_has_occurred.asText(), - message = dialogState.message, - ), + title = stringResource(id = R.string.an_error_has_occurred), + message = dialogState.message(), onDismissRequest = onFido2ErrorDismiss, ) } @@ -430,10 +422,8 @@ private fun VaultAddEditItemDialogs( is VaultAddEditState.DialogState.Fido2MasterPasswordError -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = R.string.invalid_master_password.asText(), - ), + title = null, + message = stringResource(id = R.string.invalid_master_password), onDismissRequest = onRetryFido2PasswordVerification, ) } @@ -447,10 +437,8 @@ private fun VaultAddEditItemDialogs( is VaultAddEditState.DialogState.Fido2PinError -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = R.string.invalid_pin.asText(), - ), + title = null, + message = stringResource(id = R.string.invalid_pin), onDismissRequest = onRetryFido2PinVerification, ) } @@ -465,9 +453,10 @@ private fun VaultAddEditItemDialogs( is VaultAddEditState.DialogState.Fido2PinSetUpError -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = R.string.validation_field_required.asText(R.string.pin.asText()), + title = null, + message = stringResource( + id = R.string.validation_field_required, + stringResource(id = R.string.pin), ), onDismissRequest = onRetryPinSetUpFido2Verification, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsScreen.kt index bd5577c51..698a7049c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/attachments/AttachmentsScreen.kt @@ -22,7 +22,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -124,10 +123,8 @@ private fun AttachmentsDialogs( ) { when (dialogState) { is AttachmentsState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt index 268ac415a..df5a9e6e8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt @@ -30,7 +30,6 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItem import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPasswordDialog @@ -291,10 +290,8 @@ private fun VaultItemDialogs( ) { when (dialog) { is VaultItemState.DialogState.Generic -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = null, - message = dialog.message, - ), + title = null, + message = dialog.message(), onDismissRequest = onDismissRequest, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreen.kt index 5a8360bf1..e43a0eb5b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreen.kt @@ -306,10 +306,8 @@ private fun VaultItemListingDialogs( ) is VaultItemListingState.DialogState.Fido2OperationFail -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title(), + message = dialogState.message(), onDismissRequest = onDismissFido2ErrorDialog, ) @@ -334,10 +332,8 @@ private fun VaultItemListingDialogs( is VaultItemListingState.DialogState.Fido2MasterPasswordError -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = { onRetryFido2PasswordVerification(dialogState.selectedCipherId) }, @@ -358,10 +354,8 @@ private fun VaultItemListingDialogs( is VaultItemListingState.DialogState.Fido2PinError -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = { onRetryFido2PinVerification(dialogState.selectedCipherId) }, @@ -380,10 +374,8 @@ private fun VaultItemListingDialogs( is VaultItemListingState.DialogState.Fido2PinSetUpError -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title?.invoke(), + message = dialogState.message(), onDismissRequest = { onRetryPinSetUpFido2Verification(dialogState.selectedCipherId) }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationScreen.kt index f8e4c84f9..c1bd04e04 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationScreen.kt @@ -18,12 +18,10 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect -import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.LoadingDialogState @@ -85,10 +83,8 @@ private fun VaultMoveToOrganizationScaffold( when (val dialog = state.dialogState) { is VaultMoveToOrganizationState.DialogState.Error -> { BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = R.string.an_error_has_occurred.asText(), - message = dialog.message, - ), + title = stringResource(id = R.string.an_error_has_occurred), + message = dialog.message(), onDismissRequest = dismissClick, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt index fcdc65591..c1ca12a7b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt @@ -40,7 +40,6 @@ import com.x8bit.bitwarden.ui.platform.components.card.BitwardenActionCard import com.x8bit.bitwarden.ui.platform.components.card.actionCardExitAnimation import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent -import com.x8bit.bitwarden.ui.platform.components.dialog.BasicDialogState import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenBasicDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLoadingDialog import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPasswordDialog @@ -358,10 +357,8 @@ private fun VaultDialogs( ) is VaultState.DialogState.Error -> BitwardenBasicDialog( - visibilityState = BasicDialogState.Shown( - title = dialogState.title, - message = dialogState.message, - ), + title = dialogState.title(), + message = dialogState.message(), onDismissRequest = vaultHandlers.dialogDismiss, )