Resolve consistent subscription state after new subscription is created.

This commit is contained in:
Alex Hart
2025-03-10 13:42:50 -03:00
committed by Greyson Parrelli
parent 5ec3371b9a
commit 9b6f355802

View File

@@ -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) {