SDA-2091 - Only pass required data via IPC (#1003)

This commit is contained in:
Kiran Niranjan 2020-05-26 14:06:00 +05:30 committed by GitHub
parent d382d46ea1
commit b7bafe932f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View File

@ -119,8 +119,9 @@ type Theme = '' | 'light' | 'dark';
export interface INotificationData { export interface INotificationData {
id: number; id: number;
title: string; title: string;
text: string; body: string;
image: string; image: string;
icon: string;
flash: boolean; flash: boolean;
color: string; color: string;
tag: string; tag: string;

View File

@ -320,6 +320,9 @@
alert('error=' + event.result); alert('error=' + event.result);
}; };
ssfNotificationHandler.addEventListener('error', onerror); ssfNotificationHandler.addEventListener('error', onerror);
} else if (window.manaSSF) {
const callback = () => { console.log('notification clicked') };
window.manaSSF.showNotification(notf, callback);
} else { } else {
window.postMessage({ method: 'notification', data: notf }, '*'); window.postMessage({ method: 'notification', data: notf }, '*');
} }

View File

@ -192,7 +192,31 @@ class Notification extends NotificationHandler {
notificationWindow.displayTimer = timeoutId; notificationWindow.displayTimer = timeoutId;
} }
notificationWindow.webContents.send('notification-data', data); const {
title,
company,
body,
image,
icon,
id,
color,
flash,
isExternal,
theme,
} = data;
notificationWindow.webContents.send('notification-data', {
title,
company,
body,
image,
icon,
id,
color,
flash,
isExternal,
theme,
});
notificationWindow.showInactive(); notificationWindow.showInactive();
} }