mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
fix: Typescript (Fix issues with notification, menu & logger modules) (#682)
* Typescript - Fix issues with notification, menu & logger * Typescript - Update unit test case and fix logger circular import * Typescript - Fix the notification argument issue
This commit is contained in:
parent
36613e3023
commit
2bddbc56ec
@ -208,7 +208,7 @@
|
||||
color: color || 'white',
|
||||
sticky: shouldStick,
|
||||
data: {
|
||||
hello: 'hello word'
|
||||
hello: `Notification with id ${num} clicked')`
|
||||
},
|
||||
tag: tag,
|
||||
company: company,
|
||||
@ -219,7 +219,7 @@
|
||||
const ssfNotificationHandler = new window.ssf.Notification(notf.title, notf);
|
||||
const onclick = (event) => {
|
||||
event.target.close();
|
||||
alert('notification clicked: ' + event.target.data.title);
|
||||
alert('notification clicked: ' + event.target.data.hello);
|
||||
};
|
||||
ssfNotificationHandler.addEventListener('click', onclick);
|
||||
|
||||
|
@ -63,6 +63,7 @@ jest.mock('../src/app/window-handler', () => {
|
||||
return {
|
||||
windowHandler: {
|
||||
createMoreInfoWindow: jest.fn(),
|
||||
getMainWindow: jest.fn(),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@ -90,6 +90,15 @@ export class AppMenu {
|
||||
logger.info(`app-menu: built menu from the provided template`);
|
||||
Menu.setApplicationMenu(this.menu);
|
||||
logger.info(`app-menu: set application menu`);
|
||||
|
||||
// Remove the default menu for window
|
||||
// as we use custom popup menu
|
||||
if (isWindowsOS) {
|
||||
const mainWindow = windowHandler.getMainWindow();
|
||||
if (mainWindow && windowExists(mainWindow)) {
|
||||
mainWindow.setMenuBarVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,6 +129,7 @@ export const handleKeyPress = (key: number): void => {
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow();
|
||||
|
||||
if (focusedWindow && !focusedWindow.isDestroyed() && focusedWindow.isFullScreen()) {
|
||||
logger.info(`window-actions: exiting fullscreen by esc key action`);
|
||||
focusedWindow.setFullScreen(false);
|
||||
}
|
||||
break;
|
||||
@ -139,6 +140,7 @@ export const handleKeyPress = (key: number): void => {
|
||||
}
|
||||
const browserWin = BrowserWindow.getFocusedWindow();
|
||||
if (browserWin && !browserWin.isDestroyed()) {
|
||||
logger.info(`window-actions: popping up menu by alt key action`);
|
||||
showPopupMenu({ window: browserWin });
|
||||
}
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { app } from 'electron';
|
||||
import { app, BrowserWindow } from 'electron';
|
||||
import electronLog, { LogLevel, transports } from 'electron-log';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
@ -210,6 +210,10 @@ class Logger {
|
||||
}
|
||||
|
||||
if (this.loggerWindow) {
|
||||
const browserWindow = BrowserWindow.fromWebContents(this.loggerWindow);
|
||||
if (!(!!browserWindow && typeof browserWindow.isDestroyed === 'function' && !browserWindow.isDestroyed())) {
|
||||
return;
|
||||
}
|
||||
this.loggerWindow.send('log', { msgs: [ logMsg ], logLevel: this.desiredLogLevel, showInConsole: this.showInConsole });
|
||||
return;
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ export default class SSFNotificationHandler {
|
||||
constructor(title, options) {
|
||||
this.id = latestID;
|
||||
latestID++;
|
||||
this._data = { ...title, ...options };
|
||||
notification.showNotification(this._data, this.eventHandlers.onClick);
|
||||
notification.showNotification({ ...options, title, id: this.id }, this.eventHandlers.onClick);
|
||||
this._data = options.data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user