Fix the broken notification click

Summary:
This diff fixes the broken deeplink to the notifications hub when one clicks on the macos native notification. See the bug reported [here](https://fb.workplace.com/groups/220760072184928/permalink/532998544294411/)

This [post](https://fb.workplace.com/groups/220760072184928/permalink/532998544294411/) reports the bug.

Reviewed By: passy

Differential Revision: D20089749

fbshipit-source-id: 8061ae07c450fd674795af4c5be53ce77402c063
This commit is contained in:
Pritesh Nandgaonkar
2020-02-25 08:08:12 -08:00
committed by Facebook Github Bot
parent 2ee9778a8e
commit abb2dc72ee
3 changed files with 18 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ import {Logger} from '../fb-interfaces/Logger';
import {PluginNotification} from '../reducers/notifications';
import {FlipperPlugin, FlipperDevicePlugin} from '../plugin';
import isHeadless from '../utils/isHeadless';
import {setStaticView} from '../reducers/connections';
import {setStaticView, setDeeplinkPayload} from '../reducers/connections';
import {ipcRenderer, IpcRendererEvent} from 'electron';
import {
setActiveNotifications,
@@ -41,12 +41,14 @@ export default (store: Store, logger: Logger) => {
'notificationEvent',
(
_event: IpcRendererEvent,
_e: Error,
eventName: NotificationEvents,
pluginNotification: PluginNotification,
arg: null | string | number,
) => {
if (eventName === 'click' || (eventName === 'action' && arg === 0)) {
store.dispatch(
setDeeplinkPayload(pluginNotification.notification.action ?? null),
);
store.dispatch(setStaticView(NotificationScreen));
} else if (eventName === 'action') {
if (arg === 1 && pluginNotification.notification.category) {