Fix clicking on native notification

Reviewed By: passy

Differential Revision: D18831700

fbshipit-source-id: 4cdaed3893fc6162a16ac2c1a8a9ee2ef1a0805c
This commit is contained in:
John Knox
2019-12-06 07:25:55 -08:00
committed by Facebook Github Bot
parent 0c7b03cad3
commit 8e0a4a5e42

View File

@@ -13,7 +13,7 @@ import {PluginNotification} from '../reducers/notifications';
import {FlipperPlugin, FlipperDevicePlugin} from '../plugin'; import {FlipperPlugin, FlipperDevicePlugin} from '../plugin';
import isHeadless from '../utils/isHeadless'; import isHeadless from '../utils/isHeadless';
import {ipcRenderer} from 'electron'; import {ipcRenderer} from 'electron';
import {selectPlugin} from '../reducers/connections'; import {setStaticView} from '../reducers/connections';
import { import {
setActiveNotifications, setActiveNotifications,
updatePluginBlacklist, updatePluginBlacklist,
@@ -22,6 +22,7 @@ import {
import {textContent} from '../utils/index'; import {textContent} from '../utils/index';
import GK from '../fb-stubs/GK'; import GK from '../fb-stubs/GK';
import {deconstructPluginKey} from '../utils/clientUtils'; import {deconstructPluginKey} from '../utils/clientUtils';
import NotificationScreen from '../chrome/NotificationScreen';
type NotificationEvents = 'show' | 'click' | 'close' | 'reply' | 'action'; type NotificationEvents = 'show' | 'click' | 'close' | 'reply' | 'action';
const NOTIFICATION_THROTTLE = 5 * 1000; // in milliseconds const NOTIFICATION_THROTTLE = 5 * 1000; // in milliseconds
@@ -44,13 +45,7 @@ export default (store: Store, logger: Logger) => {
arg: null | string | number, arg: null | string | number,
) => { ) => {
if (eventName === 'click' || (eventName === 'action' && arg === 0)) { if (eventName === 'click' || (eventName === 'action' && arg === 0)) {
store.dispatch( store.dispatch(setStaticView(NotificationScreen));
selectPlugin({
selectedPlugin: 'notifications',
selectedApp: null,
deepLinkPayload: pluginNotification.notification.id,
}),
);
} else if (eventName === 'action') { } else if (eventName === 'action') {
if (arg === 1 && pluginNotification.notification.category) { if (arg === 1 && pluginNotification.notification.category) {
// Hide similar (category) // Hide similar (category)