mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -06:00
Merge branch 'master' into sda-2947
This commit is contained in:
commit
bce80e940c
@ -1,7 +1,8 @@
|
||||
export interface IAnalyticsData {
|
||||
element: AnalyticsElements;
|
||||
action_type?: MenuActionTypes | ScreenSnippetActionTypes;
|
||||
action_type?: MenuActionTypes | ScreenSnippetActionTypes | ToastNotificationActionTypes;
|
||||
action_result?: AnalyticsActions;
|
||||
extra_data?: object;
|
||||
}
|
||||
|
||||
export interface ICrashData extends IAnalyticsData {
|
||||
@ -29,6 +30,10 @@ export enum ScreenSnippetActionTypes {
|
||||
ANNOTATE_ERASED = 'annotate_erased',
|
||||
}
|
||||
|
||||
export enum ToastNotificationActionTypes {
|
||||
TOAST_CLOSED = 'toast_closed',
|
||||
}
|
||||
|
||||
export enum AnalyticsActions {
|
||||
ENABLED = 'ON',
|
||||
DISABLED = 'OFF',
|
||||
@ -37,6 +42,7 @@ export enum AnalyticsActions {
|
||||
export enum AnalyticsElements {
|
||||
MENU = 'Menu',
|
||||
SCREEN_CAPTURE_ANNOTATE = 'screen_capture_annotate',
|
||||
TOAST_NOTIFICATION = 'toast_notification',
|
||||
SDA_CRASH = 'sda_crash',
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsElements,
|
||||
ToastNotificationActionTypes,
|
||||
} from '../app/analytics-handler';
|
||||
import { config } from '../app/config-handler';
|
||||
import { createComponentWindow, windowExists } from '../app/window-utils';
|
||||
import { AnimationQueue } from '../common/animation-queue';
|
||||
@ -73,6 +78,19 @@ class Notification extends NotificationHandler {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
ipcMain.on('close-notification', (_event, windowId) => {
|
||||
const browserWindow = this.getNotificationWindow(windowId);
|
||||
if (
|
||||
browserWindow &&
|
||||
windowExists(browserWindow) &&
|
||||
browserWindow.notificationData
|
||||
) {
|
||||
const notificationData = (browserWindow.notificationData as any).data;
|
||||
analytics.track({
|
||||
element: AnalyticsElements.TOAST_NOTIFICATION,
|
||||
action_type: ToastNotificationActionTypes.TOAST_CLOSED,
|
||||
extra_data: notificationData || {},
|
||||
});
|
||||
}
|
||||
// removes the event listeners on the client side
|
||||
this.notificationClosed(windowId);
|
||||
this.hideNotification(windowId);
|
||||
|
Loading…
Reference in New Issue
Block a user