1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-25 01:22:26 +01:00

limit sub and billing actions when using iap

This commit is contained in:
Kyle Spearrin 2019-09-19 16:34:44 -04:00
parent 6cb48c186e
commit 89708d1fd6
4 changed files with 29 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit 575a28e25fd27969d0335f06b1778027f1214c3e
Subproject commit 929dd8415dcd69032e545b20f75c1c8abaad0e3a

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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."
}
}