diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts index 7aeb9371f49..98f7514b597 100644 --- a/apps/browser/src/popup/app.component.ts +++ b/apps/browser/src/popup/app.component.ts @@ -150,11 +150,9 @@ export class AppComponent implements OnInit, OnDestroy { this.compactModeService.init(); await this.popupSizeService.setHeight(); - this.accountService.activeAccount$ - .pipe(takeUntil(this.destroy$)) - .subscribe((account) => { - this.activeUserId = account?.id; - }); + this.accountService.activeAccount$.pipe(takeUntil(this.destroy$)).subscribe((account) => { + this.activeUserId = account?.id; + }); // Separate subscription: only trigger processing on subsequent user switches while popup is open this.accountService.activeAccount$ @@ -254,19 +252,21 @@ export class AppComponent implements OnInit, OnDestroy { await this.router.navigate(["lock"]); } else if (msg.command === "openLoginApproval") { - if (this.processingPendingAuth) {return;} + if (this.processingPendingAuth) { + return; + } this.processingPendingAuth = true; try { // Always query server for all pending requests and open a dialog for each - const pendingList = await firstValueFrom(this.authRequestService.getPendingAuthRequests$()); + const pendingList = await firstValueFrom( + this.authRequestService.getPendingAuthRequests$(), + ); if (Array.isArray(pendingList) && pendingList.length > 0) { const respondedIds = new Set(); for (const req of pendingList) { - if (req?.id == null) {continue;} - console.debug( - "[Popup AppComponent] Opening LoginApprovalDialogComponent", - req.id, - ); + if (req?.id == null) { + continue; + } const dialogRef = LoginApprovalDialogComponent.open(this.dialogService, { notificationId: req.id, }); @@ -275,22 +275,10 @@ export class AppComponent implements OnInit, OnDestroy { if (result !== undefined && typeof result === "boolean") { respondedIds.add(req.id); - if ( - respondedIds.size === pendingList.length && - this.activeUserId != null - ) { - console.debug( - "[Popup AppComponent] All pending auth requests responded; clearing marker for user", - this.activeUserId, - ); + if (respondedIds.size === pendingList.length && this.activeUserId != null) { await this.pendingAuthRequestsState.clearByUserId(this.activeUserId); } } - - console.debug( - "[Popup AppComponent] LoginApprovalDialogComponent closed", - req.id, - ); } } } finally { diff --git a/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts b/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts index 1cffd773863..d074f3c9602 100644 --- a/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts +++ b/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts @@ -11,8 +11,6 @@ import { Observable, share, switchMap, - tap, - finalize, } from "rxjs"; // This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop. @@ -72,19 +70,12 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer this.notifications$ = this.configService .getFeatureFlag$(FeatureFlag.InactiveUserServerNotification) .pipe( - tap((value) => { - console.debug(`[DefaultServerNotificationsService] feature flag value for inactive user server notifications: ${value}`); - }), distinctUntilChanged(), switchMap((inactiveUserServerNotificationEnabled) => { if (inactiveUserServerNotificationEnabled) { - console.debug("[DefaultServerNotificationsService] inactive notification processing"); return this.accountService.accounts$.pipe( map((accounts) => Object.keys(accounts) as UserId[]), distinctUntilChanged(), - tap((value) => { - console.debug(`[DefaultServerNotificationsService] new accounts: ${value}`); - }), switchMap((userIds) => { if (userIds.length === 0) { return EMPTY; @@ -101,7 +92,6 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer ); } - console.debug("[DefaultServerNotificationsService] NOT inactive notification processing"); return this.accountService.activeAccount$.pipe( map((account) => account?.id), distinctUntilChanged(), @@ -128,18 +118,9 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer private userNotifications$(userId: UserId) { return this.environmentService.getEnvironment$(userId).pipe( map((env) => env.getNotificationsUrl()), - tap((value) => { - console.debug(`[DefaultServerNotificationsService] userNotifications$ before: ${value}`); - }), distinctUntilChanged(), - tap((value) => { - console.debug(`[DefaultServerNotificationsService] userNotifications$ after: ${value}`); - }), switchMap((notificationsUrl) => { if (notificationsUrl === DISABLED_NOTIFICATIONS_URL) { - console.debug( - `[DefaultServerNotificationsService] notifications disabled via URL for user ${userId}`, - ); return EMPTY; } @@ -153,18 +134,12 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer distinctUntilChanged(), switchMap((hasAccessToken) => { if (!hasAccessToken) { - console.debug( - `[DefaultServerNotificationsService] no access token for user ${userId}, skipping notifications`, - ); return EMPTY; } return this.activitySubject; }), switchMap((activityStatus) => { - console.debug( - `[DefaultServerNotificationsService] activity status for user ${userId}: ${activityStatus}`, - ); if (activityStatus === "inactive") { return EMPTY; } @@ -174,24 +149,15 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer supportSwitch({ supported: (service) => { this.logService.info("Using WebPush for server notifications"); - console.debug( - `[DefaultServerNotificationsService] WebPush supported for user ${userId}`, - ); return service.notifications$.pipe( catchError((err: unknown) => { this.logService.warning("Issue with web push, falling back to SignalR", err); - console.debug( - `[DefaultServerNotificationsService] WebPush error for user ${userId}, falling back to SignalR`, - ); return this.connectSignalR$(userId, notificationsUrl); }), ); }, notSupported: () => { this.logService.info("Using SignalR for server notifications"); - console.debug( - `[DefaultServerNotificationsService] WebPush not supported for user ${userId}, using SignalR`, - ); return this.connectSignalR$(userId, notificationsUrl); }, }), @@ -199,17 +165,9 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer } private connectSignalR$(userId: UserId, notificationsUrl: string) { - console.debug( - `[DefaultServerNotificationsService] Connecting SignalR for user ${userId} to ${notificationsUrl}`, - ); return this.signalRConnectionService.connect$(userId, notificationsUrl).pipe( filter((n) => n.type === "ReceiveMessage"), map((n) => (n as ReceiveMessage).message), - finalize(() => - console.debug( - `[DefaultServerNotificationsService] SignalR stream finalized for user ${userId}`, - ), - ), ); } @@ -322,7 +280,7 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer case NotificationType.AuthRequest: if ( await firstValueFrom( - this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval) + this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval), ) ) { await this.authRequestAnsweringService.receivedPendingAuthRequest( @@ -346,14 +304,8 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer } startListening() { - console.debug("[DefaultServerNotificationsService] startListening subscribe"); return this.notifications$ .pipe( - tap(([notification, userId]) => - console.debug( - `[DefaultServerNotificationsService] received notification type ${notification.type} for user ${userId}`, - ), - ), mergeMap(async ([notification, userId]) => this.processNotification(notification, userId)), ) .subscribe({ @@ -363,12 +315,10 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer } reconnectFromActivity(): void { - console.debug("[DefaultServerNotificationsService] reconnectFromActivity called"); this.activitySubject.next("active"); } disconnectFromInactivity(): void { - console.debug("[DefaultServerNotificationsService] disconnectFromInactivity called"); this.activitySubject.next("inactive"); } }