mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
Delete Unused Bits of StateService (#9858)
* Delete Unused Bits of StateService * Fix Tests
This commit is contained in:
@@ -4,7 +4,6 @@ import { APP_INITIALIZER, NgModule, Optional, SkipSelf } from "@angular/core";
|
||||
import { SafeProvider, safeProvider } from "@bitwarden/angular/platform/utils/safe-provider";
|
||||
import {
|
||||
SECURE_STORAGE,
|
||||
STATE_FACTORY,
|
||||
LOCALES_DIRECTORY,
|
||||
SYSTEM_LANGUAGE,
|
||||
MEMORY_STORAGE,
|
||||
@@ -30,10 +29,9 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil
|
||||
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { StateService as BaseStateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
|
||||
import { ThemeType } from "@bitwarden/common/platform/enums";
|
||||
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
||||
import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-storage.service";
|
||||
// eslint-disable-next-line import/no-restricted-paths -- Implementation for memory storage
|
||||
import { MigrationBuilderService } from "@bitwarden/common/platform/services/migration-builder.service";
|
||||
@@ -64,7 +62,7 @@ import { EventService } from "./event.service";
|
||||
import { InitService } from "./init.service";
|
||||
import { ModalService } from "./modal.service";
|
||||
import { RouterService } from "./router.service";
|
||||
import { Account, GlobalState, StateService } from "./state";
|
||||
import { StateService as WebStateService } from "./state";
|
||||
import { WebFileDownloadService } from "./web-file-download.service";
|
||||
import { WebPlatformUtilsService } from "./web-platform-utils.service";
|
||||
|
||||
@@ -90,10 +88,6 @@ const safeProviders: SafeProvider[] = [
|
||||
deps: [InitService],
|
||||
multi: true,
|
||||
}),
|
||||
safeProvider({
|
||||
provide: STATE_FACTORY,
|
||||
useValue: new StateFactory(GlobalState, Account),
|
||||
}),
|
||||
safeProvider({
|
||||
provide: I18nServiceAbstraction,
|
||||
useClass: I18nService,
|
||||
@@ -132,10 +126,10 @@ const safeProviders: SafeProvider[] = [
|
||||
useClass: ModalService,
|
||||
useAngularDecorators: true,
|
||||
}),
|
||||
safeProvider(StateService),
|
||||
safeProvider(WebStateService),
|
||||
safeProvider({
|
||||
provide: BaseStateServiceAbstraction,
|
||||
useExisting: StateService,
|
||||
provide: StateService,
|
||||
useExisting: WebStateService,
|
||||
}),
|
||||
safeProvider({
|
||||
provide: FileDownloadService,
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { Account as BaseAccount } from "@bitwarden/common/platform/models/domain/account";
|
||||
|
||||
// TODO: platform to clean up accounts in later PR
|
||||
export class Account extends BaseAccount {
|
||||
constructor(init: Partial<Account>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { GlobalState as BaseGlobalState } from "@bitwarden/common/platform/models/domain/global-state";
|
||||
|
||||
export class GlobalState extends BaseGlobalState {
|
||||
rememberEmail = true;
|
||||
}
|
||||
@@ -1,3 +1 @@
|
||||
export * from "./account";
|
||||
export * from "./global-state";
|
||||
export * from "./state.service";
|
||||
|
||||
@@ -11,13 +11,12 @@ import { EnvironmentService } from "@bitwarden/common/platform/abstractions/envi
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
|
||||
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
||||
import { Account } from "@bitwarden/common/platform/models/domain/account";
|
||||
import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state";
|
||||
import { StorageOptions } from "@bitwarden/common/platform/models/domain/storage-options";
|
||||
import { MigrationRunner } from "@bitwarden/common/platform/services/migration-runner";
|
||||
import { StateService as BaseStateService } from "@bitwarden/common/platform/services/state.service";
|
||||
|
||||
import { Account } from "./account";
|
||||
import { GlobalState } from "./global-state";
|
||||
|
||||
@Injectable()
|
||||
export class StateService extends BaseStateService<GlobalState, Account> {
|
||||
constructor(
|
||||
@@ -44,12 +43,6 @@ export class StateService extends BaseStateService<GlobalState, Account> {
|
||||
);
|
||||
}
|
||||
|
||||
async addAccount(account: Account) {
|
||||
// Apply web overrides to default account values
|
||||
account = new Account(account);
|
||||
await super.addAccount(account);
|
||||
}
|
||||
|
||||
override async getLastSync(options?: StorageOptions): Promise<string> {
|
||||
options = this.reconcileOptions(options, await this.defaultInMemoryOptions());
|
||||
return await super.getLastSync(options);
|
||||
|
||||
Reference in New Issue
Block a user