mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 11:15:44 +00:00
Fully check result code when processing purchase results.
This commit is contained in:
@@ -252,7 +252,10 @@ class BackupStateObserver(
|
||||
if (SignalStore.backup.subscriptionStateMismatchDetected) {
|
||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] A mismatch was detected.")
|
||||
|
||||
val hasActiveGooglePlayBillingSubscription = when (val purchaseResult = AppDependencies.billingApi.queryPurchases()) {
|
||||
val purchaseResult = AppDependencies.billingApi.queryPurchases()
|
||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] queryPurchase result: $purchaseResult")
|
||||
|
||||
val hasActiveGooglePlayBillingSubscription = when (purchaseResult) {
|
||||
is BillingPurchaseResult.Success -> {
|
||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] Found a purchase: $purchaseResult")
|
||||
purchaseResult.isAcknowledged && purchaseResult.isAutoRenewing
|
||||
|
||||
@@ -118,6 +118,12 @@ class BackupSubscriptionCheckJob private constructor(parameters: Parameters) : C
|
||||
val purchase: BillingPurchaseResult = AppDependencies.billingApi.queryPurchases()
|
||||
Log.i(TAG, "Retrieved purchase result from Billing api: $purchase", true)
|
||||
|
||||
if (purchase !is BillingPurchaseResult.Success && purchase !is BillingPurchaseResult.None) {
|
||||
Log.w(TAG, "Possible error when grabbing purchase from billing API. Clearing mismatch and exiting.")
|
||||
SignalStore.backup.subscriptionStateMismatchDetected = false
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
val hasActivePurchase = purchase is BillingPurchaseResult.Success && purchase.isAcknowledged
|
||||
val product: BillingProduct? = AppDependencies.billingApi.queryProduct()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user