#1405 - Fix upgrade restoration

This commit is contained in:
moezbhatti
2019-04-10 22:38:07 -04:00
parent cc7f573e54
commit b7f5cd2fa2
@@ -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())
}
}
}