mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Noop notifications for dev (#6671)
* Noop notifications for dev We rarely have notifications set up for development environments, this removes the error messages related to missing server notification services * Log actions in noop service * Add line breaks * Improve log messages * Ignore local config at all levels
This commit is contained in:
@@ -8,7 +8,9 @@ export type SharedFlags = {
|
||||
|
||||
// required to avoid linting errors when there are no flags
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
export type SharedDevFlags = {};
|
||||
export type SharedDevFlags = {
|
||||
noopNotifications: boolean;
|
||||
};
|
||||
|
||||
function getFlags<T>(envFlags: string | T): T {
|
||||
if (typeof envFlags === "string") {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { NotificationsService as NotificationsServiceAbstraction } from "../../abstractions/notifications.service";
|
||||
import { LogService } from "../abstractions/log.service";
|
||||
|
||||
export class NoopNotificationsService implements NotificationsServiceAbstraction {
|
||||
constructor(private logService: LogService) {}
|
||||
|
||||
init(): Promise<void> {
|
||||
this.logService.info(
|
||||
"Initializing no-op notification service, no push notifications will be received"
|
||||
);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
updateConnection(sync?: boolean): Promise<void> {
|
||||
this.logService.info("Updating notification service connection");
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
reconnectFromActivity(): Promise<void> {
|
||||
this.logService.info("Reconnecting notification service from activity");
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
disconnectFromInactivity(): Promise<void> {
|
||||
this.logService.info("Disconnecting notification service from inactivity");
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,12 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
private reconnectTimer: any = null;
|
||||
|
||||
constructor(
|
||||
private logService: LogService,
|
||||
private syncService: SyncService,
|
||||
private appIdService: AppIdService,
|
||||
private apiService: ApiService,
|
||||
private environmentService: EnvironmentService,
|
||||
private logoutCallback: (expired: boolean) => Promise<void>,
|
||||
private logService: LogService,
|
||||
private stateService: StateService,
|
||||
private authService: AuthService,
|
||||
private messagingService: MessagingService
|
||||
|
||||
Reference in New Issue
Block a user