Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  fix billing derp
  • Loading branch information
shalzz committed Jul 3, 2021
2 parents dd9d517 + f2f0559 commit 25cb61a
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions app/src/main/java/com/shalzz/attendance/billing/BillingManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ public BillingManager(AppCompatActivity activity,
// Setup all listeners before establishing a connection.
mConnectionDisposable.add(
connect()
.doOnSubscribe(disposable -> querySkuDetailsAsync())
.subscribe(result -> {
Timber.d("First Connection. Response code: %d", result.getResponseCode());
if (result.getResponseCode() == BillingResponseCode.OK) {
// IAB is fully setup. Now get an inventory of stuff the user owns.
querySkuDetailsAsync();
queryPurchases();
}
}));
Expand Down Expand Up @@ -261,11 +261,6 @@ private void onSkuDetailsResponse(BillingResult billingResult,
default:
Timber.wtf("onSkuDetailsResponse: %d %s",responseCode, debugMessage);
}
// if (responseCode == BillingClient.BillingResponseCode.OK) {
// skuDetailsResponseTime = SystemClock.elapsedRealtime();
// } else {
// skuDetailsResponseTime = -SKU_DETAILS_REQUERY_TIME
// }
}

/**
Expand All @@ -289,21 +284,23 @@ public void queryPurchases() {
public void querySkuDetailsAsync() {
Disposable disposable = connect()
.subscribe(result -> {
if (!BillingConstants.getSkuList(SkuType.INAPP).isEmpty()) {
SkuDetailsParams params =
SkuDetailsParams.newBuilder()
.setSkusList(BillingConstants.getSkuList(SkuType.INAPP))
.setType(SkuType.INAPP)
.build();
mBillingClient.querySkuDetailsAsync(params, this::onSkuDetailsResponse);
}
if (!BillingConstants.getSkuList(SkuType.SUBS).isEmpty()) {
SkuDetailsParams params =
SkuDetailsParams.newBuilder()
.setSkusList(BillingConstants.getSkuList(SkuType.SUBS))
.setType(SkuType.SUBS)
.build();
mBillingClient.querySkuDetailsAsync(params, this::onSkuDetailsResponse);
if (result.getResponseCode() == BillingResponseCode.OK) {
if (!BillingConstants.getSkuList(SkuType.INAPP).isEmpty()) {
SkuDetailsParams params =
SkuDetailsParams.newBuilder()
.setSkusList(BillingConstants.getSkuList(SkuType.INAPP))
.setType(SkuType.INAPP)
.build();
mBillingClient.querySkuDetailsAsync(params, this::onSkuDetailsResponse);
}
if (!BillingConstants.getSkuList(SkuType.SUBS).isEmpty()) {
SkuDetailsParams params =
SkuDetailsParams.newBuilder()
.setSkusList(BillingConstants.getSkuList(SkuType.SUBS))
.setType(SkuType.SUBS)
.build();
mBillingClient.querySkuDetailsAsync(params, this::onSkuDetailsResponse);
}
}
});
mConnectionDisposable.add(disposable);
Expand Down

0 comments on commit 25cb61a

Please sign in to comment.