Move settings, launcherSettings, GKs to app / flipper-server-core

Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).

This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.

Reviewed By: passy, aigoncharov

Differential Revision: D32498649

fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent eed19b3a3d
commit bca169df73
71 changed files with 844 additions and 830 deletions

View File

@@ -0,0 +1,70 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export enum Tristate {
True,
False,
Unset,
}
/** Settings used by both Server and UI.
* TODO: some settings might be flipper environment specific,
* and should ideally bemoved to local storage, like 'darkMode'
*/
export type Settings = {
androidHome: string;
enableAndroid: boolean;
enableIOS: boolean;
enablePhysicalIOS: boolean;
/**
* If unset, this will assume the value of the GK setting.
* Note that this setting has no effect in the open source version
* of Flipper.
*/
enablePrefetching: Tristate;
idbPath: string;
reactNative: {
shortcuts: {
enabled: boolean;
reload: string;
openDevMenu: string;
};
};
darkMode: 'dark' | 'light' | 'system';
showWelcomeAtStartup: boolean;
suppressPluginErrors: boolean;
};
export enum ReleaseChannel {
DEFAULT = 'default',
STABLE = 'stable',
INSIDERS = 'insiders',
}
/** Launcher settings only apply to Electron, and aren't managed or relevant for flipper-server-core */
export type LauncherSettings = {
releaseChannel: ReleaseChannel;
ignoreLocalPin: boolean;
};
// Settings that primarily only apply to Eelectron atm
// TODO: further separte between flipper-ui config and Electron config
export type ProcessConfig = {
disabledPlugins: Set<string>;
lastWindowPosition: {
x: number;
y: number;
width: number;
height: number;
} | null;
screenCapturePath: string | null;
launcherMsg: string | null;
// Controls whether to delegate to the launcher if present.
launcherEnabled: boolean;
};