Add new dialog and sheet for handling offloaded media after a subscription is canceled or expires.

This commit is contained in:
Alex Hart
2025-06-09 15:41:10 -03:00
committed by Greyson Parrelli
parent 18b5354944
commit 1424dd6892
11 changed files with 562 additions and 68 deletions

View File

@@ -1028,7 +1028,7 @@ private fun BackupCard(
)
} else if (backupState is RemoteBackupsSettingsState.BackupState.Canceled) {
CallToActionButton(
text = stringResource(R.string.RemoteBackupsSettingsFragment__renew),
text = stringResource(R.string.RemoteBackupsSettingsFragment__resubscribe),
enabled = buttonsEnabled,
onClick = { onBackupTypeActionButtonClicked(MessageBackupTier.FREE) }
)
@@ -1634,8 +1634,7 @@ private fun BackupReadyToDownloadRow(
onDownloadClick: () -> Unit = {}
) {
val string = if (backupState is RemoteBackupsSettingsState.BackupState.Canceled) {
val days = (backupState.renewalTime - System.currentTimeMillis().milliseconds).inWholeDays.toInt()
pluralStringResource(R.plurals.RemoteBackupsSettingsFragment__you_have_s_of_backup_data, days, ready.bytes, days)
stringResource(R.string.RemoteBackupsSettingsFragment__you_have_s_of_backup_data, ready.bytes)
} else {
stringResource(R.string.RemoteBackupsSettingsFragment__you_have_s_of_backup_data_not_on_device, ready.bytes)
}
@@ -1841,6 +1840,24 @@ private fun BackupReadyToDownloadPreview() {
}
}
@SignalPreview
@Composable
private fun BackupReadyToDownloadAfterCancelPreview() {
Previews.Preview {
BackupReadyToDownloadRow(
ready = BackupRestoreState.Ready("12GB"),
backupState = RemoteBackupsSettingsState.BackupState.Canceled(
messageBackupsType = MessageBackupsType.Paid(
pricePerMonth = FiatMoney(BigDecimal.ONE, Currency.getInstance("USD")),
storageAllowanceBytes = 10.gibiBytes.bytes,
mediaTtl = 30.days
),
renewalTime = System.currentTimeMillis().days + 10.days
)
)
}
}
@SignalPreview
@Composable
private fun LastBackupRowPreview() {