Restore computeNotifications

Summary:
Restore the logic for setting and computing notifications that was
partially removed with D10300838.

Reviewed By: jknoxville

Differential Revision: D10361547

fbshipit-source-id: 4d229d5f4dbeda3139463e1c348909b9c5dba66f
This commit is contained in:
Pascal Hartig
2018-10-13 04:16:12 -07:00
committed by Facebook Github Bot
parent 4889f5dc6a
commit 01020edbf2
4 changed files with 37 additions and 17 deletions

View File

@@ -11,6 +11,7 @@ import type BaseDevice from './devices/BaseDevice.js';
import type {Props as PluginProps} from './plugin';
import {FlipperDevicePlugin} from './plugin.js';
import type {Notification} from './plugin.js';
import {
ErrorBoundary,
Component,
@@ -52,6 +53,10 @@ type Props = {
pluginKey: string,
state: Object,
}) => void,
setActiveNotifications: ({
pluginId: string,
notifications: Array<Notification>,
}) => void,
deepLinkPayload: ?string,
};
@@ -125,7 +130,7 @@ class PluginContainer extends Component<Props, State> {
};
render() {
const {pluginStates, setPluginState} = this.props;
const {pluginStates, setPluginState, setActiveNotifications} = this.props;
const {activePlugin, pluginKey, target} = this.state;
if (!activePlugin || !target) {
@@ -143,6 +148,11 @@ class PluginContainer extends Component<Props, State> {
// same time.
setTimeout(() => setPluginState({pluginKey, state}), 0);
},
setActiveNotifications: (notifications: Array<Notification>) =>
setActiveNotifications({
pluginId: pluginKey,
notifications: notifications,
}),
target,
deepLinkPayload: this.props.deepLinkPayload,
ref: this.refChanged,