mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
makingPremiumAfterPurchase check
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 034aefa652...e16cb9b801
@@ -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;
|
||||
}
|
||||
try {
|
||||
this.makingPremiumAfterPurchase = true;
|
||||
await this.makePremium(false);
|
||||
} catch { }
|
||||
this.makingPremiumAfterPurchase = false;
|
||||
// Finish the transaction.
|
||||
remote.inAppPurchase.finishTransactionByDate(transaction.transactionDate);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user