mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 12:38:33 +00:00
Add skip dialog for during deletion.
This commit is contained in:
committed by
Cody Henthorne
parent
ad652dbaf2
commit
2ff0df9ef6
@@ -571,15 +571,19 @@ private fun RemoteBackupsSettingsContent(
|
||||
}
|
||||
|
||||
RemoteBackupsSettingsState.Dialog.SKIP_MEDIA_RESTORE_PROTECTION -> {
|
||||
SkipDownloadDialog(
|
||||
renewalTime = if (backupState is RemoteBackupsSettingsState.BackupState.WithTypeAndRenewalTime) {
|
||||
backupState.renewalTime
|
||||
} else {
|
||||
error("Unexpected dialog display without renewal time.")
|
||||
},
|
||||
onDismiss = contentCallbacks::onDialogDismissed,
|
||||
onSkipClick = contentCallbacks::onSkipMediaRestore
|
||||
)
|
||||
if (backupDeleteState.hasUx()) {
|
||||
SkipDownloadDuringDeleteDialog()
|
||||
} else {
|
||||
SkipDownloadDialog(
|
||||
renewalTime = if (backupState is RemoteBackupsSettingsState.BackupState.WithTypeAndRenewalTime) {
|
||||
backupState.renewalTime
|
||||
} else {
|
||||
error("Unexpected dialog display without renewal time.")
|
||||
},
|
||||
onDismiss = contentCallbacks::onDialogDismissed,
|
||||
onSkipClick = contentCallbacks::onSkipMediaRestore
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
RemoteBackupsSettingsState.Dialog.CANCEL_MEDIA_RESTORE_PROTECTION -> {
|
||||
@@ -637,13 +641,14 @@ private fun ReenableBackupsButton(contentCallbacks: ContentCallbacks) {
|
||||
private fun LazyListScope.appendRestoreFromBackupStatusData(
|
||||
backupRestoreState: BackupRestoreState.FromBackupStatusData,
|
||||
canRestoreUsingCellular: Boolean,
|
||||
contentCallbacks: ContentCallbacks
|
||||
contentCallbacks: ContentCallbacks,
|
||||
isCancelable: Boolean = true
|
||||
) {
|
||||
item {
|
||||
BackupStatusRow(
|
||||
backupStatusData = backupRestoreState.backupStatusData,
|
||||
onCancelClick = contentCallbacks::onCancelMediaRestore,
|
||||
onSkipClick = contentCallbacks::onSkipMediaRestore,
|
||||
onCancelClick = if (isCancelable) contentCallbacks::onCancelMediaRestore else null,
|
||||
onSkipClick = contentCallbacks::onDisplaySkipMediaRestoreProtectionDialog,
|
||||
onLearnMoreClick = contentCallbacks::onLearnMoreAboutBackupFailure
|
||||
)
|
||||
}
|
||||
@@ -711,7 +716,8 @@ private fun LazyListScope.appendBackupDeletionItems(
|
||||
appendRestoreFromBackupStatusData(
|
||||
backupRestoreState = backupRestoreState,
|
||||
canRestoreUsingCellular = canRestoreUsingCellular,
|
||||
contentCallbacks = contentCallbacks
|
||||
contentCallbacks = contentCallbacks,
|
||||
isCancelable = false
|
||||
)
|
||||
} else {
|
||||
item {
|
||||
@@ -1453,6 +1459,22 @@ private fun DownloadingYourBackupDialog(
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SkipDownloadDuringDeleteDialog(
|
||||
onSkipClick: () -> Unit = {},
|
||||
onDismiss: () -> Unit = {}
|
||||
) {
|
||||
Dialogs.SimpleAlertDialog(
|
||||
title = stringResource(R.string.RemoteBackupsSettingsFragment__skip_download_question),
|
||||
body = stringResource(R.string.RemoteBackupsSettingsFragment__if_you_skip_downloading_the_remaining),
|
||||
confirm = stringResource(R.string.RemoteBackupsSettingsFragment__skip_and_delete_permanently),
|
||||
dismiss = stringResource(android.R.string.cancel),
|
||||
confirmColor = MaterialTheme.colorScheme.error,
|
||||
onConfirm = onSkipClick,
|
||||
onDismiss = onDismiss
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SkipDownloadDialog(
|
||||
renewalTime: Duration,
|
||||
@@ -1912,6 +1934,14 @@ private fun DownloadingYourBackupDialogPreview() {
|
||||
}
|
||||
}
|
||||
|
||||
@SignalPreview
|
||||
@Composable
|
||||
private fun SkipDownloadDuringDeleteDialogPreview() {
|
||||
Previews.Preview {
|
||||
SkipDownloadDuringDeleteDialog()
|
||||
}
|
||||
}
|
||||
|
||||
@SignalPreview
|
||||
@Composable
|
||||
private fun SkipDownloadDialogPreview() {
|
||||
|
||||
@@ -8188,17 +8188,21 @@
|
||||
<string name="RemoteBackupsSettingsFragment__download">Download</string>
|
||||
<!-- Dialog title for skipping download of backed up media -->
|
||||
<string name="RemoteBackupsSettingsFragment__skip_download_question">Skip download?</string>
|
||||
<!-- Dialog body for skiping download of backed up media -->
|
||||
<!-- Dialog body for skipping download of backed up media -->
|
||||
<plurals name="RemoteBackupsSettingsFragment__if_you_skip_downloading">
|
||||
<item quantity="one">If you skip downloading the remaining media and attachments in your backup will be deleted in %1$d day.</item>
|
||||
<item quantity="other">If you skip downloading the remaining media and attachments in your backup will be deleted in %1$d days.</item>
|
||||
</plurals>
|
||||
<!-- Dialog body for skipping download of backed up media during deletion -->
|
||||
<string name="RemoteBackupsSettingsFragment__if_you_skip_downloading_the_remaining">If you skip downloading the remaining media and attachments in your backup they will be permanently deleted. This data won\'t be recoverable.</string>
|
||||
<!-- Dialog title for skipping download of in progress initial restore of backed up media -->
|
||||
<string name="RemoteBackupsSettingsFragment__skip_restore_question">Skip restore?</string>
|
||||
<!-- Dialog message for skipping download of in progress initial restore of backed up media -->
|
||||
<string name="RemoteBackupsSettingsFragment__skip_restore_message">If you skip restore the remaining media and attachments in your backup can be downloaded at a later time.</string>
|
||||
<!-- Positive dialog action to skip download -->
|
||||
<string name="RemoteBackupsSettingsFragment__skip">Skip</string>
|
||||
<!-- Positive dialog action to skip download during deletion -->
|
||||
<string name="RemoteBackupsSettingsFragment__skip_and_delete_permanently">Skip and delete permanently</string>
|
||||
<!-- Dialog title for network error while trying to disable backups -->
|
||||
<string name="RemoteBackupsSettingsFragment__couldnt_turn_off_and_delete_backups">Couldn\'t turn off and delete backups</string>
|
||||
<!-- Dialog body for network error while trying to disable backups -->
|
||||
|
||||
Reference in New Issue
Block a user