mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
feat: SDA-1973 (Expose notifications APIs for mana) (#998)
* SDA-1973 - Expose notifications APIs for mana * SDA-1973 - Calculate offset for all corners
This commit is contained in:
parent
401120dbea
commit
5983b090e2
@ -78,24 +78,30 @@ export default class NotificationHandler {
|
||||
}
|
||||
|
||||
const display = this.externalDisplay || electron.screen.getPrimaryDisplay();
|
||||
this.settings.corner.x = display.workArea.x - (isMac || isLinux ? 20 : 10);
|
||||
this.settings.corner.y = display.workArea.y + (isMac || isLinux ? 20 : 10);
|
||||
this.settings.corner.x = display.workArea.x;
|
||||
this.settings.corner.y = display.workArea.y;
|
||||
|
||||
// update corner x/y based on corner of screen where notification should appear
|
||||
const workAreaWidth = display.workAreaSize.width;
|
||||
const workAreaHeight = display.workAreaSize.height;
|
||||
const offSet = (isMac || isLinux ? 20 : 10);
|
||||
switch (this.settings.startCorner) {
|
||||
case 'upper-right':
|
||||
this.settings.corner.x += workAreaWidth;
|
||||
this.settings.corner.x += workAreaWidth - offSet;
|
||||
this.settings.corner.y += offSet;
|
||||
break;
|
||||
case 'lower-right':
|
||||
this.settings.corner.x += workAreaWidth;
|
||||
this.settings.corner.y += workAreaHeight;
|
||||
this.settings.corner.x += workAreaWidth - offSet;
|
||||
this.settings.corner.y += workAreaHeight - offSet;
|
||||
break;
|
||||
case 'lower-left':
|
||||
this.settings.corner.y += workAreaHeight;
|
||||
this.settings.corner.x += offSet;
|
||||
this.settings.corner.y += workAreaHeight - offSet;
|
||||
break;
|
||||
case 'upper-left':
|
||||
this.settings.corner.x += offSet;
|
||||
this.settings.corner.y += offSet;
|
||||
break;
|
||||
default:
|
||||
// no change needed
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { contextBridge, ipcRenderer, webFrame } from 'electron';
|
||||
import { contextBridge, ipcRenderer, remote, webFrame } from 'electron';
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import { apiCmds, apiName } from '../common/api-interface';
|
||||
@ -22,6 +22,7 @@ const minMemoryFetchInterval = 4 * 60 * 60 * 1000;
|
||||
const maxMemoryFetchInterval = 12 * 60 * 60 * 1000;
|
||||
const snackBar = new SnackBar();
|
||||
const banner = new MessageBanner();
|
||||
const notification = remote.require('../renderer/notification').notification;
|
||||
|
||||
/**
|
||||
* creates API exposed from electron.
|
||||
@ -81,6 +82,8 @@ if (ssfWindow.ssf) {
|
||||
registerRestartFloater: ssfWindow.ssf.registerRestartFloater,
|
||||
setCloudConfig: ssfWindow.ssf.setCloudConfig,
|
||||
checkMediaPermission: ssfWindow.ssf.checkMediaPermission,
|
||||
showNotification: notification.showNotification,
|
||||
closeNotification: notification.hideNotification,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user