Convert to Shared Preference Plugin to Sandy

Summary:
per title

In addition, this diff adds `startUnactivated` option to allow setting up `onSend` mock implementation.

Reviewed By: mweststrate

Differential Revision: D24477989

fbshipit-source-id: f913574ebacdd436e8511baa43744249a014e90b
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-10-23 06:20:14 -07:00
committed by Facebook GitHub Bot
parent 467a6b16fb
commit 402ea2fc14
5 changed files with 399 additions and 293 deletions

View File

@@ -43,6 +43,7 @@ interface StartPluginOptions {
initialState?: Record<string, any>;
isArchived?: boolean;
isBackgroundPlugin?: boolean;
startUnactivated?: boolean;
/** Provide a set of unsupported methods to simulate older clients that don't support certain methods yet */
unsupportedMethods?: string[];
}
@@ -235,7 +236,9 @@ export function startPlugin<Module extends FlipperPluginModule<any>>(
if (options?.isBackgroundPlugin) {
pluginInstance.connect(); // otherwise part of activate
}
pluginInstance.activate();
if (!options?.startUnactivated) {
pluginInstance.activate();
}
return res;
}