Skip to content

Commit

Permalink
#1186 - Disable purchase button iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Mar 20, 2020
1 parent d966e70 commit 9f8773a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class LayersSidebarComponent extends BaseMapComponent {

public isPurchaseAvailable() {
return this.runningContextService.isCordova &&
!this.runningContextService.isIos &&
!this.ngRedux.getState().offlineState.isOfflineAvailable;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from "@angular/core";
import { NgRedux } from "@angular-redux/store";
import { InAppPurchase2, IAPProduct } from "@ionic-native/in-app-purchase-2/ngx";
import { InAppPurchase2 } from "@ionic-native/in-app-purchase-2/ngx";

import { RunningContextService } from "./running-context.service";
import { LoggingService } from "./logging.service";
Expand Down Expand Up @@ -39,6 +39,12 @@ export class PurchaseService {
});
this.store.when("product").approved(product => product.verify());
this.store.when("product").verified(product => product.finish());
if (this.runningContextService.isIos && this.runningContextService.isCordova) {
this.store.when("product").updated(p => {
this.ngRedux.dispatch(new SetOfflineAvailableAction({ isAvailble: false }));
this.loggingService.debug(JSON.stringify(p));
});
}
this.store.refresh();
}

Expand Down

0 comments on commit 9f8773a

Please sign in to comment.