mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +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';
|
appStoreFormattedPrice = '$14.99';
|
||||||
canRestorePurchase = false;
|
canRestorePurchase = false;
|
||||||
|
|
||||||
|
private makingPremiumAfterPurchase = false;
|
||||||
|
|
||||||
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
tokenService: TokenService, apiService: ApiService,
|
tokenService: TokenService, apiService: ApiService,
|
||||||
private ngZone: NgZone, private messagingService: MessagingService,
|
private ngZone: NgZone, private messagingService: MessagingService,
|
||||||
@@ -78,10 +80,14 @@ export class PremiumComponent extends BasePremiumComponent {
|
|||||||
case 'purchased':
|
case 'purchased':
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
console.log(`${payment.productIdentifier} purchased.`);
|
console.log(`${payment.productIdentifier} purchased.`);
|
||||||
if (payment.productIdentifier !== AppStorePremiumPlan) {
|
if (this.makingPremiumAfterPurchase || payment.productIdentifier !== AppStorePremiumPlan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
this.makingPremiumAfterPurchase = true;
|
||||||
await this.makePremium(false);
|
await this.makePremium(false);
|
||||||
|
} catch { }
|
||||||
|
this.makingPremiumAfterPurchase = false;
|
||||||
// Finish the transaction.
|
// Finish the transaction.
|
||||||
remote.inAppPurchase.finishTransactionByDate(transaction.transactionDate);
|
remote.inAppPurchase.finishTransactionByDate(transaction.transactionDate);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user