From c45724a767f092938a5827a8fa7895fffc5477e1 Mon Sep 17 00:00:00 2001 From: Benjamin Elo Date: Mon, 5 Aug 2019 03:49:24 -0700 Subject: [PATCH] Pass selectedApp as prop to FlipperPlugin Summary: I have found it neccessary to get the current app name for the Navigation plugin. This passes the current selectedApp as a prop into any FlipperPlugin. Reviewed By: jknoxville Differential Revision: D16645855 fbshipit-source-id: 996d41b1a0e939427e66fa0df172ce1a6471f686 --- src/PluginContainer.js | 5 ++++- src/plugin.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PluginContainer.js b/src/PluginContainer.js index ae06f88dc..b47ba23b9 100644 --- a/src/PluginContainer.js +++ b/src/PluginContainer.js @@ -50,7 +50,7 @@ type Props = {| target: Client | BaseDevice | null, pluginKey: ?string, deepLinkPayload: ?string, - + selectedApp: ?string, selectPlugin: (payload: {| selectedPlugin: ?string, selectedApp?: ?string, @@ -94,6 +94,7 @@ class PluginContainer extends PureComponent { pluginKey, target, isArchivedDevice, + selectedApp, } = this.props; if (!activePlugin || !target || !pluginKey) { console.warn(`No selected plugin. Rendering empty!`); @@ -102,6 +103,7 @@ class PluginContainer extends PureComponent { const props: PluginProps = { key: pluginKey, logger: this.props.logger, + selectedApp, persistedState: activePlugin.defaultPersistedState ? { ...activePlugin.defaultPersistedState, @@ -190,6 +192,7 @@ export default connect( deepLinkPayload, pluginKey, isArchivedDevice, + selectedApp, }; }, { diff --git a/src/plugin.js b/src/plugin.js index e640827d5..f2ce72eff 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -59,6 +59,7 @@ export type Props = { deepLinkPayload: ?string, selectPlugin: (pluginID: string, deepLinkPayload: ?string) => boolean, isArchivedDevice: boolean, + selectedApp: ?string, }; export class FlipperBasePlugin<