Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7f5cd2f authored by moezbhatti's avatar moezbhatti
Browse files

#1405 - Fix upgrade restoration

parent cc7f573e
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -77,10 +77,13 @@ class BillingManager @Inject constructor(

    private fun queryPurchases() {
        executeServiceRequest {
            val purchasesResult = billingClient.queryPurchases(SkuType.INAPP)
            // Load the cached data
            purchaseListObservable.onNext(billingClient.queryPurchases(SkuType.INAPP).purchasesList.orEmpty())

            // Handle purchase result
            purchaseListObservable.onNext(purchasesResult.purchasesList.orEmpty())
            // On a fresh device, the purchase might not be cached, and so we'll need to force a refresh
            billingClient.queryPurchaseHistoryAsync(SkuType.INAPP) { _, _ ->
                purchaseListObservable.onNext(billingClient.queryPurchases(SkuType.INAPP).purchasesList.orEmpty())
            }
        }
    }