Sync cancelling subscription with server

This commit is contained in:
max-klaus 2020-10-27 18:41:24 +03:00
parent da82ba519e
commit 1b53652adc
2 changed files with 10 additions and 4 deletions

View file

@ -557,10 +557,12 @@ public class InAppPurchaseHelper {
// Do we have the live updates? // Do we have the live updates?
boolean subscribedToLiveUpdates = false; boolean subscribedToLiveUpdates = false;
List<Purchase> liveUpdatesPurchases = new ArrayList<>(); List<Purchase> liveUpdatesPurchases = new ArrayList<>();
for (InAppPurchase p : getLiveUpdates().getAllSubscriptions()) { for (InAppSubscription s : getLiveUpdates().getAllSubscriptions()) {
Purchase purchase = getPurchase(p.getSku()); Purchase purchase = getPurchase(s.getSku());
if (purchase != null || s.getState().isActive()) {
if (purchase != null) { if (purchase != null) {
liveUpdatesPurchases.add(purchase); liveUpdatesPurchases.add(purchase);
}
if (!subscribedToLiveUpdates) { if (!subscribedToLiveUpdates) {
subscribedToLiveUpdates = true; subscribedToLiveUpdates = true;
} }

View file

@ -697,6 +697,10 @@ public class InAppPurchases {
public boolean isGone() { public boolean isGone() {
return this == ON_HOLD || this == PAUSED || this == EXPIRED; return this == ON_HOLD || this == PAUSED || this == EXPIRED;
} }
public boolean isActive() {
return this == ACTIVE || this == CANCELLED || this == IN_GRACE_PERIOD;
}
} }
InAppSubscription(@NonNull String skuNoVersion, int version) { InAppSubscription(@NonNull String skuNoVersion, int version) {