Fix notification handling
Summary: Changelog: Fixed application crash notifications not opening the crash log Crashlog notifications were quite blatantly broken: 1. Because I force all GK's to true locally during testing, and the feature gate is negative, I never had any crash reports in the first place. The GK was empty so removed it. 2. The notifications overview would always cause a NPE when the notification came from a device plugin (it assumed a client to be present). This made the button do nothing and the device name not show up near the notification 3. The OS level notifications would link to the notification screen, which was a static screen in the classic UI and would always render to an empty page in Sandy. Removed that screen from the code base. Instead the click the notification will now trigger the notification action. Reviewed By: passy Differential Revision: D28119719 fbshipit-source-id: 5b28dd854260fd479d09e3ee6206301cc669ab40
This commit is contained in:
committed by
Facebook GitHub Bot
parent
be3cdedf52
commit
c0633652e8
@@ -11,7 +11,6 @@ import {Store} from '../reducers/index';
|
||||
import {Logger} from '../fb-interfaces/Logger';
|
||||
import {PluginNotification} from '../reducers/notifications';
|
||||
import {PluginDefinition} from '../plugin';
|
||||
import {setStaticView} from '../reducers/connections';
|
||||
import {ipcRenderer, IpcRendererEvent} from 'electron';
|
||||
import {
|
||||
setActiveNotifications,
|
||||
@@ -19,20 +18,15 @@ import {
|
||||
updateCategoryBlocklist,
|
||||
} from '../reducers/notifications';
|
||||
import {textContent} from '../utils/index';
|
||||
import GK from '../fb-stubs/GK';
|
||||
import {deconstructPluginKey} from '../utils/clientUtils';
|
||||
import NotificationScreen from '../chrome/NotificationScreen';
|
||||
import {getPluginTitle, isSandyPlugin} from '../utils/pluginUtils';
|
||||
import {sideEffect} from '../utils/sideEffect';
|
||||
import {openNotification} from '../sandy-chrome/notification/Notification';
|
||||
|
||||
type NotificationEvents = 'show' | 'click' | 'close' | 'reply' | 'action';
|
||||
const NOTIFICATION_THROTTLE = 5 * 1000; // in milliseconds
|
||||
|
||||
export default (store: Store, logger: Logger) => {
|
||||
if (GK.get('flipper_disable_notifications')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const knownNotifications: Set<string> = new Set();
|
||||
const knownPluginStates: Map<string, Object> = new Map();
|
||||
const lastNotificationTime: Map<string, number> = new Map();
|
||||
@@ -46,12 +40,7 @@ export default (store: Store, logger: Logger) => {
|
||||
arg: null | string | number,
|
||||
) => {
|
||||
if (eventName === 'click' || (eventName === 'action' && arg === 0)) {
|
||||
store.dispatch(
|
||||
setStaticView(
|
||||
NotificationScreen,
|
||||
pluginNotification.notification.action ?? null,
|
||||
),
|
||||
);
|
||||
openNotification(store, pluginNotification);
|
||||
} else if (eventName === 'action') {
|
||||
if (arg === 1 && pluginNotification.notification.category) {
|
||||
// Hide similar (category)
|
||||
@@ -114,7 +103,6 @@ export default (store: Store, logger: Logger) => {
|
||||
const persistingPlugin: undefined | PluginDefinition = getPlugin(
|
||||
pluginName,
|
||||
);
|
||||
// TODO: add support for Sandy plugins T68683442
|
||||
if (
|
||||
persistingPlugin &&
|
||||
!isSandyPlugin(persistingPlugin) &&
|
||||
|
||||
Reference in New Issue
Block a user