|
|
|
@ -78,7 +78,7 @@ object AppGuard : PurchasesUpdatedListener { |
|
|
|
"august2020" -> "01/8/2020" |
|
|
|
"august2020" -> "01/8/2020" |
|
|
|
"april2021" -> "09/4/2021" |
|
|
|
"april2021" -> "09/4/2021" |
|
|
|
"nov2020" -> "08/11/2020" |
|
|
|
"nov2020" -> "08/11/2020" |
|
|
|
"oct2021" -> "01/10/2021" |
|
|
|
"oct2021" -> "10/10/2021" |
|
|
|
else -> null |
|
|
|
else -> null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -103,9 +103,9 @@ object AppGuard : PurchasesUpdatedListener { |
|
|
|
|
|
|
|
|
|
|
|
billingClient = BillingClient.newBuilder(context).setListener(this).enablePendingPurchases().build() |
|
|
|
billingClient = BillingClient.newBuilder(context).setListener(this).enablePendingPurchases().build() |
|
|
|
|
|
|
|
|
|
|
|
this.startConnection(Runnable { |
|
|
|
this.startConnection { |
|
|
|
this.updatePurchases() |
|
|
|
this.updatePurchases() |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -154,9 +154,9 @@ object AppGuard : PurchasesUpdatedListener { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun requestPurchasesUpdate() { |
|
|
|
fun requestPurchasesUpdate() { |
|
|
|
this.executeServiceRequest(Runnable { |
|
|
|
this.executeServiceRequest { |
|
|
|
this.updatePurchases() |
|
|
|
this.updatePurchases() |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -167,10 +167,8 @@ object AppGuard : PurchasesUpdatedListener { |
|
|
|
this.resetPurchases() |
|
|
|
this.resetPurchases() |
|
|
|
// Automatically checks for purchases (when switching devices for example) |
|
|
|
// Automatically checks for purchases (when switching devices for example) |
|
|
|
val purchasesResult = billingClient.queryPurchases(BillingClient.SkuType.SUBS) |
|
|
|
val purchasesResult = billingClient.queryPurchases(BillingClient.SkuType.SUBS) |
|
|
|
if (purchasesResult != null) { |
|
|
|
purchasesResult.purchasesList?.forEach { |
|
|
|
purchasesResult.purchasesList?.forEach { |
|
|
|
this.handlePurchase(it) |
|
|
|
this.handlePurchase(it) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -194,9 +192,9 @@ object AppGuard : PurchasesUpdatedListener { |
|
|
|
val params = SkuDetailsParams.newBuilder() |
|
|
|
val params = SkuDetailsParams.newBuilder() |
|
|
|
params.setSkusList(skuList).setType(BillingClient.SkuType.SUBS) |
|
|
|
params.setSkusList(skuList).setType(BillingClient.SkuType.SUBS) |
|
|
|
|
|
|
|
|
|
|
|
this.executeServiceRequest(Runnable { |
|
|
|
this.executeServiceRequest { |
|
|
|
billingClient.querySkuDetailsAsync(params.build(), listener) |
|
|
|
billingClient.querySkuDetailsAsync(params.build(), listener) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
@ -212,10 +210,10 @@ object AppGuard : PurchasesUpdatedListener { |
|
|
|
.setSkuDetails(skuDetails) |
|
|
|
.setSkuDetails(skuDetails) |
|
|
|
.build() |
|
|
|
.build() |
|
|
|
|
|
|
|
|
|
|
|
this.executeServiceRequest(Runnable { |
|
|
|
this.executeServiceRequest { |
|
|
|
val responseCode = billingClient.launchBillingFlow(activity, flowParams) |
|
|
|
val responseCode = billingClient.launchBillingFlow(activity, flowParams) |
|
|
|
Timber.d("launchBillingFlow returned $responseCode") |
|
|
|
Timber.d("launchBillingFlow returned $responseCode") |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|