[PS-153] upgrade premium on refresh (#813)
* sync premium state on refresh * lint fix
This commit is contained in:
parent
1ea2824c24
commit
0d658ba26d
|
@ -58,6 +58,7 @@ export abstract class StateService<T extends Account = Account> {
|
|||
getBiometricUnlock: (options?: StorageOptions) => Promise<boolean>;
|
||||
setBiometricUnlock: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||
getCanAccessPremium: (options?: StorageOptions) => Promise<boolean>;
|
||||
setCanAccessPremium: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||
getClearClipboard: (options?: StorageOptions) => Promise<number>;
|
||||
setClearClipboard: (value: number, options?: StorageOptions) => Promise<void>;
|
||||
getCollapsedGroupings: (options?: StorageOptions) => Promise<string[]>;
|
||||
|
|
|
@ -359,6 +359,17 @@ export class StateService<
|
|||
return false;
|
||||
}
|
||||
|
||||
async setCanAccessPremium(value: boolean, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
);
|
||||
account.profile.hasPremiumPersonally = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
);
|
||||
}
|
||||
|
||||
async getClearClipboard(options?: StorageOptions): Promise<number> {
|
||||
return (
|
||||
(
|
||||
|
|
|
@ -304,6 +304,7 @@ export class SyncService implements SyncServiceAbstraction {
|
|||
await this.cryptoService.setOrgKeys(response.organizations, response.providerOrganizations);
|
||||
await this.stateService.setSecurityStamp(response.securityStamp);
|
||||
await this.stateService.setEmailVerified(response.emailVerified);
|
||||
await this.stateService.setCanAccessPremium(response.premium);
|
||||
await this.stateService.setForcePasswordReset(response.forcePasswordReset);
|
||||
await this.keyConnectorService.setUsesKeyConnector(response.usesKeyConnector);
|
||||
|
||||
|
|
Loading…
Reference in New Issue