SDA-3875 - Update corporate switch shortcuts keys (#1504)

This commit is contained in:
Kiran Niranjan 2022-09-27 13:07:05 +05:30 committed by GitHub
parent 526b937193
commit 712457d5d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 20 deletions

View File

@ -691,14 +691,6 @@ export class AppMenu {
windowHandler.createAboutAppWindow(windowName); windowHandler.createAboutAppWindow(windowName);
}, },
}, },
{
click: (_item) =>
windowHandler.switchClient(ClientSwitchType.CLIENT_1_5),
visible: isCorp,
type: 'checkbox',
checked: windowHandler.url?.startsWith(CORP_URL + '/client/'),
label: i18n.t('Switch to client 1.5')(),
},
{ {
click: (_item) => click: (_item) =>
windowHandler.switchClient(ClientSwitchType.CLIENT_2_0), windowHandler.switchClient(ClientSwitchType.CLIENT_2_0),

View File

@ -75,13 +75,12 @@ const windowSize: string | null = getCommandLineArgs(
); );
export enum ClientSwitchType { export enum ClientSwitchType {
CLIENT_1_5 = 'CLIENT_1_5',
CLIENT_2_0 = 'CLIENT_2_0', CLIENT_2_0 = 'CLIENT_2_0',
CLIENT_2_0_DAILY = 'CLIENT_2_0_DAILY', CLIENT_2_0_DAILY = 'CLIENT_2_0_DAILY',
} }
const MAIN_WEB_CONTENTS_EVENTS = ['enter-full-screen', 'leave-full-screen']; const MAIN_WEB_CONTENTS_EVENTS = ['enter-full-screen', 'leave-full-screen'];
const EXPORT_LOGS_THROTTLE = 1000; // 1sec const SHORTCUT_KEY_THROTTLE = 1000; // 1sec
export interface ICustomBrowserWindowConstructorOpts export interface ICustomBrowserWindowConstructorOpts
extends Electron.BrowserWindowConstructorOptions { extends Electron.BrowserWindowConstructorOptions {
@ -394,12 +393,31 @@ export class WindowHandler {
// SDA-3844 - workaround as local shortcuts not working // SDA-3844 - workaround as local shortcuts not working
const throttledExportLogs = throttle(() => { const throttledExportLogs = throttle(() => {
exportLogs(); exportLogs();
}, EXPORT_LOGS_THROTTLE); }, SHORTCUT_KEY_THROTTLE);
const switchToClient2 = throttle(() => {
windowHandler.switchClient(ClientSwitchType.CLIENT_2_0);
}, SHORTCUT_KEY_THROTTLE);
const switchToDaily = throttle(() => {
windowHandler.switchClient(ClientSwitchType.CLIENT_2_0);
}, SHORTCUT_KEY_THROTTLE);
this.mainWebContents.on('before-input-event', (event, input) => { this.mainWebContents.on('before-input-event', (event, input) => {
if (input.control && input.shift && input.key.toLowerCase() === 'd') { if (input.control && input.shift && input.key.toLowerCase() === 'd') {
event.preventDefault(); event.preventDefault();
throttledExportLogs(); throttledExportLogs();
} }
const isCtrlOrMeta = isMac ? input.meta : input.control;
if (this.url && this.url.startsWith('https://corporate.symphony.com')) {
if (isCtrlOrMeta) {
switch (input.key) {
case '1':
switchToClient2();
break;
case '2':
switchToDaily();
break;
}
}
}
}); });
if (isMaximized || isMaximizedFlag) { if (isMaximized || isMaximizedFlag) {
this.mainWindow.maximize(); this.mainWindow.maximize();
@ -2095,9 +2113,6 @@ export class WindowHandler {
`localStorage.getItem('x-km-csrf-token')`, `localStorage.getItem('x-km-csrf-token')`,
); );
switch (clientSwitch) { switch (clientSwitch) {
case ClientSwitchType.CLIENT_1_5:
this.url = this.startUrl + `?x-km-csrf-token=${csrfToken}`;
break;
case ClientSwitchType.CLIENT_2_0: case ClientSwitchType.CLIENT_2_0:
this.url = `https://${parsedUrl.hostname}/client-bff/index.html?x-km-csrf-token=${csrfToken}`; this.url = `https://${parsedUrl.hostname}/client-bff/index.html?x-km-csrf-token=${csrfToken}`;
break; break;

View File

@ -185,7 +185,6 @@
"Speech": "Speech", "Speech": "Speech",
"Start Speaking": "Start Speaking", "Start Speaking": "Start Speaking",
"Stop Speaking": "Stop Speaking", "Stop Speaking": "Stop Speaking",
"Switch to client 1.5": "Switch to client 1.5",
"Switch to client 2.0": "Switch to client 2.0", "Switch to client 2.0": "Switch to client 2.0",
"Switch to client 2.0 daily": "Switch to client 2.0 daily", "Switch to client 2.0 daily": "Switch to client 2.0 daily",
"Symphony Help": "Symphony Help", "Symphony Help": "Symphony Help",

View File

@ -185,7 +185,6 @@
"Speech": "Speech", "Speech": "Speech",
"Start Speaking": "Start Speaking", "Start Speaking": "Start Speaking",
"Stop Speaking": "Stop Speaking", "Stop Speaking": "Stop Speaking",
"Switch to client 1.5": "Switch to client 1.5",
"Switch to client 2.0": "Switch to client 2.0", "Switch to client 2.0": "Switch to client 2.0",
"Switch to client 2.0 daily": "Switch to client 2.0 daily", "Switch to client 2.0 daily": "Switch to client 2.0 daily",
"Symphony Help": "Symphony Help", "Symphony Help": "Symphony Help",

View File

@ -185,7 +185,6 @@
"Speech": "Dictée vocale", "Speech": "Dictée vocale",
"Start Speaking": "Commencer à dicter", "Start Speaking": "Commencer à dicter",
"Stop Speaking": "Arreter de dicter", "Stop Speaking": "Arreter de dicter",
"Switch to client 1.5": "Passer au client 1.5",
"Switch to client 2.0": "Passer au client 2.0", "Switch to client 2.0": "Passer au client 2.0",
"Switch to client 2.0 daily": "Passer à client 2.0 daily", "Switch to client 2.0 daily": "Passer à client 2.0 daily",
"Symphony Help": "Aide en ligne de Symphony", "Symphony Help": "Aide en ligne de Symphony",

View File

@ -185,7 +185,6 @@
"Speech": "Dictée vocale", "Speech": "Dictée vocale",
"Start Speaking": "Commencer à dicter", "Start Speaking": "Commencer à dicter",
"Stop Speaking": "Arreter de dicter", "Stop Speaking": "Arreter de dicter",
"Switch to client 1.5": "Passer au client 1.5",
"Switch to client 2.0": "Passer au client 2.0", "Switch to client 2.0": "Passer au client 2.0",
"Switch to client 2.0 daily": "Passer à client 2.0 daily", "Switch to client 2.0 daily": "Passer à client 2.0 daily",
"Symphony Help": "Aide en ligne de Symphony", "Symphony Help": "Aide en ligne de Symphony",

View File

@ -185,7 +185,6 @@
"Speech": "スピーチ", "Speech": "スピーチ",
"Start Speaking": "スピーチを開始", "Start Speaking": "スピーチを開始",
"Stop Speaking": "スピーチを終了", "Stop Speaking": "スピーチを終了",
"Switch to client 1.5": "Client 1.5 に切り替え",
"Switch to client 2.0": "Client 2.0 に切り替え", "Switch to client 2.0": "Client 2.0 に切り替え",
"Switch to client 2.0 daily": "Client 2.0 daily に切り替え", "Switch to client 2.0 daily": "Client 2.0 daily に切り替え",
"Symphony Help": "Symphonyのヘルプ", "Symphony Help": "Symphonyのヘルプ",

View File

@ -185,7 +185,6 @@
"Speech": "スピーチ", "Speech": "スピーチ",
"Start Speaking": "スピーチを開始", "Start Speaking": "スピーチを開始",
"Stop Speaking": "スピーチを終了", "Stop Speaking": "スピーチを終了",
"Switch to client 1.5": "Client 1.5 に切り替え",
"Switch to client 2.0": "Client 2.0 に切り替え", "Switch to client 2.0": "Client 2.0 に切り替え",
"Switch to client 2.0 daily": "Client 2.0 daily に切り替え", "Switch to client 2.0 daily": "Client 2.0 daily に切り替え",
"Symphony Help": "Symphonyのヘルプ", "Symphony Help": "Symphonyのヘルプ",