From 9b6f35580292cba628ebdd52bea699b0b2308251 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Mon, 10 Mar 2025 13:42:50 -0300 Subject: [PATCH] Resolve consistent subscription state after new subscription is created. --- .../remote/RemoteBackupsSettingsViewModel.kt | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt index d268ac66fd..08852a5c2b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt @@ -204,18 +204,27 @@ class RemoteBackupsSettingsViewModel : ViewModel() { BackupRepository.getBackupsType(MessageBackupTier.PAID) as MessageBackupsType.Paid } - if (hasActiveSignalSubscription && !hasActiveGooglePlayBillingSubscription) { - _state.update { - it.copy( - backupState = RemoteBackupsSettingsState.BackupState.SubscriptionMismatchMissingGooglePlay( - messageBackupsType = type, - renewalTime = activeSubscription!!.activeSubscription.endOfCurrentPeriod.seconds + when { + hasActiveSignalSubscription && !hasActiveGooglePlayBillingSubscription -> { + _state.update { + it.copy( + backupState = RemoteBackupsSettingsState.BackupState.SubscriptionMismatchMissingGooglePlay( + messageBackupsType = type, + renewalTime = activeSubscription!!.activeSubscription.endOfCurrentPeriod.seconds + ) ) - ) + } + + return + } + hasActiveSignalSubscription && hasActiveGooglePlayBillingSubscription -> { + Log.d(TAG, "Found erroneous mismatch. Clearing.") + SignalStore.backup.subscriptionStateMismatchDetected = false + } + else -> { + return } } - - return } when (tier) {