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 -> {
|
RemoteBackupsSettingsState.Dialog.SKIP_MEDIA_RESTORE_PROTECTION -> {
|
||||||
SkipDownloadDialog(
|
if (backupDeleteState.hasUx()) {
|
||||||
renewalTime = if (backupState is RemoteBackupsSettingsState.BackupState.WithTypeAndRenewalTime) {
|
SkipDownloadDuringDeleteDialog()
|
||||||
backupState.renewalTime
|
} else {
|
||||||
} else {
|
SkipDownloadDialog(
|
||||||
error("Unexpected dialog display without renewal time.")
|
renewalTime = if (backupState is RemoteBackupsSettingsState.BackupState.WithTypeAndRenewalTime) {
|
||||||
},
|
backupState.renewalTime
|
||||||
onDismiss = contentCallbacks::onDialogDismissed,
|
} else {
|
||||||
onSkipClick = contentCallbacks::onSkipMediaRestore
|
error("Unexpected dialog display without renewal time.")
|
||||||
)
|
},
|
||||||
|
onDismiss = contentCallbacks::onDialogDismissed,
|
||||||
|
onSkipClick = contentCallbacks::onSkipMediaRestore
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteBackupsSettingsState.Dialog.CANCEL_MEDIA_RESTORE_PROTECTION -> {
|
RemoteBackupsSettingsState.Dialog.CANCEL_MEDIA_RESTORE_PROTECTION -> {
|
||||||
@@ -637,13 +641,14 @@ private fun ReenableBackupsButton(contentCallbacks: ContentCallbacks) {
|
|||||||
private fun LazyListScope.appendRestoreFromBackupStatusData(
|
private fun LazyListScope.appendRestoreFromBackupStatusData(
|
||||||
backupRestoreState: BackupRestoreState.FromBackupStatusData,
|
backupRestoreState: BackupRestoreState.FromBackupStatusData,
|
||||||
canRestoreUsingCellular: Boolean,
|
canRestoreUsingCellular: Boolean,
|
||||||
contentCallbacks: ContentCallbacks
|
contentCallbacks: ContentCallbacks,
|
||||||
|
isCancelable: Boolean = true
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
BackupStatusRow(
|
BackupStatusRow(
|
||||||
backupStatusData = backupRestoreState.backupStatusData,
|
backupStatusData = backupRestoreState.backupStatusData,
|
||||||
onCancelClick = contentCallbacks::onCancelMediaRestore,
|
onCancelClick = if (isCancelable) contentCallbacks::onCancelMediaRestore else null,
|
||||||
onSkipClick = contentCallbacks::onSkipMediaRestore,
|
onSkipClick = contentCallbacks::onDisplaySkipMediaRestoreProtectionDialog,
|
||||||
onLearnMoreClick = contentCallbacks::onLearnMoreAboutBackupFailure
|
onLearnMoreClick = contentCallbacks::onLearnMoreAboutBackupFailure
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -711,7 +716,8 @@ private fun LazyListScope.appendBackupDeletionItems(
|
|||||||
appendRestoreFromBackupStatusData(
|
appendRestoreFromBackupStatusData(
|
||||||
backupRestoreState = backupRestoreState,
|
backupRestoreState = backupRestoreState,
|
||||||
canRestoreUsingCellular = canRestoreUsingCellular,
|
canRestoreUsingCellular = canRestoreUsingCellular,
|
||||||
contentCallbacks = contentCallbacks
|
contentCallbacks = contentCallbacks,
|
||||||
|
isCancelable = false
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
item {
|
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
|
@Composable
|
||||||
private fun SkipDownloadDialog(
|
private fun SkipDownloadDialog(
|
||||||
renewalTime: Duration,
|
renewalTime: Duration,
|
||||||
@@ -1912,6 +1934,14 @@ private fun DownloadingYourBackupDialogPreview() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SignalPreview
|
||||||
|
@Composable
|
||||||
|
private fun SkipDownloadDuringDeleteDialogPreview() {
|
||||||
|
Previews.Preview {
|
||||||
|
SkipDownloadDuringDeleteDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SignalPreview
|
@SignalPreview
|
||||||
@Composable
|
@Composable
|
||||||
private fun SkipDownloadDialogPreview() {
|
private fun SkipDownloadDialogPreview() {
|
||||||
|
|||||||
@@ -8188,17 +8188,21 @@
|
|||||||
<string name="RemoteBackupsSettingsFragment__download">Download</string>
|
<string name="RemoteBackupsSettingsFragment__download">Download</string>
|
||||||
<!-- Dialog title for skipping download of backed up media -->
|
<!-- Dialog title for skipping download of backed up media -->
|
||||||
<string name="RemoteBackupsSettingsFragment__skip_download_question">Skip download?</string>
|
<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">
|
<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="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>
|
<item quantity="other">If you skip downloading the remaining media and attachments in your backup will be deleted in %1$d days.</item>
|
||||||
</plurals>
|
</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 -->
|
<!-- Dialog title for skipping download of in progress initial restore of backed up media -->
|
||||||
<string name="RemoteBackupsSettingsFragment__skip_restore_question">Skip restore?</string>
|
<string name="RemoteBackupsSettingsFragment__skip_restore_question">Skip restore?</string>
|
||||||
<!-- Dialog message for skipping download of in progress initial restore of backed up media -->
|
<!-- 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>
|
<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 -->
|
<!-- Positive dialog action to skip download -->
|
||||||
<string name="RemoteBackupsSettingsFragment__skip">Skip</string>
|
<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 -->
|
<!-- 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>
|
<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 -->
|
<!-- Dialog body for network error while trying to disable backups -->
|
||||||
|
|||||||
Reference in New Issue
Block a user