1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-26 21:23:34 +00:00

[bug] Extend GlobalState to supply correct default theme (#1422)

* [bug] Extend GlobalState to supply correct default theme

The default theme for most clients is System, but web uses Light.
We need to extend GlobalState in web to reflect this.

* [chore] Update jslib
This commit is contained in:
Addison Beck
2022-01-31 14:53:55 -05:00
committed by GitHub
parent e3b962a779
commit d79f074825
4 changed files with 27 additions and 19 deletions

View File

@@ -4,8 +4,6 @@ import { StorageService } from "jslib-common/abstractions/storage.service";
import { HtmlStorageLocation } from "jslib-common/enums/htmlStorageLocation";
import { GlobalState } from "jslib-common/models/domain/globalState";
import { State } from "jslib-common/models/domain/state";
import { StorageOptions } from "jslib-common/models/domain/storageOptions";
@Injectable()
@@ -14,16 +12,6 @@ export class HtmlStorageService implements StorageService {
return { htmlStorageLocation: HtmlStorageLocation.Session };
}
async init() {
const state =
(await this.get<State>("state", { htmlStorageLocation: HtmlStorageLocation.Local })) ??
new State();
state.globals = state.globals ?? new GlobalState();
state.globals.vaultTimeout = state.globals.vaultTimeout ?? 15;
state.globals.vaultTimeoutAction = state.globals.vaultTimeoutAction ?? "lock";
await this.save("state", state, { htmlStorageLocation: HtmlStorageLocation.Local });
}
get<T>(key: string, options: StorageOptions = this.defaultOptions): Promise<T> {
let json: string = null;
switch (options.htmlStorageLocation) {