Auto-enable plugins for new users

Summary:
This is a very simple implementation of "profiles". It allows defining sets of plugins and associate them with GKs. Plugins from sets are automatically installed and enabled when a mobile app connected to Flipper for the first time (e.g. user has not already debugged same app before). Set is only enabled if user is passing the associated GK.
Sets are simply hardcoded for now.

Reviewed By: timur-valiev

Differential Revision: D26605371

fbshipit-source-id: 9bf0600d44381e047361d960558aa004960550c1
This commit is contained in:
Anton Nikolaev
2021-02-24 05:28:25 -08:00
committed by Facebook GitHub Bot
parent b2c5e73e24
commit e9bab76614
2 changed files with 27 additions and 36 deletions

View File

@@ -215,12 +215,12 @@ function starClientPlugin(
);
store.dispatch(clearMessageQueue(pluginKey));
});
store.dispatch(pluginUnstarred(plugin, selectedApp));
store.dispatch(pluginUnstarred(plugin.id, selectedApp));
} else {
clients.forEach((client) => {
startPlugin(client, plugin);
});
store.dispatch(pluginStarred(plugin, selectedApp));
store.dispatch(pluginStarred(plugin.id, selectedApp));
}
}
@@ -233,12 +233,12 @@ function starDevicePlugin(store: Store, plugin: DevicePluginDefinition) {
devicesWithPlugin.forEach((d) => {
d.unloadDevicePlugin(plugin.id);
});
store.dispatch(devicePluginUnstarred(plugin));
store.dispatch(devicePluginUnstarred(plugin.id));
} else {
devicesWithPlugin.forEach((d) => {
d.loadDevicePlugin(plugin);
});
store.dispatch(devicePluginStarred(plugin));
store.dispatch(devicePluginStarred(plugin.id));
}
}
@@ -251,7 +251,7 @@ function updateClientPlugin(
if (enable) {
const selectedApp = getSelectedAppId(store);
if (selectedApp) {
store.dispatch(pluginStarred(plugin, selectedApp));
store.dispatch(pluginStarred(plugin.id, selectedApp));
}
}
const clientsWithEnabledPlugin = clients.filter((c) => {
@@ -283,7 +283,7 @@ function updateDevicePlugin(
enable: boolean,
) {
if (enable) {
store.dispatch(devicePluginStarred(plugin));
store.dispatch(devicePluginStarred(plugin.id));
}
const connections = store.getState().connections;
const devicesWithEnabledPlugin = connections.devices.filter((d) =>