Allow "uninstallation" of bundled plugins
Summary: Allow "uninstallation" of bundled plugins which means we mark them as uninstalled and not auto-updating anymore. Uninstalled bundled plugins are shown in "Detected in App" section together with Marketplace plugins where user can install them back. Changelog: Plugins can be uninstalled from sidebar in new Sandy UI. Reviewed By: passy Differential Revision: D25557789 fbshipit-source-id: 751cad68456313c069af639584541086efc7102b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
756edf9860
commit
3d6afdb529
@@ -11,6 +11,7 @@ import {DevicePluginMap, ClientPluginMap, PluginDefinition} from '../plugin';
|
||||
import {
|
||||
DownloadablePluginDetails,
|
||||
ActivatablePluginDetails,
|
||||
BundledPluginDetails,
|
||||
} from 'flipper-plugin-lib';
|
||||
import {Actions} from '.';
|
||||
import produce from 'immer';
|
||||
@@ -20,6 +21,7 @@ export type State = {
|
||||
devicePlugins: DevicePluginMap;
|
||||
clientPlugins: ClientPluginMap;
|
||||
loadedPlugins: Map<string, ActivatablePluginDetails>;
|
||||
bundledPlugins: Map<string, BundledPluginDetails>;
|
||||
gatekeepedPlugins: Array<ActivatablePluginDetails>;
|
||||
disabledPlugins: Array<ActivatablePluginDetails>;
|
||||
failedPlugins: Array<[ActivatablePluginDetails, string]>;
|
||||
@@ -57,12 +59,17 @@ export type Action =
|
||||
| {
|
||||
type: 'REGISTER_LOADED_PLUGINS';
|
||||
payload: Array<ActivatablePluginDetails>;
|
||||
}
|
||||
| {
|
||||
type: 'REGISTER_BUNDLED_PLUGINS';
|
||||
payload: Array<BundledPluginDetails>;
|
||||
};
|
||||
|
||||
const INITIAL_STATE: State = {
|
||||
devicePlugins: new Map(),
|
||||
clientPlugins: new Map(),
|
||||
loadedPlugins: new Map(),
|
||||
bundledPlugins: new Map(),
|
||||
gatekeepedPlugins: [],
|
||||
disabledPlugins: [],
|
||||
failedPlugins: [],
|
||||
@@ -119,6 +126,11 @@ export default function reducer(
|
||||
...state,
|
||||
loadedPlugins: new Map(action.payload.map((p) => [p.id, p])),
|
||||
};
|
||||
} else if (action.type === 'REGISTER_BUNDLED_PLUGINS') {
|
||||
return {
|
||||
...state,
|
||||
bundledPlugins: new Map(action.payload.map((p) => [p.id, p])),
|
||||
};
|
||||
} else {
|
||||
return state;
|
||||
}
|
||||
@@ -168,3 +180,10 @@ export const registerLoadedPlugins = (
|
||||
type: 'REGISTER_LOADED_PLUGINS',
|
||||
payload,
|
||||
});
|
||||
|
||||
export const registerBundledPlugins = (
|
||||
payload: Array<BundledPluginDetails>,
|
||||
): Action => ({
|
||||
type: 'REGISTER_BUNDLED_PLUGINS',
|
||||
payload,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user