From 602f19223b75565bd6034e013002cdb14a853d0c Mon Sep 17 00:00:00 2001 From: Alec Rippberger Date: Thu, 17 Apr 2025 13:17:45 -0500 Subject: [PATCH] Revert changes --- apps/browser/src/popup/app.component.ts | 16 ++++++---------- .../services/vault-browser-state.service.ts | 6 ++---- .../src/vault/abstractions/cipher.service.ts | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts index 1620a95a10f..6a08bf007bb 100644 --- a/apps/browser/src/popup/app.component.ts +++ b/apps/browser/src/popup/app.component.ts @@ -1,3 +1,5 @@ +// FIXME: Update this file to be type safe and remove this and next line +// @ts-strict-ignore import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit, inject } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { NavigationEnd, Router, RouterOutlet } from "@angular/router"; @@ -44,8 +46,8 @@ import { DesktopSyncVerificationDialogComponent } from "./components/desktop-syn export class AppComponent implements OnInit, OnDestroy { private compactModeService = inject(PopupCompactModeService); - private lastActivity: Date | null = null; - private activeUserId: UserId | null = null; + private lastActivity: Date; + private activeUserId: UserId; private recordActivitySubject = new Subject(); private routerAnimations = false; @@ -83,7 +85,7 @@ export class AppComponent implements OnInit, OnDestroy { await this.clearComponentStates(); this.accountService.activeAccount$.pipe(takeUntil(this.destroy$)).subscribe((account) => { - this.activeUserId = account?.id ?? null; + this.activeUserId = account?.id; }); this.authService.activeAccountStatus$ @@ -113,10 +115,6 @@ export class AppComponent implements OnInit, OnDestroy { if (msg.logoutReason) { await this.displayLogoutReason(msg.logoutReason); } - - if (this.activeUserId) { - await this.router.navigate(["vault"]); - } }); this.changeDetectorRef.detectChanges(); } else if (msg.command === "authBlocked" || msg.command === "goHome") { @@ -184,9 +182,7 @@ export class AppComponent implements OnInit, OnDestroy { await this.clearComponentStates(); } if (url.startsWith("/tabs/")) { - if (this.activeUserId) { - await this.cipherService.setAddEditCipherInfo(null, this.activeUserId); - } + await this.cipherService.setAddEditCipherInfo(null, this.activeUserId); } (window as any).previousPopupUrl = url; diff --git a/apps/browser/src/vault/services/vault-browser-state.service.ts b/apps/browser/src/vault/services/vault-browser-state.service.ts index d8851958269..58ce717bf1e 100644 --- a/apps/browser/src/vault/services/vault-browser-state.service.ts +++ b/apps/browser/src/vault/services/vault-browser-state.service.ts @@ -56,9 +56,7 @@ export class VaultBrowserStateService { return await firstValueFrom(this.vaultBrowserGroupingsComponentState$); } - async setBrowserGroupingsComponentState( - value: BrowserGroupingsComponentState | null, - ): Promise { + async setBrowserGroupingsComponentState(value: BrowserGroupingsComponentState): Promise { await this.activeUserVaultBrowserGroupingsComponentState.update(() => value, { shouldUpdate: (current) => !(current == null && value == null), }); @@ -68,7 +66,7 @@ export class VaultBrowserStateService { return await firstValueFrom(this.vaultBrowserComponentState$); } - async setBrowserVaultItemsComponentState(value: BrowserComponentState | null): Promise { + async setBrowserVaultItemsComponentState(value: BrowserComponentState): Promise { await this.activeUserVaultBrowserComponentState.update(() => value, { shouldUpdate: (current) => !(current == null && value == null), }); diff --git a/libs/common/src/vault/abstractions/cipher.service.ts b/libs/common/src/vault/abstractions/cipher.service.ts index f55435465bf..2d381faaa8d 100644 --- a/libs/common/src/vault/abstractions/cipher.service.ts +++ b/libs/common/src/vault/abstractions/cipher.service.ts @@ -198,7 +198,7 @@ export abstract class CipherService implements UserKeyRotationDataProvider; abstract restoreManyWithServer(ids: string[], orgId?: string): Promise; abstract getKeyForCipherKeyDecryption(cipher: Cipher, userId: UserId): Promise; - abstract setAddEditCipherInfo(value: AddEditCipherInfo | null, userId: UserId): Promise; + abstract setAddEditCipherInfo(value: AddEditCipherInfo, userId: UserId): Promise; /** * Returns user ciphers re-encrypted with the new user key. * @param originalUserKey the original user key