Support handling deeplinks in plugins
Summary:
This adds support for handling incoming deeplinks in a Sandy plugin, which can be done by using a `client.onDeepLink(deepLink => { } )` listener
Also generalized deeplinks to not just support strings, but also richer objects, which is beneficial to plugin to plugin linking.
Reviewed By: jknoxville
Differential Revision: D22524749
fbshipit-source-id: 2cbe8d52f6eac91a1c1c8c8494706952920b9181
This commit is contained in:
committed by
Facebook GitHub Bot
parent
485b4c9827
commit
f0c54667e0
@@ -242,9 +242,10 @@ export default class LayoutPlugin extends FlipperPlugin<
|
||||
|
||||
this.setState({
|
||||
init: true,
|
||||
selectedElement: this.props.deepLinkPayload
|
||||
? this.props.deepLinkPayload
|
||||
: null,
|
||||
selectedElement:
|
||||
typeof this.props.deepLinkPayload === 'string'
|
||||
? this.props.deepLinkPayload
|
||||
: null,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -458,7 +459,11 @@ export default class LayoutPlugin extends FlipperPlugin<
|
||||
this.setState({searchResults})
|
||||
}
|
||||
inAXMode={this.state.inAXMode}
|
||||
initialQuery={this.props.deepLinkPayload}
|
||||
initialQuery={
|
||||
typeof this.props.deepLinkPayload === 'string'
|
||||
? this.props.deepLinkPayload
|
||||
: null
|
||||
}
|
||||
/>
|
||||
</Toolbar>
|
||||
<Layout.Right>
|
||||
|
||||
@@ -438,11 +438,11 @@ export default class LogTable extends FlipperDevicePlugin<
|
||||
};
|
||||
|
||||
calculateHighlightedRows = (
|
||||
deepLinkPayload: string | null,
|
||||
deepLinkPayload: unknown,
|
||||
rows: ReadonlyArray<TableBodyRow>,
|
||||
): Set<string> => {
|
||||
const highlightedRows = new Set<string>();
|
||||
if (!deepLinkPayload) {
|
||||
if (typeof deepLinkPayload !== 'string') {
|
||||
return highlightedRows;
|
||||
}
|
||||
|
||||
|
||||
@@ -273,10 +273,10 @@ export default class extends FlipperPlugin<State, any, PersistedState> {
|
||||
};
|
||||
|
||||
parseDeepLinkPayload = (
|
||||
deepLinkPayload: string | null,
|
||||
deepLinkPayload: unknown,
|
||||
): Pick<State, 'selectedIds' | 'searchTerm'> => {
|
||||
const searchTermDelim = 'searchTerm=';
|
||||
if (deepLinkPayload === null) {
|
||||
if (typeof deepLinkPayload !== 'string') {
|
||||
return {
|
||||
selectedIds: [],
|
||||
searchTerm: '',
|
||||
|
||||
Reference in New Issue
Block a user