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:
committed by
Facebook Github Bot
parent
2ee9778a8e
commit
abb2dc72ee
@@ -12,7 +12,7 @@ import {Logger} from '../fb-interfaces/Logger';
|
|||||||
import {PluginNotification} from '../reducers/notifications';
|
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 {setStaticView} from '../reducers/connections';
|
import {setStaticView, setDeeplinkPayload} from '../reducers/connections';
|
||||||
import {ipcRenderer, IpcRendererEvent} from 'electron';
|
import {ipcRenderer, IpcRendererEvent} from 'electron';
|
||||||
import {
|
import {
|
||||||
setActiveNotifications,
|
setActiveNotifications,
|
||||||
@@ -41,12 +41,14 @@ export default (store: Store, logger: Logger) => {
|
|||||||
'notificationEvent',
|
'notificationEvent',
|
||||||
(
|
(
|
||||||
_event: IpcRendererEvent,
|
_event: IpcRendererEvent,
|
||||||
_e: Error,
|
|
||||||
eventName: NotificationEvents,
|
eventName: NotificationEvents,
|
||||||
pluginNotification: PluginNotification,
|
pluginNotification: PluginNotification,
|
||||||
arg: null | string | number,
|
arg: null | string | number,
|
||||||
) => {
|
) => {
|
||||||
if (eventName === 'click' || (eventName === 'action' && arg === 0)) {
|
if (eventName === 'click' || (eventName === 'action' && arg === 0)) {
|
||||||
|
store.dispatch(
|
||||||
|
setDeeplinkPayload(pluginNotification.notification.action ?? null),
|
||||||
|
);
|
||||||
store.dispatch(setStaticView(NotificationScreen));
|
store.dispatch(setStaticView(NotificationScreen));
|
||||||
} else if (eventName === 'action') {
|
} else if (eventName === 'action') {
|
||||||
if (arg === 1 && pluginNotification.notification.category) {
|
if (arg === 1 && pluginNotification.notification.category) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export type State = {
|
|||||||
deviceId?: string;
|
deviceId?: string;
|
||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
}>;
|
}>;
|
||||||
deepLinkPayload: null | string;
|
deepLinkPayload: string | null;
|
||||||
staticView: StaticView;
|
staticView: StaticView;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -143,6 +143,10 @@ export type Action =
|
|||||||
type: 'SELECT_CLIENT';
|
type: 'SELECT_CLIENT';
|
||||||
payload: string;
|
payload: string;
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
type: 'SET_DEEPLINK_PAYLOAD';
|
||||||
|
payload: null | string;
|
||||||
|
}
|
||||||
| RegisterPluginAction;
|
| RegisterPluginAction;
|
||||||
|
|
||||||
const DEFAULT_PLUGIN = 'DeviceLogs';
|
const DEFAULT_PLUGIN = 'DeviceLogs';
|
||||||
@@ -382,7 +386,9 @@ const reducer = (state: State = INITAL_STATE, action: Actions): State => {
|
|||||||
errors,
|
errors,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case 'SET_DEEPLINK_PAYLOAD': {
|
||||||
|
return {...state, deepLinkPayload: action.payload};
|
||||||
|
}
|
||||||
case 'REGISTER_PLUGINS': {
|
case 'REGISTER_PLUGINS': {
|
||||||
// plugins are registered after creating the base devices, so update them
|
// plugins are registered after creating the base devices, so update them
|
||||||
const plugins = action.payload;
|
const plugins = action.payload;
|
||||||
@@ -499,6 +505,11 @@ export const selectClient = (clientId: string): Action => ({
|
|||||||
payload: clientId,
|
payload: clientId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const setDeeplinkPayload = (payload: string | null): Action => ({
|
||||||
|
type: 'SET_DEEPLINK_PAYLOAD',
|
||||||
|
payload,
|
||||||
|
});
|
||||||
|
|
||||||
export function getAvailableClients(
|
export function getAvailableClients(
|
||||||
device: null | undefined | BaseDevice,
|
device: null | undefined | BaseDevice,
|
||||||
clients: Client[],
|
clients: Client[],
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ const Searchable = (
|
|||||||
prevProps.defaultSearchTerm !== this.props.defaultSearchTerm ||
|
prevProps.defaultSearchTerm !== this.props.defaultSearchTerm ||
|
||||||
prevProps.defaultFilters !== this.props.defaultFilters
|
prevProps.defaultFilters !== this.props.defaultFilters
|
||||||
) {
|
) {
|
||||||
newSearchTerm = this.props.defaultSearchTerm;
|
newSearchTerm = this.props.defaultSearchTerm ?? '';
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
filters: mergedFilters,
|
filters: mergedFilters,
|
||||||
|
|||||||
Reference in New Issue
Block a user