Adding keyboard shortcut to toggle notifications [S]
Change-Id: I5d69cb14141f4c484738920efee96f6c117527bc
diff --git a/src/app/core/debug/debug.service.ts b/src/app/core/debug/debug.service.ts
index f23fa06..aee1064 100644
--- a/src/app/core/debug/debug.service.ts
+++ b/src/app/core/debug/debug.service.ts
@@ -20,12 +20,13 @@
global: boolean;
events: boolean;
modelsTab: boolean;
+ notifications: boolean;
}
export interface IXosDebugService {
status: IXosDebugStatus;
setupShortcuts(): void;
- toggleDebug(type: 'global' | 'events' | 'modelsTab'): void;
+ toggleDebug(type: 'global' | 'events' | 'modelsTab' | 'notifications'): void;
}
export class XosDebugService implements IXosDebugService {
@@ -35,7 +36,8 @@
public status: IXosDebugStatus = {
global: false,
events: false,
- modelsTab: false
+ modelsTab: false,
+ notifications: true
};
constructor (
@@ -51,6 +53,9 @@
const debugModelsTab = window.localStorage.getItem('debug-modelsTab');
this.status.modelsTab = (debugModelsTab === 'true');
+
+ const notifications = window.localStorage.getItem('debug-notifications');
+ this.status.notifications = (notifications !== null ? notifications === 'true' : true);
}
public setupShortcuts(): void {
@@ -65,9 +70,15 @@
cb: () => this.toggleDebug('events'),
description: 'Toggle debug messages for WS events in browser console'
}, 'global');
+
+ this.XosKeyboardShortcut.registerKeyBinding({
+ key: 'S',
+ cb: () => this.toggleDebug('notifications'),
+ description: 'Toggle notifications'
+ }, 'global');
}
- public toggleDebug(type: 'global' | 'events' | 'modelsTab'): void {
+ public toggleDebug(type: 'global' | 'events' | 'modelsTab' | 'notifications'): void {
if (window.localStorage.getItem(`debug-${type}`) === 'true') {
this.$log.info(`[XosDebug] Disabling ${type} debug`);
window.localStorage.setItem(`debug-${type}`, 'false');