mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 11:43:46 +00:00
[Account Switching] Base changes for account switching (#2250)
* Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
This commit is contained in:
committed by
GitHub
parent
ade2a96239
commit
bd770c90ed
@@ -1,12 +1,10 @@
|
||||
import { Component } from "@angular/core";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
import { CryptoFunctionService } from "jslib-common/abstractions/cryptoFunction.service";
|
||||
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
|
||||
import { Utils } from "jslib-common/misc/utils";
|
||||
|
||||
@@ -18,7 +16,7 @@ export class HomeComponent {
|
||||
constructor(
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
private passwordGenerationService: PasswordGenerationService,
|
||||
private storageService: StorageService,
|
||||
private stateService: StateService,
|
||||
private cryptoFunctionService: CryptoFunctionService,
|
||||
private environmentService: EnvironmentService
|
||||
) {}
|
||||
@@ -41,8 +39,8 @@ export class HomeComponent {
|
||||
const codeVerifierHash = await this.cryptoFunctionService.hash(codeVerifier, "sha256");
|
||||
const codeChallenge = Utils.fromBufferToUrlB64(codeVerifierHash);
|
||||
|
||||
await this.storageService.save(ConstantsService.ssoCodeVerifierKey, codeVerifier);
|
||||
await this.storageService.save(ConstantsService.ssoStateKey, state);
|
||||
await this.stateService.setSsoCodeVerifier(codeVerifier);
|
||||
await this.stateService.setSsoState(state);
|
||||
|
||||
let url = this.environmentService.getWebVaultUrl();
|
||||
if (url == null) {
|
||||
|
||||
@@ -2,8 +2,6 @@ import { Component, NgZone } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
import { ApiService } from "jslib-common/abstractions/api.service";
|
||||
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||
@@ -13,8 +11,6 @@ import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
import { LockComponent as BaseLockComponent } from "jslib-angular/components/lock.component";
|
||||
@@ -31,9 +27,7 @@ export class LockComponent extends BaseLockComponent {
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
messagingService: MessagingService,
|
||||
userService: UserService,
|
||||
cryptoService: CryptoService,
|
||||
storageService: StorageService,
|
||||
vaultTimeoutService: VaultTimeoutService,
|
||||
environmentService: EnvironmentService,
|
||||
stateService: StateService,
|
||||
@@ -47,9 +41,7 @@ export class LockComponent extends BaseLockComponent {
|
||||
i18nService,
|
||||
platformUtilsService,
|
||||
messagingService,
|
||||
userService,
|
||||
cryptoService,
|
||||
storageService,
|
||||
vaultTimeoutService,
|
||||
environmentService,
|
||||
stateService,
|
||||
@@ -65,8 +57,7 @@ export class LockComponent extends BaseLockComponent {
|
||||
async ngOnInit() {
|
||||
await super.ngOnInit();
|
||||
const disableAutoBiometricsPrompt =
|
||||
(await this.storageService.get<boolean>(ConstantsService.disableAutoBiometricsPromptKey)) ??
|
||||
true;
|
||||
(await this.stateService.getDisableAutoBiometricsPrompt()) ?? true;
|
||||
|
||||
window.setTimeout(async () => {
|
||||
document.getElementById(this.pinLock ? "pin" : "masterPassword").focus();
|
||||
|
||||
@@ -9,7 +9,6 @@ import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
|
||||
import { LoginComponent as BaseLoginComponent } from "jslib-angular/components/login.component";
|
||||
@@ -19,6 +18,8 @@ import { LoginComponent as BaseLoginComponent } from "jslib-angular/components/l
|
||||
templateUrl: "login.component.html",
|
||||
})
|
||||
export class LoginComponent extends BaseLoginComponent {
|
||||
protected alwaysRememberEmail: boolean = true;
|
||||
|
||||
constructor(
|
||||
authService: AuthService,
|
||||
router: Router,
|
||||
@@ -28,7 +29,6 @@ export class LoginComponent extends BaseLoginComponent {
|
||||
protected environmentService: EnvironmentService,
|
||||
protected passwordGenerationService: PasswordGenerationService,
|
||||
protected cryptoFunctionService: CryptoFunctionService,
|
||||
storageService: StorageService,
|
||||
syncService: SyncService,
|
||||
logService: LogService,
|
||||
ngZone: NgZone
|
||||
@@ -42,7 +42,6 @@ export class LoginComponent extends BaseLoginComponent {
|
||||
environmentService,
|
||||
passwordGenerationService,
|
||||
cryptoFunctionService,
|
||||
storageService,
|
||||
logService,
|
||||
ngZone
|
||||
);
|
||||
|
||||
@@ -9,8 +9,8 @@ import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { SetPasswordComponent as BaseSetPasswordComponent } from "jslib-angular/components/set-password.component";
|
||||
|
||||
@@ -24,7 +24,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
||||
i18nService: I18nService,
|
||||
cryptoService: CryptoService,
|
||||
messagingService: MessagingService,
|
||||
userService: UserService,
|
||||
stateService: StateService,
|
||||
passwordGenerationService: PasswordGenerationService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
policyService: PolicyService,
|
||||
@@ -36,14 +36,14 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
||||
i18nService,
|
||||
cryptoService,
|
||||
messagingService,
|
||||
userService,
|
||||
passwordGenerationService,
|
||||
platformUtilsService,
|
||||
policyService,
|
||||
router,
|
||||
apiService,
|
||||
syncService,
|
||||
route
|
||||
route,
|
||||
stateService
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
@@ -28,7 +27,6 @@ export class SsoComponent extends BaseSsoComponent {
|
||||
router: Router,
|
||||
i18nService: I18nService,
|
||||
route: ActivatedRoute,
|
||||
storageService: StorageService,
|
||||
stateService: StateService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
apiService: ApiService,
|
||||
@@ -44,7 +42,6 @@ export class SsoComponent extends BaseSsoComponent {
|
||||
router,
|
||||
i18nService,
|
||||
route,
|
||||
storageService,
|
||||
stateService,
|
||||
platformUtilsService,
|
||||
apiService,
|
||||
|
||||
@@ -13,7 +13,6 @@ import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
|
||||
import { TwoFactorComponent as BaseTwoFactorComponent } from "jslib-angular/components/two-factor.component";
|
||||
@@ -42,7 +41,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
||||
private broadcasterService: BroadcasterService,
|
||||
private popupUtilsService: PopupUtilsService,
|
||||
stateService: StateService,
|
||||
storageService: StorageService,
|
||||
route: ActivatedRoute,
|
||||
private messagingService: MessagingService,
|
||||
logService: LogService
|
||||
@@ -56,7 +54,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
||||
window,
|
||||
environmentService,
|
||||
stateService,
|
||||
storageService,
|
||||
route,
|
||||
logService
|
||||
);
|
||||
|
||||
@@ -8,8 +8,8 @@ import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from "jslib-angular/components/update-temp-password.component";
|
||||
|
||||
@@ -60,7 +60,7 @@ export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent
|
||||
passwordGenerationService: PasswordGenerationService,
|
||||
policyService: PolicyService,
|
||||
cryptoService: CryptoService,
|
||||
userService: UserService,
|
||||
stateService: StateService,
|
||||
messagingService: MessagingService,
|
||||
apiService: ApiService,
|
||||
syncService: SyncService,
|
||||
@@ -72,9 +72,9 @@ export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent
|
||||
passwordGenerationService,
|
||||
policyService,
|
||||
cryptoService,
|
||||
userService,
|
||||
messagingService,
|
||||
apiService,
|
||||
stateService,
|
||||
syncService,
|
||||
logService
|
||||
);
|
||||
|
||||
@@ -11,10 +11,8 @@ import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { KeyConnectorService } from "jslib-common/abstractions/keyConnector.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
import { StateService } from "../services/abstractions/state.service";
|
||||
|
||||
import { routerTransition } from "./app-routing.animations";
|
||||
|
||||
@@ -31,7 +29,6 @@ export class AppComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private toastrService: ToastrService,
|
||||
private storageService: StorageService,
|
||||
private broadcasterService: BroadcasterService,
|
||||
private authService: AuthService,
|
||||
private i18nService: I18nService,
|
||||
@@ -49,14 +46,19 @@ export class AppComponent implements OnInit {
|
||||
if (BrowserApi.getBackgroundPage() == null) {
|
||||
return;
|
||||
}
|
||||
let activeUserId: string = null;
|
||||
this.stateService.activeAccount.subscribe((userId) => {
|
||||
activeUserId = userId;
|
||||
});
|
||||
|
||||
this.ngZone.runOutsideAngular(() => {
|
||||
window.onmousemove = () => this.recordActivity();
|
||||
window.onmousedown = () => this.recordActivity();
|
||||
window.ontouchstart = () => this.recordActivity();
|
||||
window.onclick = () => this.recordActivity();
|
||||
window.onscroll = () => this.recordActivity();
|
||||
window.onkeypress = () => this.recordActivity();
|
||||
if (activeUserId != null) {
|
||||
window.onmousedown = () => this.recordActivity(activeUserId);
|
||||
window.ontouchstart = () => this.recordActivity(activeUserId);
|
||||
window.onclick = () => this.recordActivity(activeUserId);
|
||||
window.onscroll = () => this.recordActivity(activeUserId);
|
||||
window.onkeypress = () => this.recordActivity(activeUserId);
|
||||
}
|
||||
});
|
||||
|
||||
(window as any).bitwardenPopupMainMessageListener = async (
|
||||
@@ -66,7 +68,7 @@ export class AppComponent implements OnInit {
|
||||
) => {
|
||||
if (msg.command === "doneLoggingOut") {
|
||||
this.ngZone.run(async () => {
|
||||
this.authService.logOut(() => {
|
||||
this.authService.logOut(async () => {
|
||||
if (msg.expired) {
|
||||
this.showToast({
|
||||
type: "warning",
|
||||
@@ -74,8 +76,12 @@ export class AppComponent implements OnInit {
|
||||
text: this.i18nService.t("loginExpired"),
|
||||
});
|
||||
}
|
||||
this.router.navigate(["home"]);
|
||||
this.stateService.purge();
|
||||
|
||||
await this.stateService.clean({ userId: msg.userId });
|
||||
|
||||
if (this.stateService.activeAccount.getValue() == null) {
|
||||
this.router.navigate(["home"]);
|
||||
}
|
||||
});
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
@@ -84,10 +90,11 @@ export class AppComponent implements OnInit {
|
||||
this.router.navigate(["home"]);
|
||||
});
|
||||
} else if (msg.command === "locked") {
|
||||
this.stateService.purge();
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(["lock"]);
|
||||
});
|
||||
if (msg.userId == null || msg.userId === (await this.stateService.getUserId())) {
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(["lock"]);
|
||||
});
|
||||
}
|
||||
} else if (msg.command === "showDialog") {
|
||||
await this.showDialog(msg);
|
||||
} else if (msg.command === "showToast") {
|
||||
@@ -120,7 +127,7 @@ export class AppComponent implements OnInit {
|
||||
|
||||
BrowserApi.messageListener("app.component", (window as any).bitwardenPopupMainMessageListener);
|
||||
|
||||
this.router.events.subscribe((event) => {
|
||||
this.router.events.subscribe(async (event) => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
const url = event.urlAfterRedirects || event.url || "";
|
||||
if (
|
||||
@@ -128,15 +135,13 @@ export class AppComponent implements OnInit {
|
||||
(window as any).previousPopupUrl != null &&
|
||||
(window as any).previousPopupUrl.startsWith("/tabs/")
|
||||
) {
|
||||
this.stateService.remove("GroupingsComponent");
|
||||
this.stateService.remove("GroupingsComponentScope");
|
||||
this.stateService.remove("CiphersComponent");
|
||||
this.stateService.remove("SendGroupingsComponent");
|
||||
this.stateService.remove("SendGroupingsComponentScope");
|
||||
this.stateService.remove("SendTypeComponent");
|
||||
await this.stateService.setBrowserGroupingComponentState(null);
|
||||
await this.stateService.setBrowserCipherComponentState(null);
|
||||
await this.stateService.setBrowserSendComponentState(null);
|
||||
await this.stateService.setBrowserSendTypeComponentState(null);
|
||||
}
|
||||
if (url.startsWith("/tabs/")) {
|
||||
this.stateService.remove("addEditCipherInfo");
|
||||
await this.stateService.setAddEditCipherInfo(null);
|
||||
}
|
||||
(window as any).previousPopupUrl = url;
|
||||
|
||||
@@ -167,14 +172,14 @@ export class AppComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
private async recordActivity() {
|
||||
private async recordActivity(userId: string) {
|
||||
const now = new Date().getTime();
|
||||
if (this.lastActivity != null && now - this.lastActivity < 250) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.lastActivity = now;
|
||||
this.storageService.save(ConstantsService.lastActiveKey, now);
|
||||
this.stateService.setLastActive(now, { userId: userId });
|
||||
}
|
||||
|
||||
private showToast(msg: any) {
|
||||
|
||||
@@ -10,8 +10,8 @@ import { EventService } from "jslib-common/abstractions/event.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { PasswordRepromptService } from "jslib-common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { TotpService } from "jslib-common/abstractions/totp.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-action-buttons",
|
||||
@@ -31,12 +31,12 @@ export class ActionButtonsComponent {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private eventService: EventService,
|
||||
private totpService: TotpService,
|
||||
private userService: UserService,
|
||||
private stateService: StateService,
|
||||
private passwordRepromptService: PasswordRepromptService
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.userHasPremiumAccess = await this.userService.canAccessPremium();
|
||||
this.userHasPremiumAccess = await this.stateService.getCanAccessPremium();
|
||||
}
|
||||
|
||||
launchCipher() {
|
||||
|
||||
@@ -29,7 +29,7 @@ export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
|
||||
|
||||
async ngOnInit() {
|
||||
await super.ngOnInit();
|
||||
const addEditCipherInfo = await this.stateService.get<any>("addEditCipherInfo");
|
||||
const addEditCipherInfo = await this.stateService.getAddEditCipherInfo();
|
||||
if (addEditCipherInfo != null) {
|
||||
this.cipherState = addEditCipherInfo.cipher;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { SendService } from "jslib-common/abstractions/send.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { StateService } from "../../services/abstractions/state.service";
|
||||
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
@@ -36,7 +37,7 @@ export class SendAddEditComponent extends BaseAddEditComponent {
|
||||
constructor(
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
userService: UserService,
|
||||
stateService: StateService,
|
||||
messagingService: MessagingService,
|
||||
policyService: PolicyService,
|
||||
environmentService: EnvironmentService,
|
||||
@@ -54,10 +55,10 @@ export class SendAddEditComponent extends BaseAddEditComponent {
|
||||
environmentService,
|
||||
datePipe,
|
||||
sendService,
|
||||
userService,
|
||||
messagingService,
|
||||
policyService,
|
||||
logService
|
||||
logService,
|
||||
stateService
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { SearchService } from "jslib-common/abstractions/search.service";
|
||||
import { SendService } from "jslib-common/abstractions/send.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { StateService } from "../../services/abstractions/state.service";
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
import { SendType } from "jslib-common/enums/sendType";
|
||||
|
||||
import { BrowserSendComponentState } from "src/models/browserSendComponentState";
|
||||
|
||||
const ComponentId = "SendComponent";
|
||||
const ScopeStateId = ComponentId + "Scope";
|
||||
|
||||
@Component({
|
||||
selector: "app-send-groupings",
|
||||
@@ -35,8 +35,7 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||
// Send Type Calculations
|
||||
typeCounts = new Map<SendType, number>();
|
||||
// State Handling
|
||||
state: any;
|
||||
scopeState: any;
|
||||
state: BrowserSendComponentState;
|
||||
private loadedTimeout: number;
|
||||
|
||||
constructor(
|
||||
@@ -46,7 +45,6 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||
environmentService: EnvironmentService,
|
||||
ngZone: NgZone,
|
||||
policyService: PolicyService,
|
||||
userService: UserService,
|
||||
searchService: SearchService,
|
||||
private popupUtils: PopupUtilsService,
|
||||
private stateService: StateService,
|
||||
@@ -64,7 +62,6 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||
ngZone,
|
||||
searchService,
|
||||
policyService,
|
||||
userService,
|
||||
logService
|
||||
);
|
||||
super.onSuccessfulLoad = async () => {
|
||||
@@ -79,13 +76,12 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||
this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox()
|
||||
);
|
||||
// Clear state of Send Type Component
|
||||
this.stateService.remove("SendTypeComponent");
|
||||
await this.stateService.setBrowserSendTypeComponentState(null);
|
||||
// Let super class finish
|
||||
await super.ngOnInit();
|
||||
// Handle State Restore if necessary
|
||||
const restoredScopeState = await this.restoreState();
|
||||
this.state = (await this.stateService.get<any>(ComponentId)) || {};
|
||||
if (this.state.searchText != null) {
|
||||
if (this.state?.searchText != null) {
|
||||
this.searchText = this.state.searchText;
|
||||
}
|
||||
|
||||
@@ -100,7 +96,7 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||
}
|
||||
|
||||
if (!this.syncService.syncInProgress || restoredScopeState) {
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state?.scrollY), 0);
|
||||
}
|
||||
|
||||
// Load all sends if sync completed in background
|
||||
@@ -177,27 +173,23 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||
this.state = {
|
||||
scrollY: this.popupUtils.getContentScrollY(window),
|
||||
searchText: this.searchText,
|
||||
};
|
||||
await this.stateService.save(ComponentId, this.state);
|
||||
|
||||
this.scopeState = {
|
||||
sends: this.sends,
|
||||
typeCounts: this.typeCounts,
|
||||
};
|
||||
await this.stateService.save(ScopeStateId, this.scopeState);
|
||||
await this.stateService.setBrowserSendComponentState(this.state);
|
||||
}
|
||||
|
||||
private async restoreState(): Promise<boolean> {
|
||||
this.scopeState = await this.stateService.get<any>(ScopeStateId);
|
||||
if (this.scopeState == null) {
|
||||
this.state = await this.stateService.getBrowserSendComponentState();
|
||||
if (this.state == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.scopeState.sends != null) {
|
||||
this.sends = this.scopeState.sends;
|
||||
if (this.state.sends != null) {
|
||||
this.sends = this.state.sends;
|
||||
}
|
||||
if (this.scopeState.typeCounts != null) {
|
||||
this.typeCounts = this.scopeState.typeCounts;
|
||||
if (this.state.typeCounts != null) {
|
||||
this.typeCounts = this.state.typeCounts;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -18,13 +18,14 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { SearchService } from "jslib-common/abstractions/search.service";
|
||||
import { SendService } from "jslib-common/abstractions/send.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { StateService } from "../../services/abstractions/state.service";
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
import { SendType } from "jslib-common/enums/sendType";
|
||||
|
||||
import { BrowserComponentState } from "../../models/browserComponentState";
|
||||
|
||||
const ComponentId = "SendTypeComponent";
|
||||
|
||||
@Component({
|
||||
@@ -34,7 +35,7 @@ const ComponentId = "SendTypeComponent";
|
||||
export class SendTypeComponent extends BaseSendComponent {
|
||||
groupingTitle: string;
|
||||
// State Handling
|
||||
state: any;
|
||||
state: BrowserComponentState;
|
||||
private refreshTimeout: number;
|
||||
private applySavedState = true;
|
||||
|
||||
@@ -45,7 +46,6 @@ export class SendTypeComponent extends BaseSendComponent {
|
||||
environmentService: EnvironmentService,
|
||||
ngZone: NgZone,
|
||||
policyService: PolicyService,
|
||||
userService: UserService,
|
||||
searchService: SearchService,
|
||||
private popupUtils: PopupUtilsService,
|
||||
private stateService: StateService,
|
||||
@@ -64,7 +64,6 @@ export class SendTypeComponent extends BaseSendComponent {
|
||||
ngZone,
|
||||
searchService,
|
||||
policyService,
|
||||
userService,
|
||||
logService
|
||||
);
|
||||
super.onSuccessfulLoad = async () => {
|
||||
@@ -80,8 +79,8 @@ export class SendTypeComponent extends BaseSendComponent {
|
||||
await super.ngOnInit();
|
||||
this.route.queryParams.pipe(first()).subscribe(async (params) => {
|
||||
if (this.applySavedState) {
|
||||
this.state = (await this.stateService.get<any>(ComponentId)) || {};
|
||||
if (this.state.searchText != null) {
|
||||
this.state = await this.stateService.getBrowserSendTypeComponentState();
|
||||
if (this.state?.searchText != null) {
|
||||
this.searchText = this.state.searchText;
|
||||
}
|
||||
}
|
||||
@@ -103,9 +102,9 @@ export class SendTypeComponent extends BaseSendComponent {
|
||||
|
||||
// Restore state and remove reference
|
||||
if (this.applySavedState && this.state != null) {
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state?.scrollY), 0);
|
||||
}
|
||||
this.stateService.remove(ComponentId);
|
||||
this.stateService.setBrowserSendTypeComponentState(null);
|
||||
});
|
||||
|
||||
// Refresh Send list if sync completed in background
|
||||
@@ -167,6 +166,6 @@ export class SendTypeComponent extends BaseSendComponent {
|
||||
scrollY: this.popupUtils.getContentScrollY(window),
|
||||
searchText: this.searchText,
|
||||
};
|
||||
await this.stateService.save(ComponentId, this.state);
|
||||
await this.stateService.setBrowserSendTypeComponentState(this.state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,19 +30,20 @@ import { KeyConnectorService } from "jslib-common/abstractions/keyConnector.serv
|
||||
import { LogService as LogServiceAbstraction } from "jslib-common/abstractions/log.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { NotificationsService } from "jslib-common/abstractions/notifications.service";
|
||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "jslib-common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { ProviderService } from "jslib-common/abstractions/provider.service";
|
||||
import { SearchService as SearchServiceAbstraction } from "jslib-common/abstractions/search.service";
|
||||
import { SendService } from "jslib-common/abstractions/send.service";
|
||||
import { SettingsService } from "jslib-common/abstractions/settings.service";
|
||||
import { StateService as StateServiceAbstraction } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { StateService as BaseStateServiceAbstraction } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService as StorageServiceAbstraction } from "jslib-common/abstractions/storage.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { TokenService } from "jslib-common/abstractions/token.service";
|
||||
import { TotpService } from "jslib-common/abstractions/totp.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
import { UserVerificationService } from "jslib-common/abstractions/userVerification.service";
|
||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
@@ -51,15 +52,15 @@ import BrowserMessagingService from "../../services/browserMessaging.service";
|
||||
|
||||
import { AuthService } from "jslib-common/services/auth.service";
|
||||
import { ConsoleLogService } from "jslib-common/services/consoleLog.service";
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
import { SearchService } from "jslib-common/services/search.service";
|
||||
import { StateService } from "jslib-common/services/state.service";
|
||||
|
||||
import { PopupSearchService } from "./popup-search.service";
|
||||
import { PopupUtilsService } from "./popup-utils.service";
|
||||
|
||||
import { ThemeType } from "jslib-common/enums/themeType";
|
||||
|
||||
import { StateService as StateServiceAbstraction } from "../../services/abstractions/state.service";
|
||||
|
||||
function getBgService<T>(service: string) {
|
||||
return (): T => {
|
||||
const page = BrowserApi.getBackgroundPage();
|
||||
@@ -72,12 +73,13 @@ const isPrivateMode = BrowserApi.getBackgroundPage() == null;
|
||||
export function initFactory(
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
i18nService: I18nService,
|
||||
storageService: StorageService,
|
||||
popupUtilsService: PopupUtilsService,
|
||||
stateService: StateServiceAbstraction,
|
||||
logService: LogServiceAbstraction
|
||||
): Function {
|
||||
return async () => {
|
||||
await stateService.init();
|
||||
|
||||
if (!popupUtilsService.inPopup(window)) {
|
||||
window.document.body.classList.add("body-full");
|
||||
} else if (window.screen.availHeight < 600) {
|
||||
@@ -87,21 +89,11 @@ export function initFactory(
|
||||
}
|
||||
|
||||
if (!isPrivateMode) {
|
||||
await stateService.save(
|
||||
ConstantsService.disableFaviconKey,
|
||||
await storageService.get<boolean>(ConstantsService.disableFaviconKey)
|
||||
);
|
||||
|
||||
await stateService.save(
|
||||
ConstantsService.disableBadgeCounterKey,
|
||||
await storageService.get<boolean>(ConstantsService.disableBadgeCounterKey)
|
||||
);
|
||||
|
||||
const htmlEl = window.document.documentElement;
|
||||
const theme = await platformUtilsService.getEffectiveTheme();
|
||||
htmlEl.classList.add("theme_" + theme);
|
||||
platformUtilsService.onDefaultSystemThemeChange(async (sysTheme) => {
|
||||
const bwTheme = await storageService.get<ThemeType>(ConstantsService.themeKey);
|
||||
const bwTheme = await stateService.getTheme();
|
||||
if (bwTheme == null || bwTheme === ThemeType.System) {
|
||||
htmlEl.classList.remove("theme_" + ThemeType.Light, "theme_" + ThemeType.Dark);
|
||||
htmlEl.classList.add("theme_" + sysTheme);
|
||||
@@ -143,7 +135,6 @@ export function initFactory(
|
||||
deps: [
|
||||
PlatformUtilsService,
|
||||
I18nService,
|
||||
StorageService,
|
||||
PopupUtilsService,
|
||||
StateServiceAbstraction,
|
||||
LogServiceAbstraction,
|
||||
@@ -161,7 +152,6 @@ export function initFactory(
|
||||
useFactory: getBgService<AuthService>("authService"),
|
||||
deps: [],
|
||||
},
|
||||
{ provide: StateServiceAbstraction, useClass: StateService },
|
||||
{
|
||||
provide: SearchServiceAbstraction,
|
||||
useFactory: (
|
||||
@@ -226,15 +216,14 @@ export function initFactory(
|
||||
},
|
||||
{ provide: ApiService, useFactory: getBgService<ApiService>("apiService"), deps: [] },
|
||||
{ provide: SyncService, useFactory: getBgService<SyncService>("syncService"), deps: [] },
|
||||
{ provide: UserService, useFactory: getBgService<UserService>("userService"), deps: [] },
|
||||
{
|
||||
provide: SettingsService,
|
||||
useFactory: getBgService<SettingsService>("settingsService"),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: StorageService,
|
||||
useFactory: getBgService<StorageService>("storageService"),
|
||||
provide: StorageServiceAbstraction,
|
||||
useFactory: getBgService<StorageServiceAbstraction>("storageService"),
|
||||
deps: [],
|
||||
},
|
||||
{ provide: AppIdService, useFactory: getBgService<AppIdService>("appIdService"), deps: [] },
|
||||
@@ -271,6 +260,31 @@ export function initFactory(
|
||||
deps: [],
|
||||
},
|
||||
{ provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService },
|
||||
{
|
||||
provide: OrganizationService,
|
||||
useFactory: getBgService<OrganizationService>("organizationService"),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: ProviderService,
|
||||
useFactory: getBgService<ProviderService>("providerService"),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: "SECURE_STORAGE",
|
||||
useFactory: getBgService<StorageServiceAbstraction>("secureStorageService"),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: StateServiceAbstraction,
|
||||
useFactory: getBgService<StateServiceAbstraction>("stateService"),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: BaseStateServiceAbstraction,
|
||||
useExisting: StateServiceAbstraction,
|
||||
deps: [],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class ServicesModule {}
|
||||
|
||||
@@ -2,12 +2,10 @@ import { Component, NgZone, OnDestroy, OnInit } from "@angular/core";
|
||||
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
import { BroadcasterService } from "jslib-common/abstractions/broadcaster.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
|
||||
import { BrowserApi } from "../../browser/browserApi";
|
||||
|
||||
@@ -30,7 +28,7 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
|
||||
loadCurrentUrisTimeout: number;
|
||||
|
||||
constructor(
|
||||
private storageService: StorageService,
|
||||
private stateService: StateService,
|
||||
private i18nService: I18nService,
|
||||
private router: Router,
|
||||
private broadcasterService: BroadcasterService,
|
||||
@@ -39,7 +37,7 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
const savedDomains = await this.storageService.get<any>(ConstantsService.neverDomainsKey);
|
||||
const savedDomains = await this.stateService.getNeverDomains();
|
||||
if (savedDomains) {
|
||||
for (const uri of Object.keys(savedDomains)) {
|
||||
this.excludedDomains.push({ uri: uri, showCurrentUris: false });
|
||||
@@ -96,7 +94,7 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
|
||||
savedDomains[validDomain] = null;
|
||||
}
|
||||
}
|
||||
await this.storageService.save(ConstantsService.neverDomainsKey, savedDomains);
|
||||
await this.stateService.setNeverDomains(savedDomains);
|
||||
this.router.navigate(["/tabs/settings"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,8 @@ import { UriMatchType } from "jslib-common/enums/uriMatchType";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { TotpService } from "jslib-common/abstractions/totp.service";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-options",
|
||||
templateUrl: "options.component.html",
|
||||
@@ -40,7 +37,6 @@ export class OptionsComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private messagingService: MessagingService,
|
||||
private storageService: StorageService,
|
||||
private stateService: StateService,
|
||||
private totpService: TotpService,
|
||||
i18nService: I18nService
|
||||
@@ -76,136 +72,89 @@ export class OptionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
|
||||
ConstantsService.enableAutoFillOnPageLoadKey
|
||||
);
|
||||
this.enableAutoFillOnPageLoad = await this.stateService.getEnableAutoFillOnPageLoad();
|
||||
|
||||
this.autoFillOnPageLoadDefault =
|
||||
(await this.storageService.get<boolean>(ConstantsService.autoFillOnPageLoadDefaultKey)) ??
|
||||
true;
|
||||
(await this.stateService.getAutoFillOnPageLoadDefault()) ?? true;
|
||||
|
||||
this.disableAddLoginNotification = await this.storageService.get<boolean>(
|
||||
ConstantsService.disableAddLoginNotificationKey
|
||||
);
|
||||
this.disableAddLoginNotification = await this.stateService.getDisableAddLoginNotification();
|
||||
|
||||
this.disableChangedPasswordNotification = await this.storageService.get<boolean>(
|
||||
ConstantsService.disableChangedPasswordNotificationKey
|
||||
);
|
||||
this.disableChangedPasswordNotification =
|
||||
await this.stateService.getDisableChangedPasswordNotification();
|
||||
|
||||
this.disableContextMenuItem = await this.storageService.get<boolean>(
|
||||
ConstantsService.disableContextMenuItemKey
|
||||
);
|
||||
this.disableContextMenuItem = await this.stateService.getDisableContextMenuItem();
|
||||
|
||||
this.dontShowCards = await this.storageService.get<boolean>(
|
||||
ConstantsService.dontShowCardsCurrentTab
|
||||
);
|
||||
this.dontShowIdentities = await this.storageService.get<boolean>(
|
||||
ConstantsService.dontShowIdentitiesCurrentTab
|
||||
);
|
||||
this.dontShowCards = await this.stateService.getDontShowCardsCurrentTab();
|
||||
this.dontShowIdentities = await this.stateService.getDontShowIdentitiesCurrentTab();
|
||||
|
||||
this.disableAutoTotpCopy = !(await this.totpService.isAutoCopyEnabled());
|
||||
|
||||
this.disableFavicon = await this.storageService.get<boolean>(
|
||||
ConstantsService.disableFaviconKey
|
||||
);
|
||||
this.disableFavicon = await this.stateService.getDisableFavicon();
|
||||
|
||||
this.disableBadgeCounter = await this.storageService.get<boolean>(
|
||||
ConstantsService.disableBadgeCounterKey
|
||||
);
|
||||
this.disableBadgeCounter = await this.stateService.getDisableBadgeCounter();
|
||||
|
||||
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
|
||||
this.theme = await this.stateService.getTheme();
|
||||
|
||||
const defaultUriMatch = await this.storageService.get<UriMatchType>(
|
||||
ConstantsService.defaultUriMatch
|
||||
);
|
||||
const defaultUriMatch = await this.stateService.getDefaultUriMatch();
|
||||
this.defaultUriMatch = defaultUriMatch == null ? UriMatchType.Domain : defaultUriMatch;
|
||||
|
||||
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
|
||||
this.clearClipboard = await this.stateService.getClearClipboard();
|
||||
}
|
||||
|
||||
async updateAddLoginNotification() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.disableAddLoginNotificationKey,
|
||||
this.disableAddLoginNotification
|
||||
);
|
||||
await this.stateService.setDisableAddLoginNotification(this.disableAddLoginNotification);
|
||||
}
|
||||
|
||||
async updateChangedPasswordNotification() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.disableChangedPasswordNotificationKey,
|
||||
await this.stateService.setDisableChangedPasswordNotification(
|
||||
this.disableChangedPasswordNotification
|
||||
);
|
||||
}
|
||||
|
||||
async updateDisableContextMenuItem() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.disableContextMenuItemKey,
|
||||
this.disableContextMenuItem
|
||||
);
|
||||
await this.stateService.setDisableContextMenuItem(this.disableContextMenuItem);
|
||||
this.messagingService.send("bgUpdateContextMenu");
|
||||
}
|
||||
|
||||
async updateAutoTotpCopy() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.disableAutoTotpCopyKey,
|
||||
this.disableAutoTotpCopy
|
||||
);
|
||||
await this.stateService.setDisableAutoTotpCopy(this.disableAutoTotpCopy);
|
||||
}
|
||||
|
||||
async updateAutoFillOnPageLoad() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.enableAutoFillOnPageLoadKey,
|
||||
this.enableAutoFillOnPageLoad
|
||||
);
|
||||
await this.stateService.setEnableAutoFillOnPageLoad(this.enableAutoFillOnPageLoad);
|
||||
}
|
||||
|
||||
async updateAutoFillOnPageLoadDefault() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.autoFillOnPageLoadDefaultKey,
|
||||
this.autoFillOnPageLoadDefault
|
||||
);
|
||||
await this.stateService.setAutoFillOnPageLoadDefault(this.autoFillOnPageLoadDefault);
|
||||
}
|
||||
|
||||
async updateDisableFavicon() {
|
||||
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon);
|
||||
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon);
|
||||
await this.stateService.setDisableFavicon(this.disableFavicon);
|
||||
}
|
||||
|
||||
async updateDisableBadgeCounter() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.disableBadgeCounterKey,
|
||||
this.disableBadgeCounter
|
||||
);
|
||||
await this.stateService.save(ConstantsService.disableBadgeCounterKey, this.disableBadgeCounter);
|
||||
await this.stateService.setDisableBadgeCounter(this.disableBadgeCounter);
|
||||
this.messagingService.send("bgUpdateContextMenu");
|
||||
}
|
||||
|
||||
async updateShowCards() {
|
||||
await this.storageService.save(ConstantsService.dontShowCardsCurrentTab, this.dontShowCards);
|
||||
await this.stateService.save(ConstantsService.dontShowCardsCurrentTab, this.dontShowCards);
|
||||
await this.stateService.setDontShowCardsCurrentTab(this.dontShowCards);
|
||||
}
|
||||
|
||||
async updateShowIdentities() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.dontShowIdentitiesCurrentTab,
|
||||
this.dontShowIdentities
|
||||
);
|
||||
await this.stateService.save(
|
||||
ConstantsService.dontShowIdentitiesCurrentTab,
|
||||
this.dontShowIdentities
|
||||
);
|
||||
await this.stateService.setDontShowIdentitiesCurrentTab(this.dontShowIdentities);
|
||||
}
|
||||
|
||||
async saveTheme() {
|
||||
await this.storageService.save(ConstantsService.themeKey, this.theme);
|
||||
await this.stateService.setTheme(this.theme);
|
||||
window.setTimeout(() => window.location.reload(), 200);
|
||||
}
|
||||
|
||||
async saveDefaultUriMatch() {
|
||||
await this.storageService.save(ConstantsService.defaultUriMatch, this.defaultUriMatch);
|
||||
await this.stateService.setDefaultUriMatch(this.defaultUriMatch);
|
||||
}
|
||||
|
||||
async saveClearClipboard() {
|
||||
await this.storageService.save(ConstantsService.clearClipboardKey, this.clearClipboard);
|
||||
await this.stateService.setClearClipboard(this.clearClipboard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ApiService } from "jslib-common/abstractions/api.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
|
||||
import { PremiumComponent as BasePremiumComponent } from "jslib-angular/components/premium.component";
|
||||
|
||||
@@ -20,11 +20,11 @@ export class PremiumComponent extends BasePremiumComponent {
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
apiService: ApiService,
|
||||
userService: UserService,
|
||||
private currencyPipe: CurrencyPipe,
|
||||
logService: LogService
|
||||
stateService: StateService,
|
||||
logService: LogService,
|
||||
private currencyPipe: CurrencyPipe
|
||||
) {
|
||||
super(i18nService, platformUtilsService, apiService, userService, logService);
|
||||
super(i18nService, platformUtilsService, apiService, logService, stateService);
|
||||
|
||||
// Support old price string. Can be removed in future once all translations are properly updated.
|
||||
const thePrice = this.currencyPipe.transform(this.price, "$");
|
||||
|
||||
@@ -7,16 +7,13 @@ import { BrowserApi } from "../../browser/browserApi";
|
||||
|
||||
import { DeviceType } from "jslib-common/enums/deviceType";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { KeyConnectorService } from "jslib-common/abstractions/keyConnector.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
@@ -61,12 +58,11 @@ export class SettingsComponent implements OnInit {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private vaultTimeoutService: VaultTimeoutService,
|
||||
private storageService: StorageService,
|
||||
public messagingService: MessagingService,
|
||||
private router: Router,
|
||||
private environmentService: EnvironmentService,
|
||||
private cryptoService: CryptoService,
|
||||
private userService: UserService,
|
||||
private stateService: StateService,
|
||||
private popupUtilsService: PopupUtilsService,
|
||||
private modalService: ModalService,
|
||||
private keyConnectorService: KeyConnectorService
|
||||
@@ -112,7 +108,7 @@ export class SettingsComponent implements OnInit {
|
||||
this.saveVaultTimeout(value);
|
||||
});
|
||||
|
||||
const action = await this.storageService.get<string>(ConstantsService.vaultTimeoutActionKey);
|
||||
const action = await this.stateService.getVaultTimeoutAction();
|
||||
this.vaultTimeoutAction = action == null ? "lock" : action;
|
||||
|
||||
const pinSet = await this.vaultTimeoutService.isPinLockSet();
|
||||
@@ -121,8 +117,7 @@ export class SettingsComponent implements OnInit {
|
||||
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
||||
this.disableAutoBiometricsPrompt =
|
||||
(await this.storageService.get<boolean>(ConstantsService.disableAutoBiometricsPromptKey)) ??
|
||||
true;
|
||||
(await this.stateService.getDisableAutoBiometricsPrompt()) ?? true;
|
||||
this.showChangeMasterPass = !(await this.keyConnectorService.getUsesKeyConnector());
|
||||
}
|
||||
|
||||
@@ -250,14 +245,14 @@ export class SettingsComponent implements OnInit {
|
||||
allowOutsideClick: false,
|
||||
});
|
||||
|
||||
await this.storageService.save(ConstantsService.biometricAwaitingAcceptance, true);
|
||||
await this.stateService.setBiometricAwaitingAcceptance(true);
|
||||
await this.cryptoService.toggleKey();
|
||||
|
||||
await Promise.race([
|
||||
submitted.then((result) => {
|
||||
submitted.then(async (result) => {
|
||||
if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
this.biometric = false;
|
||||
this.storageService.remove(ConstantsService.biometricAwaitingAcceptance);
|
||||
await this.stateService.setBiometricAwaitingAcceptance(null);
|
||||
}
|
||||
}),
|
||||
this.platformUtilsService
|
||||
@@ -280,16 +275,13 @@ export class SettingsComponent implements OnInit {
|
||||
}),
|
||||
]);
|
||||
} else {
|
||||
await this.storageService.remove(ConstantsService.biometricUnlockKey);
|
||||
this.vaultTimeoutService.biometricLocked = false;
|
||||
await this.stateService.setBiometricUnlock(null);
|
||||
await this.stateService.setBiometricLocked(false);
|
||||
}
|
||||
}
|
||||
|
||||
async updateAutoBiometricsPrompt() {
|
||||
await this.storageService.save(
|
||||
ConstantsService.disableAutoBiometricsPromptKey,
|
||||
this.disableAutoBiometricsPrompt
|
||||
);
|
||||
await this.stateService.setDisableAutoBiometricsPrompt(this.disableAutoBiometricsPrompt);
|
||||
}
|
||||
|
||||
async lock() {
|
||||
@@ -385,7 +377,9 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async fingerprint() {
|
||||
const fingerprint = await this.cryptoService.getFingerprint(await this.userService.getUserId());
|
||||
const fingerprint = await this.cryptoService.getFingerprint(
|
||||
await this.stateService.getUserId()
|
||||
);
|
||||
const p = document.createElement("p");
|
||||
p.innerText = this.i18nService.t("yourAccountsFingerprint") + ":";
|
||||
const p2 = document.createElement("p");
|
||||
|
||||
@@ -14,14 +14,11 @@ import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||
import { PasswordRepromptService } from "jslib-common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
@@ -48,7 +45,6 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
auditService: AuditService,
|
||||
stateService: StateService,
|
||||
userService: UserService,
|
||||
collectionService: CollectionService,
|
||||
messagingService: MessagingService,
|
||||
private route: ActivatedRoute,
|
||||
@@ -57,9 +53,9 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
eventService: EventService,
|
||||
policyService: PolicyService,
|
||||
private popupUtilsService: PopupUtilsService,
|
||||
private storageService: StorageService,
|
||||
logService: LogService,
|
||||
passwordRepromptService: PasswordRepromptService
|
||||
organizationService: OrganizationService,
|
||||
passwordRepromptService: PasswordRepromptService,
|
||||
logService: LogService
|
||||
) {
|
||||
super(
|
||||
cipherService,
|
||||
@@ -68,13 +64,13 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
platformUtilsService,
|
||||
auditService,
|
||||
stateService,
|
||||
userService,
|
||||
collectionService,
|
||||
messagingService,
|
||||
eventService,
|
||||
policyService,
|
||||
logService,
|
||||
passwordRepromptService,
|
||||
logService
|
||||
organizationService
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +145,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
await super.load();
|
||||
this.showAutoFillOnPageLoadOptions =
|
||||
this.cipher.type === CipherType.Login &&
|
||||
(await this.storageService.get<boolean>(ConstantsService.enableAutoFillOnPageLoadKey));
|
||||
(await this.stateService.getEnableAutoFillOnPageLoad());
|
||||
}
|
||||
|
||||
async submit(): Promise<boolean> {
|
||||
@@ -194,7 +190,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
async generatePassword(): Promise<boolean> {
|
||||
const confirmed = await super.generatePassword();
|
||||
if (confirmed) {
|
||||
this.stateService.save("addEditCipherInfo", {
|
||||
this.stateService.setAddEditCipherInfo({
|
||||
cipher: this.cipher,
|
||||
collectionIds:
|
||||
this.collections == null
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
|
||||
import { AttachmentsComponent as BaseAttachmentsComponent } from "jslib-angular/components/attachments.component";
|
||||
|
||||
@@ -25,22 +25,22 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
||||
cipherService: CipherService,
|
||||
i18nService: I18nService,
|
||||
cryptoService: CryptoService,
|
||||
userService: UserService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
apiService: ApiService,
|
||||
private location: Location,
|
||||
private route: ActivatedRoute,
|
||||
stateService: StateService,
|
||||
logService: LogService
|
||||
) {
|
||||
super(
|
||||
cipherService,
|
||||
i18nService,
|
||||
cryptoService,
|
||||
userService,
|
||||
platformUtilsService,
|
||||
apiService,
|
||||
window,
|
||||
logService
|
||||
logService,
|
||||
stateService
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,18 +13,19 @@ import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { SearchService } from "jslib-common/abstractions/search.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
|
||||
import { CipherType } from "jslib-common/enums/cipherType";
|
||||
|
||||
import { TreeNode } from "jslib-common/models/domain/treeNode";
|
||||
|
||||
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||
import { CollectionView } from "jslib-common/models/view/collectionView";
|
||||
import { FolderView } from "jslib-common/models/view/folderView";
|
||||
|
||||
import { TreeNode } from "jslib-common/models/domain/treeNode";
|
||||
|
||||
import { CiphersComponent as BaseCiphersComponent } from "jslib-angular/components/ciphers.component";
|
||||
|
||||
import { BrowserComponentState } from "src/models/browserComponentState";
|
||||
import { StateService } from "../../services/abstractions/state.service";
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
const ComponentId = "CiphersComponent";
|
||||
@@ -35,7 +36,7 @@ const ComponentId = "CiphersComponent";
|
||||
})
|
||||
export class CiphersComponent extends BaseCiphersComponent implements OnInit, OnDestroy {
|
||||
groupingTitle: string;
|
||||
state: any;
|
||||
state: BrowserComponentState;
|
||||
folderId: string = null;
|
||||
collectionId: string = null;
|
||||
type: CipherType = null;
|
||||
@@ -74,8 +75,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
||||
this.route.queryParams.pipe(first()).subscribe(async (params) => {
|
||||
if (this.applySavedState) {
|
||||
this.state = (await this.stateService.get<any>(ComponentId)) || {};
|
||||
if (this.state.searchText) {
|
||||
this.state = await this.stateService.getBrowserCipherComponentState();
|
||||
if (this.state?.searchText) {
|
||||
this.searchText = this.state.searchText;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +147,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
0
|
||||
);
|
||||
}
|
||||
this.stateService.remove(ComponentId);
|
||||
await this.stateService.setBrowserCipherComponentState(null);
|
||||
});
|
||||
|
||||
this.broadcasterService.subscribe(ComponentId, (message: any) => {
|
||||
@@ -241,6 +242,6 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
scrollY: this.popupUtils.getContentScrollY(window, this.scrollingContainer),
|
||||
searchText: this.searchText,
|
||||
};
|
||||
await this.stateService.save(ComponentId, this.state);
|
||||
await this.stateService.setBrowserCipherComponentState(this.state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,9 @@ import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { PasswordRepromptService } from "jslib-common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { SearchService } from "jslib-common/abstractions/search.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
|
||||
import { ConstantsService } from "jslib-common/services/constants.service";
|
||||
|
||||
import { AutofillService } from "../../services/abstractions/autofill.service";
|
||||
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
@@ -60,7 +58,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private syncService: SyncService,
|
||||
private searchService: SearchService,
|
||||
private storageService: StorageService,
|
||||
private stateService: StateService,
|
||||
private passwordRepromptService: PasswordRepromptService
|
||||
) {}
|
||||
|
||||
@@ -209,12 +207,8 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
const otherTypes: CipherType[] = [];
|
||||
const dontShowCards = await this.storageService.get<boolean>(
|
||||
ConstantsService.dontShowCardsCurrentTab
|
||||
);
|
||||
const dontShowIdentities = await this.storageService.get<boolean>(
|
||||
ConstantsService.dontShowIdentitiesCurrentTab
|
||||
);
|
||||
const dontShowCards = await this.stateService.getDontShowCardsCurrentTab();
|
||||
const dontShowIdentities = await this.stateService.getDontShowIdentitiesCurrentTab();
|
||||
if (!dontShowCards) {
|
||||
otherTypes.push(CipherType.Card);
|
||||
}
|
||||
|
||||
@@ -18,17 +18,17 @@ import { CollectionService } from "jslib-common/abstractions/collection.service"
|
||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { SearchService } from "jslib-common/abstractions/search.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { StorageService } from "jslib-common/abstractions/storage.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { GroupingsComponent as BaseGroupingsComponent } from "jslib-angular/components/groupings.component";
|
||||
|
||||
import { StateService } from "../../services/abstractions/state.service";
|
||||
|
||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||
|
||||
import { BrowserGroupingsComponentState } from "src/models/browserGroupingsComponentState";
|
||||
|
||||
const ComponentId = "GroupingsComponent";
|
||||
const ScopeStateId = ComponentId + "Scope";
|
||||
|
||||
@Component({
|
||||
selector: "app-vault-groupings",
|
||||
@@ -53,8 +53,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
collectionCounts = new Map<string, number>();
|
||||
typeCounts = new Map<CipherType, number>();
|
||||
searchText: string;
|
||||
state: any;
|
||||
scopeState: any;
|
||||
state: BrowserGroupingsComponentState;
|
||||
showLeftHeader = true;
|
||||
searchPending = false;
|
||||
searchTypeSearch = false;
|
||||
@@ -72,22 +71,20 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
constructor(
|
||||
collectionService: CollectionService,
|
||||
folderService: FolderService,
|
||||
storageService: StorageService,
|
||||
userService: UserService,
|
||||
private cipherService: CipherService,
|
||||
private router: Router,
|
||||
private ngZone: NgZone,
|
||||
private broadcasterService: BroadcasterService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private route: ActivatedRoute,
|
||||
private stateService: StateService,
|
||||
private popupUtils: PopupUtilsService,
|
||||
private syncService: SyncService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private searchService: SearchService,
|
||||
private location: Location
|
||||
private location: Location,
|
||||
private browserStateService: StateService
|
||||
) {
|
||||
super(collectionService, folderService, storageService, userService);
|
||||
super(collectionService, folderService, browserStateService);
|
||||
this.noFolderListSize = 100;
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
this.showLeftHeader = !(
|
||||
this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox()
|
||||
);
|
||||
this.stateService.remove("CiphersComponent");
|
||||
await this.browserStateService.setBrowserCipherComponentState(null);
|
||||
|
||||
this.broadcasterService.subscribe(ComponentId, (message: any) => {
|
||||
this.ngZone.run(async () => {
|
||||
@@ -116,8 +113,8 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
|
||||
const restoredScopeState = await this.restoreState();
|
||||
this.route.queryParams.pipe(first()).subscribe(async (params) => {
|
||||
this.state = (await this.stateService.get<any>(ComponentId)) || {};
|
||||
if (this.state.searchText) {
|
||||
this.state = await this.browserStateService.getBrowserGroupingComponentState();
|
||||
if (this.state?.searchText) {
|
||||
this.searchText = this.state.searchText;
|
||||
} else if (params.searchText) {
|
||||
this.searchText = params.searchText;
|
||||
@@ -135,7 +132,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
}
|
||||
|
||||
if (!this.syncService.syncInProgress || restoredScopeState) {
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state?.scrollY), 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -320,10 +317,6 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
this.state = {
|
||||
scrollY: this.popupUtils.getContentScrollY(window),
|
||||
searchText: this.searchText,
|
||||
};
|
||||
await this.stateService.save(ComponentId, this.state);
|
||||
|
||||
this.scopeState = {
|
||||
favoriteCiphers: this.favoriteCiphers,
|
||||
noFolderCiphers: this.noFolderCiphers,
|
||||
ciphers: this.ciphers,
|
||||
@@ -334,41 +327,41 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
||||
collections: this.collections,
|
||||
deletedCount: this.deletedCount,
|
||||
};
|
||||
await this.stateService.save(ScopeStateId, this.scopeState);
|
||||
await this.browserStateService.setBrowserGroupingComponentState(this.state);
|
||||
}
|
||||
|
||||
private async restoreState(): Promise<boolean> {
|
||||
this.scopeState = await this.stateService.get<any>(ScopeStateId);
|
||||
if (this.scopeState == null) {
|
||||
this.state = await this.browserStateService.getBrowserGroupingComponentState();
|
||||
if (this.state == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.scopeState.favoriteCiphers != null) {
|
||||
this.favoriteCiphers = this.scopeState.favoriteCiphers;
|
||||
if (this.state.favoriteCiphers != null) {
|
||||
this.favoriteCiphers = this.state.favoriteCiphers;
|
||||
}
|
||||
if (this.scopeState.noFolderCiphers != null) {
|
||||
this.noFolderCiphers = this.scopeState.noFolderCiphers;
|
||||
if (this.state.noFolderCiphers != null) {
|
||||
this.noFolderCiphers = this.state.noFolderCiphers;
|
||||
}
|
||||
if (this.scopeState.ciphers != null) {
|
||||
this.ciphers = this.scopeState.ciphers;
|
||||
if (this.state.ciphers != null) {
|
||||
this.ciphers = this.state.ciphers;
|
||||
}
|
||||
if (this.scopeState.collectionCounts != null) {
|
||||
this.collectionCounts = this.scopeState.collectionCounts;
|
||||
if (this.state.collectionCounts != null) {
|
||||
this.collectionCounts = this.state.collectionCounts;
|
||||
}
|
||||
if (this.scopeState.folderCounts != null) {
|
||||
this.folderCounts = this.scopeState.folderCounts;
|
||||
if (this.state.folderCounts != null) {
|
||||
this.folderCounts = this.state.folderCounts;
|
||||
}
|
||||
if (this.scopeState.typeCounts != null) {
|
||||
this.typeCounts = this.scopeState.typeCounts;
|
||||
if (this.state.typeCounts != null) {
|
||||
this.typeCounts = this.state.typeCounts;
|
||||
}
|
||||
if (this.scopeState.folders != null) {
|
||||
this.folders = this.scopeState.folders;
|
||||
if (this.state.folders != null) {
|
||||
this.folders = this.state.folders;
|
||||
}
|
||||
if (this.scopeState.collections != null) {
|
||||
this.collections = this.scopeState.collections;
|
||||
if (this.state.collections != null) {
|
||||
this.collections = this.state.collections;
|
||||
}
|
||||
if (this.scopeState.deletedCiphers != null) {
|
||||
this.deletedCount = this.scopeState.deletedCount;
|
||||
if (this.state.deletedCount != null) {
|
||||
this.deletedCount = this.state.deletedCount;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Location } from "@angular/common";
|
||||
import { Component } from "@angular/core";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
|
||||
@@ -8,8 +7,8 @@ import { CipherService } from "jslib-common/abstractions/cipher.service";
|
||||
import { CollectionService } from "jslib-common/abstractions/collection.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { ShareComponent as BaseShareComponent } from "jslib-angular/components/share.component";
|
||||
|
||||
@@ -22,19 +21,19 @@ export class ShareComponent extends BaseShareComponent {
|
||||
collectionService: CollectionService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
i18nService: I18nService,
|
||||
userService: UserService,
|
||||
logService: LogService,
|
||||
cipherService: CipherService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
logService: LogService
|
||||
organizationService: OrganizationService
|
||||
) {
|
||||
super(
|
||||
collectionService,
|
||||
platformUtilsService,
|
||||
i18nService,
|
||||
userService,
|
||||
cipherService,
|
||||
logService
|
||||
logService,
|
||||
organizationService
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ import { LogService } from "jslib-common/abstractions/log.service";
|
||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||
import { PasswordRepromptService } from "jslib-common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { TokenService } from "jslib-common/abstractions/token.service";
|
||||
import { TotpService } from "jslib-common/abstractions/totp.service";
|
||||
import { UserService } from "jslib-common/abstractions/user.service";
|
||||
|
||||
import { Cipher } from "jslib-common/models/domain/cipher";
|
||||
import { LoginUriView } from "jslib-common/models/view/loginUriView";
|
||||
@@ -57,7 +57,7 @@ export class ViewComponent extends BaseViewComponent {
|
||||
broadcasterService: BroadcasterService,
|
||||
ngZone: NgZone,
|
||||
changeDetectorRef: ChangeDetectorRef,
|
||||
userService: UserService,
|
||||
stateService: StateService,
|
||||
eventService: EventService,
|
||||
private autofillService: AutofillService,
|
||||
private messagingService: MessagingService,
|
||||
@@ -78,11 +78,11 @@ export class ViewComponent extends BaseViewComponent {
|
||||
broadcasterService,
|
||||
ngZone,
|
||||
changeDetectorRef,
|
||||
userService,
|
||||
eventService,
|
||||
apiService,
|
||||
passwordRepromptService,
|
||||
logService
|
||||
logService,
|
||||
stateService
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user