Add proper turn off backups string for paid tier.

This commit is contained in:
Alex Hart
2025-06-12 16:05:28 -03:00
committed by Michelle Tang
parent a5ff92b831
commit e6ea66f9c5
4 changed files with 15 additions and 1 deletions

View File

@@ -552,6 +552,7 @@ private fun RemoteBackupsSettingsContent(
RemoteBackupsSettingsState.Dialog.TURN_OFF_AND_DELETE_BACKUPS -> {
TurnOffAndDeleteBackupsDialog(
tier = state.tier!!,
onConfirm = contentCallbacks::onTurnOffAndDeleteBackupsConfirm,
onDismiss = contentCallbacks::onDialogDismissed
)
@@ -1482,12 +1483,18 @@ private fun FailedToTurnOffBackupDialog(
@Composable
private fun TurnOffAndDeleteBackupsDialog(
tier: MessageBackupTier,
onConfirm: () -> Unit,
onDismiss: () -> Unit
) {
val body = when (tier) {
MessageBackupTier.FREE -> R.string.RemoteBackupsSettingsFragment__your_backup_will_be_deleted_and_no_new_backups_will_be_created
MessageBackupTier.PAID -> R.string.RemoteBackupsSettingsFragment__your_subscription_will_be_canceled
}
Dialogs.SimpleAlertDialog(
title = stringResource(id = R.string.RemoteBackupsSettingsFragment__turn_off_and_delete_backups),
body = stringResource(id = R.string.RemoteBackupsSettingsFragment__your_backup_will_be_deleted_and_no_new_backups_will_be_created),
body = stringResource(id = body),
confirm = stringResource(id = R.string.RemoteBackupsSettingsFragment__turn_off_and_delete),
dismiss = stringResource(id = android.R.string.cancel),
confirmColor = MaterialTheme.colorScheme.error,
@@ -1988,6 +1995,7 @@ private fun FailedToTurnOffBackupDialogPreview() {
private fun TurnOffAndDeleteBackupsDialogPreview() {
Previews.Preview {
TurnOffAndDeleteBackupsDialog(
tier = MessageBackupTier.PAID,
onConfirm = {},
onDismiss = {}
)

View File

@@ -6,9 +6,11 @@
package org.thoughtcrime.securesms.components.settings.app.backups.remote
import org.thoughtcrime.securesms.backup.v2.BackupFrequency
import org.thoughtcrime.securesms.backup.v2.MessageBackupTier
import org.thoughtcrime.securesms.components.settings.app.backups.BackupState
data class RemoteBackupsSettingsState(
val tier: MessageBackupTier? = null,
val backupsEnabled: Boolean,
val canViewBackupKey: Boolean = false,
val canBackUpUsingCellular: Boolean = false,

View File

@@ -57,6 +57,7 @@ class RemoteBackupsSettingsViewModel : ViewModel() {
private val _state = MutableStateFlow(
RemoteBackupsSettingsState(
tier = SignalStore.backup.backupTier,
backupsEnabled = SignalStore.backup.areBackupsEnabled,
canViewBackupKey = !TextSecurePreferences.isUnauthorizedReceived(AppDependencies.application),
lastBackupTimestamp = SignalStore.backup.lastBackupTime,
@@ -224,6 +225,7 @@ class RemoteBackupsSettingsViewModel : ViewModel() {
private suspend fun performStateRefresh(lastPurchase: InAppPaymentTable.InAppPayment?) {
_state.update {
it.copy(
tier = SignalStore.backup.backupTier,
backupsEnabled = SignalStore.backup.areBackupsEnabled,
lastBackupTimestamp = SignalStore.backup.lastBackupTime,
backupMediaSize = SignalDatabase.attachments.getEstimatedArchiveMediaSize(),

View File

@@ -8155,6 +8155,8 @@
<string name="RemoteBackupsSettingsFragment__turn_off_and_delete_backups">Turn off and delete backups?</string>
<!-- Dialog message when confirming whether to turn off and delete backups -->
<string name="RemoteBackupsSettingsFragment__your_backup_will_be_deleted_and_no_new_backups_will_be_created">Your backup will be deleted and no new backups will be created. Any media stored in your backup will be downloaded to your phone now.</string>
<!-- Dialog message when confirming whether to turn off and delete backups -->
<string name="RemoteBackupsSettingsFragment__your_subscription_will_be_canceled">Your subscription will be canceled and you won\'t be charged again. Your backup will also be deleted and no new backups will be created. Any media stored in your backup will be downloaded to your phone now.</string>
<!-- Confirmation action on dialog to turn off and delete backups -->
<string name="RemoteBackupsSettingsFragment__turn_off_and_delete">Turn off and delete</string>
<!-- Text on dialog while user backup is being deleted -->