Enable search on layout2 for archived devices

Summary:
Enables search on the imported layout data. The way search is implemented is that the Flipper app asks for the search results from the mobile clients. Since mobile client will not exist in the archived case, the search won't work. To solve this problem I added a proxy client which will get all the messages fired by the Layout Inspector and it will accordingly revert back with the responses. In the case of search, it will give back the search result tree for a particular query.

Also added extensive tests for the proxy client

Reviewed By: danielbuechele

Differential Revision: D14281856

fbshipit-source-id: 651436084ebacd57f86e4fe9bb2036e7f666880c
This commit is contained in:
Pritesh Nandgaonkar
2019-03-08 10:15:59 -08:00
committed by Facebook Github Bot
parent 44b7d4c6c3
commit b65581262a
9 changed files with 633 additions and 21 deletions

View File

@@ -28,12 +28,16 @@ export function callClient(
return (method, params) => client.call(id, method, false, params);
}
export type PluginClient = {|
send: (method: string, params?: Object) => void,
call: (method: string, params?: Object) => Promise<any>,
subscribe: (method: string, callback: (params: any) => void) => void,
supportsMethod: (method: string) => Promise<boolean>,
|};
export interface PluginClient {
// eslint-disable-next-line
send(method: string, params?: Object): void;
// eslint-disable-next-line
call(method: string, params?: Object): Promise<any>;
// eslint-disable-next-line
subscribe(method: string, callback: (params: any) => void): void;
// eslint-disable-next-line
supportsMethod(method: string): Promise<boolean>;
}
type PluginTarget = BaseDevice | Client;
@@ -54,6 +58,7 @@ export type Props<T> = {
target: PluginTarget,
deepLinkPayload: ?string,
selectPlugin: (pluginID: string, deepLinkPayload: ?string) => boolean,
isArchivedDevice: boolean,
};
export class FlipperBasePlugin<