From 10c8286d695183c52e43b8eceefe7cbf866576eb Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Tue, 5 Sep 2023 14:17:02 +0200 Subject: [PATCH] [PM-3783] chore: remove `ngZone.run` calls No longer needed now that we have zone-patches for `chrome.runtime.onMessage` --- apps/browser/src/popup/app.component.ts | 46 +++++++++---------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts index 815109c5499..e76d276b731 100644 --- a/apps/browser/src/popup/app.component.ts +++ b/apps/browser/src/popup/app.component.ts @@ -86,31 +86,25 @@ export class AppComponent implements OnInit, OnDestroy { sendResponse: any ) => { if (msg.command === "doneLoggingOut") { - this.ngZone.run(async () => { - this.authService.logOut(async () => { - if (msg.expired) { - this.showToast({ - type: "warning", - title: this.i18nService.t("loggedOut"), - text: this.i18nService.t("loginExpired"), - }); - } + this.authService.logOut(async () => { + if (msg.expired) { + this.showToast({ + type: "warning", + title: this.i18nService.t("loggedOut"), + text: this.i18nService.t("loginExpired"), + }); + } - if (this.activeUserId === null) { - this.router.navigate(["home"]); - } - }); - this.changeDetectorRef.detectChanges(); + if (this.activeUserId === null) { + this.router.navigate(["home"]); + } }); + this.changeDetectorRef.detectChanges(); } else if (msg.command === "authBlocked") { - this.ngZone.run(() => { - this.router.navigate(["home"]); - }); + this.router.navigate(["home"]); } else if (msg.command === "locked") { if (msg.userId == null || msg.userId === (await this.stateService.getUserId())) { - this.ngZone.run(() => { - this.router.navigate(["lock"]); - }); + this.router.navigate(["lock"]); } } else if (msg.command === "showDialog") { await this.showDialog(msg); @@ -118,9 +112,7 @@ export class AppComponent implements OnInit, OnDestroy { // TODO: Should be refactored to live in another service. await this.showNativeMessagingFingerprintDialog(msg); } else if (msg.command === "showToast") { - this.ngZone.run(() => { - this.showToast(msg); - }); + this.showToast(msg); } else if (msg.command === "reloadProcess") { const forceWindowReload = this.platformUtilsService.isSafari() || @@ -132,13 +124,9 @@ export class AppComponent implements OnInit, OnDestroy { 2000 ); } else if (msg.command === "reloadPopup") { - this.ngZone.run(() => { - this.router.navigate(["/"]); - }); + this.router.navigate(["/"]); } else if (msg.command === "convertAccountToKeyConnector") { - this.ngZone.run(async () => { - this.router.navigate(["/remove-password"]); - }); + this.router.navigate(["/remove-password"]); } else { msg.webExtSender = sender; this.broadcasterService.send(msg);