1
0
mirror of https://github.com/bitwarden/web synced 2025-12-10 21:33:16 +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

@@ -24,6 +24,7 @@ import { ContainerService } from "jslib-common/services/container.service";
import { CryptoService } from "jslib-common/services/crypto.service";
import { EventService as EventLoggingService } from "jslib-common/services/event.service";
import { ImportService } from "jslib-common/services/import.service";
import { StateMigrationService } from "jslib-common/services/stateMigration.service";
import { VaultTimeoutService } from "jslib-common/services/vaultTimeout.service";
import { ApiService as ApiServiceAbstraction } from "jslib-common/abstractions/api.service";
@@ -52,13 +53,14 @@ import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "jslib-com
import { ThemeType } from "jslib-common/enums/themeType";
import { AccountFactory } from "jslib-common/models/domain/account";
import { Account } from "../../models/account";
import { GlobalState } from "../../models/globalState";
import { GlobalStateFactory } from "jslib-common/factories/globalStateFactory";
import { StateFactory } from "jslib-common/factories/stateFactory";
export function initFactory(
window: Window,
storageService: StorageServiceAbstraction,
environmentService: EnvironmentServiceAbstraction,
notificationsService: NotificationsServiceAbstraction,
vaultTimeoutService: VaultTimeoutService,
@@ -70,7 +72,6 @@ export function initFactory(
cryptoService: CryptoServiceAbstraction
): Function {
return async () => {
await (storageService as HtmlStorageService).init();
await stateService.init();
const urls = process.env.URLS as Urls;
@@ -110,7 +111,6 @@ export function initFactory(
useFactory: initFactory,
deps: [
"WINDOW",
StorageServiceAbstraction,
EnvironmentServiceAbstraction,
NotificationsServiceAbstraction,
VaultTimeoutServiceAbstraction,
@@ -180,6 +180,19 @@ export function initFactory(
StateServiceAbstraction,
],
},
{
provide: StateMigrationServiceAbstraction,
useFactory: (
storageService: StorageServiceAbstraction,
secureStorageService: StorageServiceAbstraction
) =>
new StateMigrationService(
storageService,
secureStorageService,
new GlobalStateFactory(GlobalState)
),
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
},
{
provide: StateServiceAbstraction,
useFactory: (
@@ -193,7 +206,7 @@ export function initFactory(
secureStorageService,
logService,
stateMigrationService,
new AccountFactory(Account)
new StateFactory(GlobalState, Account)
),
deps: [
StorageServiceAbstraction,