Skip to content

Commit 5f7aa48

Browse files
dani-garcianick-livefront
authored andcommitted
[PM-14214] Initialize PopupViewCacheService earlier (#13540)
1 parent c85f6a5 commit 5f7aa48

23 files changed

+13
-1579
lines changed

apps/browser/src/_locales/en/messages.json

+2-38
Original file line numberDiff line numberDiff line change
@@ -1397,14 +1397,14 @@
13971397
},
13981398
"useAnotherTwoStepMethod": {
13991399
"message": "Use another two-step login method"
1400-
},
1400+
},
14011401
"selectAnotherMethod": {
14021402
"message": "Select another method",
14031403
"description": "Select another two-step login method"
14041404
},
14051405
"useYourRecoveryCode": {
14061406
"message": "Use your recovery code"
1407-
},
1407+
},
14081408
"insertYubiKey": {
14091409
"message": "Insert your YubiKey into your computer's USB port, then touch its button."
14101410
},
@@ -4989,42 +4989,6 @@
49894989
"beta": {
49904990
"message": "Beta"
49914991
},
4992-
"importantNotice": {
4993-
"message": "Important notice"
4994-
},
4995-
"setupTwoStepLogin": {
4996-
"message": "Set up two-step login"
4997-
},
4998-
"newDeviceVerificationNoticeContentPage1": {
4999-
"message": "Bitwarden will send a code to your account email to verify logins from new devices starting in February 2025."
5000-
},
5001-
"newDeviceVerificationNoticeContentPage2": {
5002-
"message": "You can set up two-step login as an alternative way to protect your account or change your email to one you can access."
5003-
},
5004-
"remindMeLater": {
5005-
"message": "Remind me later"
5006-
},
5007-
"newDeviceVerificationNoticePageOneFormContent": {
5008-
"message": "Do you have reliable access to your email, $EMAIL$?",
5009-
"placeholders": {
5010-
"email": {
5011-
"content": "$1",
5012-
"example": "your_name@email.com"
5013-
}
5014-
}
5015-
},
5016-
"newDeviceVerificationNoticePageOneEmailAccessNo": {
5017-
"message": "No, I do not"
5018-
},
5019-
"newDeviceVerificationNoticePageOneEmailAccessYes": {
5020-
"message": "Yes, I can reliably access my email"
5021-
},
5022-
"turnOnTwoStepLogin": {
5023-
"message": "Turn on two-step login"
5024-
},
5025-
"changeAcctEmail": {
5026-
"message": "Change account email"
5027-
},
50284992
"extensionWidth": {
50294993
"message": "Extension width"
50304994
},

apps/browser/src/popup/app-routing.module.ts

