Add "Backups Subscription not found" states.

This commit is contained in:
Alex Hart
2024-10-30 12:13:03 -03:00
committed by GitHub
parent d51fe5fe81
commit ddcb9564bb
13 changed files with 513 additions and 39 deletions

View File

@@ -43,6 +43,7 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_ARCHIVE_UPLOAD_STATE = "backup.archiveUploadState"
private const val KEY_BACKUP_UPLOADED = "backup.backupUploaded"
private const val KEY_SUBSCRIPTION_STATE_MISMATCH = "backup.subscriptionStateMismatch"
private val cachedCdnCredentialsExpiresIn: Duration = 12.hours
}
@@ -73,6 +74,12 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
*/
val latestBackupTier: MessageBackupTier? by enumValue(KEY_LATEST_BACKUP_TIER, null, MessageBackupTier.Serializer)
/**
* Denotes if there was a mismatch detected between the user's Signal subscription, on-device Google Play subscription,
* and what zk authorization we think we have.
*/
var subscriptionStateMismatchDetected: Boolean by booleanValue(KEY_SUBSCRIPTION_STATE_MISMATCH, false)
/**
* When seting the backup tier, we also want to write to the latestBackupTier, as long as
* the value is non-null. This gives us a 1-deep history of the selected backup tier for

View File

@@ -469,6 +469,7 @@ class InAppPaymentValues internal constructor(store: KeyValueStore) : SignalStor
}
markDonationManuallyCancelled()
} else {
SignalStore.backup.subscriptionStateMismatchDetected = false
markBackupSubscriptionpManuallyCancelled()
SignalStore.backup.disableBackups()
@@ -513,6 +514,7 @@ class InAppPaymentValues internal constructor(store: KeyValueStore) : SignalStor
} else {
clearBackupSubscriptionManuallyCancelled()
SignalStore.backup.subscriptionStateMismatchDetected = false
SignalStore.backup.backupTier = MessageBackupTier.PAID
SignalStore.uiHints.markHasEverEnabledRemoteBackups()
}