diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt index e4612e11ac..a6ddb17003 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt @@ -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() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6f79abe8d4..127b094762 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -8188,17 +8188,21 @@ Download Skip download? - + If you skip downloading the remaining media and attachments in your backup will be deleted in %1$d day. If you skip downloading the remaining media and attachments in your backup will be deleted in %1$d days. + + If you skip downloading the remaining media and attachments in your backup they will be permanently deleted. This data won\'t be recoverable. Skip restore? If you skip restore the remaining media and attachments in your backup can be downloaded at a later time. Skip + + Skip and delete permanently Couldn\'t turn off and delete backups