Introduce isPluginAvailable and selectPlugin

Summary:
Introduced API to replace the deprecated `selectPlugin` in Sandy.

The API can be used to navigate from `device plugin -> device plugin`, or` client plugin -> device / client plugin`

Introduced `isPluginAvailable` as well, so that the user interaction an be fine tuned in case the plugin is not disabled.

Reviewed By: jknoxville

Differential Revision: D25422370

fbshipit-source-id: c6c603f1c68e6291280b3d0883e474448754ded1
This commit is contained in:
Michel Weststrate
2020-12-09 14:34:46 -08:00
committed by Facebook GitHub Bot
parent 02a56da3f5
commit 52862f6083
9 changed files with 266 additions and 15 deletions

View File

@@ -8,7 +8,9 @@
*/
import {Logger} from '../utils/Logger';
import {RealFlipperDevice} from './DevicePlugin';
import {NormalizedMenuEntry} from './MenuEntry';
import {RealFlipperClient} from './Plugin';
/**
* This interface exposes all global methods for which an implementation will be provided by Flipper itself
@@ -18,4 +20,15 @@ export interface FlipperLib {
enableMenuEntries(menuEntries: NormalizedMenuEntry[]): void;
createPaste(input: string): Promise<string | undefined>;
GK(gatekeeper: string): boolean;
isPluginAvailable(
device: RealFlipperDevice,
client: RealFlipperClient | null,
pluginId: string,
): boolean;
selectPlugin(
device: RealFlipperDevice,
client: RealFlipperClient | null,
pluginId: string,
deeplink: unknown,
): void;
}