Move providers to profile and save to disk (#662)

* Move providers to profile and save to disk

* Move providers back to AccountData
This commit is contained in:
Robyn MacCallum 2022-02-10 13:55:36 -05:00 committed by GitHub
parent b7bb16c18a
commit 47399bb583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -1846,8 +1846,9 @@ export class StateService<
} }
async getProviders(options?: StorageOptions): Promise<{ [id: string]: ProviderData }> { async getProviders(options?: StorageOptions): Promise<{ [id: string]: ProviderData }> {
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))) return (
?.data?.providers; await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
)?.data?.providers;
} }
async setProviders( async setProviders(
@ -1855,10 +1856,13 @@ export class StateService<
options?: StorageOptions options?: StorageOptions
): Promise<void> { ): Promise<void> {
const account = await this.getAccount( const account = await this.getAccount(
this.reconcileOptions(options, this.defaultInMemoryOptions) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
account.data.providers = value; account.data.providers = value;
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); await this.saveAccount(
account,
this.reconcileOptions(options, await this.defaultOnDiskOptions())
);
} }
async getPublicKey(options?: StorageOptions): Promise<ArrayBuffer> { async getPublicKey(options?: StorageOptions): Promise<ArrayBuffer> {