diff --git a/jslib b/jslib index 575a28e25f..929dd8415d 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 575a28e25fd27969d0335f06b1778027f1214c3e +Subproject commit 929dd8415dcd69032e545b20f75c1c8abaad0e3a diff --git a/src/app/settings/user-billing.component.ts b/src/app/settings/user-billing.component.ts index 5e244922f7..1cf39c1295 100644 --- a/src/app/settings/user-billing.component.ts +++ b/src/app/settings/user-billing.component.ts @@ -75,7 +75,8 @@ export class UserBillingComponent implements OnInit { addCredit() { if (this.paymentSourceInApp) { - this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase')); + this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase'), + this.i18nService.t('addCredit'), null, null, 'warning'); return; } this.showAddCredit = true; @@ -90,7 +91,8 @@ export class UserBillingComponent implements OnInit { changePayment() { if (this.paymentSourceInApp) { - this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase')); + this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase'), + this.i18nService.t('changePaymentMethod'), null, null, 'warning'); return; } this.showAdjustPayment = true; diff --git a/src/app/settings/user-subscription.component.ts b/src/app/settings/user-subscription.component.ts index 951a5f9545..9d6c0a7f95 100644 --- a/src/app/settings/user-subscription.component.ts +++ b/src/app/settings/user-subscription.component.ts @@ -63,6 +63,12 @@ export class UserSubscriptionComponent implements OnInit { return; } + if (this.usingInAppPurchase) { + this.platformUtilsService.showDialog(this.i18nService.t('manageSubscriptionFromStore'), + this.i18nService.t('cancelSubscription'), null, null, 'warning'); + return; + } + const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('reinstateConfirmation'), this.i18nService.t('reinstateSubscription'), this.i18nService.t('yes'), this.i18nService.t('cancel')); if (!confirmed) { @@ -83,6 +89,12 @@ export class UserSubscriptionComponent implements OnInit { return; } + if (this.usingInAppPurchase) { + this.platformUtilsService.showDialog(this.i18nService.t('manageSubscriptionFromStore'), + this.i18nService.t('cancelSubscription'), null, null, 'warning'); + return; + } + const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('cancelConfirmation'), this.i18nService.t('cancelSubscription'), this.i18nService.t('yes'), this.i18nService.t('no'), 'warning'); if (!confirmed) { @@ -122,6 +134,11 @@ export class UserSubscriptionComponent implements OnInit { } adjustStorage(add: boolean) { + if (this.usingInAppPurchase) { + this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase'), + this.i18nService.t(add ? 'addStorage' : 'removeStorage'), null, null, 'warning'); + return; + } this.adjustStorageAdd = add; this.showAdjustStorage = true; } @@ -153,4 +170,8 @@ export class UserSubscriptionComponent implements OnInit { get storageProgressWidth() { return this.storagePercentage < 5 ? 5 : 0; } + + get usingInAppPurchase() { + return this.sub != null ? this.sub.usingInAppPurchase : false; + } } diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 2c96b8c8d8..839d2e4f35 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -2935,5 +2935,8 @@ }, "cannotPerformInAppPurchase": { "message": "You cannot perform this action while using an in-app purchase payment method." + }, + "manageSubscriptionFromStore": { + "message": "You must manage your subscription from the store where your in-app purchase was made." } }