+1-35
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
unauthGuardFn,
1919
} from "@bitwarden/angular/auth/guards";
2020
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
21-
import { NewDeviceVerificationNoticeGuard } from "@bitwarden/angular/vault/guards";
2221
import {
2322
AnonLayoutWrapperComponent,
2423
AnonLayoutWrapperData,
@@ -47,11 +46,6 @@ import {
4746
} from "@bitwarden/auth/angular";
4847
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
4948
import { LockComponent } from "@bitwarden/key-management-ui";
50-
import {
51-
NewDeviceVerificationNoticePageOneComponent,
52-
NewDeviceVerificationNoticePageTwoComponent,
53-
VaultIcons,
54-
} from "@bitwarden/vault";
5549

5650
import { fido2AuthGuard } from "../auth/guards/fido2-auth.guard";
5751
import { AccountSwitcherComponent } from "../auth/popup/account-switching/account-switcher.component";
@@ -691,34 +685,6 @@ const routes: Routes = [
691685
canActivate: [authGuard],
692686
data: { elevation: 2 } satisfies RouteDataProperties,
693687
},
694-
{
695-
path: "new-device-notice",
696-
component: ExtensionAnonLayoutWrapperComponent,
697-
canActivate: [],
698-
children: [
699-
{
700-
path: "",
701-
component: NewDeviceVerificationNoticePageOneComponent,
702-
data: {
703-
pageIcon: VaultIcons.ExclamationTriangle,
704-
pageTitle: {
705-
key: "importantNotice",
706-
},
707-
hideFooter: true,
708-
},
709-
},
710-
{
711-
path: "setup",
712-
component: NewDeviceVerificationNoticePageTwoComponent,
713-
data: {
714-
pageIcon: VaultIcons.UserLock,
715-
pageTitle: {
716-
key: "setupTwoStepLogin",
717-
},
718-
},
719-
},
720-
],
721-
},
722688
{
723689
path: "tabs",
724690
component: TabsV2Component,
@@ -736,7 +702,7 @@ const routes: Routes = [
736702
{
737703
path: "vault",
738704
component: VaultV2Component,
739-
canActivate: [authGuard, NewDeviceVerificationNoticeGuard],
705+
canActivate: [authGuard],
740706
canDeactivate: [clearVaultStateGuard],
741707
data: { elevation: 0 } satisfies RouteDataProperties,
742708
},

apps/browser/src/popup/app.component.ts

-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
import { BiometricsService, BiometricStateService } from "@bitwarden/key-management";
2525

2626
import { PopupCompactModeService } from "../platform/popup/layout/popup-compact-mode.service";
27-
import { PopupViewCacheService } from "../platform/popup/view-cache/popup-view-cache.service";
2827
import { initPopupClosedListener } from "../platform/services/popup-view-cache-background.service";
2928
import { VaultBrowserStateService } from "../vault/services/vault-browser-state.service";
3029

@@ -43,7 +42,6 @@ import { DesktopSyncVerificationDialogComponent } from "./components/desktop-syn
4342
`,
4443
})
4544
export class AppComponent implements OnInit, OnDestroy {
46-
private viewCacheService = inject(PopupViewCacheService);
4745
private compactModeService = inject(PopupCompactModeService);
4846

4947
private lastActivity: Date;
@@ -74,7 +72,6 @@ export class AppComponent implements OnInit, OnDestroy {
7472

7573
async ngOnInit() {
7674
initPopupClosedListener();
77-
await this.viewCacheService.init();
7875

7976
this.compactModeService.init();
8077

apps/browser/src/popup/services/init.service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv
1212
import { BrowserApi } from "../../platform/browser/browser-api";
1313
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
1414
import { PopupSizeService } from "../../platform/popup/layout/popup-size.service";
15+
import { PopupViewCacheService } from "../../platform/popup/view-cache/popup-view-cache.service";
16+
1517
@Injectable()
1618
export class InitService {
1719
private sizeService = inject(PopupSizeService);
@@ -24,6 +26,7 @@ export class InitService {
2426
private logService: LogServiceAbstraction,
2527
private themingService: AbstractThemingService,
2628
private sdkLoadService: SdkLoadService,
29+
private viewCacheService: PopupViewCacheService,
2730
@Inject(DOCUMENT) private document: Document,
2831
) {}
2932

@@ -33,7 +36,7 @@ export class InitService {
3336
await this.stateService.init({ runMigrations: false }); // Browser background is responsible for migrations
3437
await this.i18nService.init();
3538
this.twoFactorService.init();
36-
39+
await this.viewCacheService.init();
3740
await this.sizeService.init();
3841

3942
const htmlEl = window.document.documentElement;

apps/desktop/src/app/app-routing.module.ts

+1-34
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
unauthGuardFn,
1717
} from "@bitwarden/angular/auth/guards";
1818
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
19-
import { NewDeviceVerificationNoticeGuard } from "@bitwarden/angular/vault/guards";
2019
import {
2120
AnonLayoutWrapperComponent,
2221
AnonLayoutWrapperData,
@@ -45,11 +44,6 @@ import {
4544
} from "@bitwarden/auth/angular";
4645
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
4746
import { LockComponent } from "@bitwarden/key-management-ui";
48-
import {
49-
NewDeviceVerificationNoticePageOneComponent,
50-
NewDeviceVerificationNoticePageTwoComponent,
51-
VaultIcons,
52-
} from "@bitwarden/vault";
5347

5448
import { AccessibilityCookieComponent } from "../auth/accessibility-cookie.component";
5549
import { maxAccountsGuardFn } from "../auth/guards/max-accounts.guard";
@@ -139,37 +133,10 @@ const routes: Routes = [
139133
},
140134
} satisfies RouteDataProperties & AnonLayoutWrapperData,
141135
},
142-
{
143-
path: "new-device-notice",
144-
component: AnonLayoutWrapperComponent,
145-
canActivate: [],
146-
children: [
147-
{
148-
path: "",
149-
component: NewDeviceVerificationNoticePageOneComponent,
150-
data: {
151-
pageIcon: VaultIcons.ExclamationTriangle,
152-
pageTitle: {
153-
key: "importantNotice",
154-
},
155-
},
156-
},
157-
{
158-
path: "setup",
159-
component: NewDeviceVerificationNoticePageTwoComponent,
160-
data: {
161-
pageIcon: VaultIcons.UserLock,
162-
pageTitle: {
163-
key: "setupTwoStepLogin",
164-
},
165-
},
166-
},
167-
],
168-
},
169136
{
170137
path: "vault",
171138
component: VaultComponent,
172-
canActivate: [authGuard, NewDeviceVerificationNoticeGuard],
139+
canActivate: [authGuard],
173140
},
174141
{ path: "accessibility-cookie", component: AccessibilityCookieComponent },
175142
{ path: "set-password", component: SetPasswordComponent },

apps/desktop/src/locales/en/messages.json

+1-37
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@
882882
},
883883
"useYourRecoveryCode": {
884884
"message": "Use your recovery code"
885-
},
885+
},
886886
"insertYubiKey": {
887887
"message": "Insert your YubiKey into your computer's USB port, then touch its button."
888888
},
@@ -3533,42 +3533,6 @@
35333533
"fileSavedToDevice": {
35343534
"message": "File saved to device. Manage from your device downloads."
35353535
},
3536-
"importantNotice": {
3537-
"message": "Important notice"
3538-
},
3539-
"setupTwoStepLogin": {
3540-
"message": "Set up two-step login"
3541-
},
3542-
"newDeviceVerificationNoticeContentPage1": {
3543-
"message": "Bitwarden will send a code to your account email to verify logins from new devices starting in February 2025."
3544-
},
3545-
"newDeviceVerificationNoticeContentPage2": {
3546-
"message": "You can set up two-step login as an alternative way to protect your account or change your email to one you can access."
3547-
},
3548-
"remindMeLater": {
3549-
"message": "Remind me later"
3550-
},
3551-
"newDeviceVerificationNoticePageOneFormContent": {
3552-
"message": "Do you have reliable access to your email, $EMAIL$?",
3553-
"placeholders": {
3554-
"email": {
3555-
"content": "$1",
3556-
"example": "your_name@email.com"
3557-
}
3558-
}
3559-
},
3560-
"newDeviceVerificationNoticePageOneEmailAccessNo": {
3561-
"message": "No, I do not"
3562-
},
3563-
"newDeviceVerificationNoticePageOneEmailAccessYes": {
3564-
"message": "Yes, I can reliably access my email"
3565-
},
3566-
"turnOnTwoStepLogin": {
3567-
"message": "Turn on two-step login"
3568-
},
3569-
"changeAcctEmail": {
3570-
"message": "Change account email"
3571-
},
35723536
"allowScreenshots": {
35733537
"message": "Allow screen capture"
35743538
},

apps/web/src/app/auth/recover-two-factor.component.spec.ts

-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
1717
import { ToastService } from "@bitwarden/components";
1818
import { KeyService } from "@bitwarden/key-management";
1919
import { I18nPipe } from "@bitwarden/ui-common";
20-
import { NewDeviceVerificationNoticeService } from "@bitwarden/vault";
2120

2221
import { RecoverTwoFactorComponent } from "./recover-two-factor.component";
2322

@@ -36,7 +35,6 @@ describe("RecoverTwoFactorComponent", () => {
3635
let mockConfigService: MockProxy<ConfigService>;
3736
let mockLoginSuccessHandlerService: MockProxy<LoginSuccessHandlerService>;
3837
let mockLogService: MockProxy<LogService>;
39-
let mockNewDeviceVerificationNoticeService: MockProxy<NewDeviceVerificationNoticeService>;
4038

4139
beforeEach(() => {
4240
mockRouter = mock<Router>();
@@ -49,7 +47,6 @@ describe("RecoverTwoFactorComponent", () => {
4947
mockConfigService = mock<ConfigService>();
5048
mockLoginSuccessHandlerService = mock<LoginSuccessHandlerService>();
5149
mockLogService = mock<LogService>();
52-
mockNewDeviceVerificationNoticeService = mock<NewDeviceVerificationNoticeService>();
5350

5451
TestBed.configureTestingModule({
5552
declarations: [RecoverTwoFactorComponent],
@@ -64,10 +61,6 @@ describe("RecoverTwoFactorComponent", () => {
6461
{ provide: ConfigService, useValue: mockConfigService },
6562
{ provide: LoginSuccessHandlerService, useValue: mockLoginSuccessHandlerService },
6663
{ provide: LogService, useValue: mockLogService },
67-
{
68-
provide: NewDeviceVerificationNoticeService,
69-
useValue: mockNewDeviceVerificationNoticeService,
70-
},
7164
],
7265
imports: [I18nPipe],
7366
});
@@ -102,9 +95,6 @@ describe("RecoverTwoFactorComponent", () => {
10295
title: "",
10396
message: mockI18nService.t("youHaveBeenLoggedIn"),
10497
});
105-
expect(
106-
mockNewDeviceVerificationNoticeService.updateNewDeviceVerificationSkipNoticeState,
107-
).toHaveBeenCalledWith(authResult.userId, true);
10898
expect(mockRouter.navigate).toHaveBeenCalledWith(["/settings/security/two-factor"]);
10999
});
110100

apps/web/src/app/auth/recover-two-factor.component.ts

-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
1818
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
1919
import { ToastService } from "@bitwarden/components";
2020
import { KeyService } from "@bitwarden/key-management";
21-
import { NewDeviceVerificationNoticeService } from "@bitwarden/vault";
2221

2322
@Component({
2423
selector: "app-recover-two-factor",
@@ -52,7 +51,6 @@ export class RecoverTwoFactorComponent implements OnInit {
5251
private configService: ConfigService,
5352
private loginSuccessHandlerService: LoginSuccessHandlerService,
5453
private logService: LogService,
55-
private newDeviceVerificationNoticeService: NewDeviceVerificationNoticeService,
5654
) {}
5755

5856
async ngOnInit() {
@@ -137,13 +135,6 @@ export class RecoverTwoFactorComponent implements OnInit {
137135

138136
await this.loginSuccessHandlerService.run(authResult.userId);
139137

140-
// Before routing, set the state to skip the new device notification. This is a temporary
141-
// fix and will be cleaned up in PM-18485.
142-
await this.newDeviceVerificationNoticeService.updateNewDeviceVerificationSkipNoticeState(
143-
authResult.userId,
144-
true,
145-
);
146-
147138
await this.router.navigate(["/settings/security/two-factor"]);
148139
} catch (error) {
149140
// If login errors, redirect to login page per product. Don't show error

0 commit comments

Comments
 (0)