1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-08-20 22:14:08 +02:00

makingPremiumAfterPurchase check

This commit is contained in:
Kyle Spearrin 2019-10-07 14:30:53 -04:00
parent e52f593d8b
commit 9c7a5b3c1a
2 changed files with 9 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit 034aefa652459c9ed5a660fe13593e314ee368dc
Subproject commit e16cb9b801bec1cf1744d8b48f39421ad37e1644

View File

@ -34,6 +34,8 @@ export class PremiumComponent extends BasePremiumComponent {
appStoreFormattedPrice = '$14.99';
canRestorePurchase = false;
private makingPremiumAfterPurchase = false;
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
tokenService: TokenService, apiService: ApiService,
private ngZone: NgZone, private messagingService: MessagingService,
@ -78,10 +80,14 @@ export class PremiumComponent extends BasePremiumComponent {
case 'purchased':
// tslint:disable-next-line
console.log(`${payment.productIdentifier} purchased.`);
if (payment.productIdentifier !== AppStorePremiumPlan) {
if (this.makingPremiumAfterPurchase || payment.productIdentifier !== AppStorePremiumPlan) {
return;
}
await this.makePremium(false);
try {
this.makingPremiumAfterPurchase = true;
await this.makePremium(false);
} catch { }
this.makingPremiumAfterPurchase = false;
// Finish the transaction.
remote.inAppPurchase.finishTransactionByDate(transaction.transactionDate);
break;