Do not display a price if it's been zeroed.

This commit is contained in:
Alex Hart
2025-09-23 15:37:10 -03:00
committed by Jeffrey Starke
parent 9b517a14cb
commit d0c1e93b3c
2 changed files with 26 additions and 0 deletions

View File

@@ -496,6 +496,11 @@ private fun ActiveBackupsRow(
is MessageBackupsType.Paid -> {
val body = if (backupState is BackupState.Canceled) {
stringResource(R.string.BackupsSettingsFragment__subscription_canceled)
} else if (type.pricePerMonth.amount == BigDecimal.ZERO) {
stringResource(
R.string.BackupsSettingsFragment_renews_s,
DateUtils.formatDateWithYear(Locale.getDefault(), backupState.renewalTime.inWholeMilliseconds)
)
} else {
stringResource(
R.string.BackupsSettingsFragment_s_month_renews_s,
@@ -694,6 +699,25 @@ private fun ActivePaidBackupsRowPreview() {
}
}
@SignalPreview
@Composable
private fun ActivePaidBackupsRowNoPricePreview() {
Previews.Preview {
ActiveBackupsRow(
backupState = BackupState.ActivePaid(
messageBackupsType = MessageBackupsType.Paid(
pricePerMonth = FiatMoney(BigDecimal.ZERO, Currency.getInstance("CAD")),
storageAllowanceBytes = 1_000_000,
mediaTtl = 30.days
),
renewalTime = 0.seconds,
price = FiatMoney(BigDecimal.valueOf(4), Currency.getInstance("CAD"))
),
lastBackupAt = 0.seconds
)
}
}
@SignalPreview
@Composable
private fun ActiveFreeBackupsRowPreview() {

View File

@@ -8142,6 +8142,8 @@
<!-- BackupsSettingsFragment -->
<!-- Subtitle for row for active backup, first placeholder is formatted amount, second is renewal date -->
<string name="BackupsSettingsFragment_s_month_renews_s">%1$s/month, renews %2$s</string>
<!-- Subtitle for row for active backup when price is not available, first placeholder is renewal date -->
<string name="BackupsSettingsFragment_renews_s">Renews %1$s</string>
<!-- Subtitle for row for active backup, placeholder is last date of backup -->
<string name="BackupsSettingsFragment_last_backup_s">Last backup %1$s</string>
<!-- Subtitle for row for canceled backup -->