From ae0aef52dd2b7c8a8450c814d09723078b1d50bf Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 1 Aug 2023 13:33:04 -0700 Subject: [PATCH] Notifications: Put actions inside onclick handler --- ts/services/notifications.ts | 51 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/ts/services/notifications.ts b/ts/services/notifications.ts index 48269036a5..d4b96c168a 100644 --- a/ts/services/notifications.ts +++ b/ts/services/notifications.ts @@ -199,30 +199,33 @@ class NotificationService extends EventEmitter { tag: messageId, }); - // Note: this maps to the xmlTemplate() function in app/WindowsNotifications.ts - if ( - type === NotificationType.Message || - type === NotificationType.Reaction - ) { - window.IPC.showWindow(); - window.Events.showConversationViaNotification({ - conversationId, - messageId, - storyId, - }); - } else if (type === NotificationType.IncomingGroupCall) { - window.IPC.showWindow(); - window.reduxActions?.calling?.startCallingLobby({ - conversationId, - isVideoCall: true, - }); - } else if (type === NotificationType.IsPresenting) { - window.reduxActions?.calling?.setPresenting(); - } else if (type === NotificationType.IncomingCall) { - window.IPC.showWindow(); - } else { - throw missingCaseError(type); - } + notification.onclick = () => { + // Note: this maps to the xmlTemplate() function in app/WindowsNotifications.ts + if ( + type === NotificationType.Message || + type === NotificationType.Reaction + ) { + window.IPC.showWindow(); + window.Events.showConversationViaNotification({ + conversationId, + messageId, + storyId, + }); + } else if (type === NotificationType.IncomingGroupCall) { + window.IPC.showWindow(); + window.reduxActions?.calling?.startCallingLobby({ + conversationId, + isVideoCall: true, + }); + } else if (type === NotificationType.IsPresenting) { + window.reduxActions?.calling?.setPresenting(); + } else if (type === NotificationType.IncomingCall) { + window.IPC.showWindow(); + } else { + throw missingCaseError(type); + } + }; + this.lastNotification = notification; }