Browse Source

Update jslib (#1436)

pull/1438/head
Addison Beck 4 years ago committed by GitHub
parent
commit
e09898e4d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      jslib
  2. 2
      src/app/services/services.module.ts
  3. 2
      src/services/state.service.ts
  4. 6
      src/services/stateMigration.service.ts

2
jslib

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 009f69fcb1fc2168f015e5bc6de3a8583cbfe5fd
Subproject commit 82a51f5d17c3f25d7c24110b94db606ac117bcbc

2
src/app/services/services.module.ts

@ -191,7 +191,7 @@ export function initFactory( @@ -191,7 +191,7 @@ export function initFactory(
new StateMigrationService(
storageService,
secureStorageService,
new GlobalStateFactory(GlobalState)
new StateFactory(GlobalState, Account)
),
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
},

2
src/services/state.service.ts

@ -8,7 +8,7 @@ import { StateService as StateServiceAbstraction } from "../abstractions/state.s @@ -8,7 +8,7 @@ import { StateService as StateServiceAbstraction } from "../abstractions/state.s
import { StorageOptions } from "jslib-common/models/domain/storageOptions";
export class StateService
extends BaseStateService<Account, GlobalState>
extends BaseStateService<GlobalState, Account>
implements StateServiceAbstraction
{
async addAccount(account: Account) {

6
src/services/stateMigration.service.ts

@ -1,10 +1,12 @@ @@ -1,10 +1,12 @@
import { StateMigrationService as BaseStateMigrationService } from "jslib-common/services/stateMigration.service";
import { Account } from "../models/account";
import { GlobalState } from "../models/globalState";
export class StateMigrationService extends BaseStateMigrationService<GlobalState> {
export class StateMigrationService extends BaseStateMigrationService<GlobalState, Account> {
protected async migrationStateFrom1To2(): Promise<void> {
await super.migrateStateFrom1To2();
const globals = (await this.get<GlobalState>("global")) ?? this.globalStateFactory.create();
const globals = (await this.get<GlobalState>("global")) ?? this.stateFactory.createGlobal(null);
globals.rememberEmail = (await this.get<boolean>("rememberEmail")) ?? globals.rememberEmail;
await this.set("global", globals);
}

Loading…
Cancel
Save