Add launcher prefetch setting

Summary: Allows users to override the GK status of prefetching. It is implemented as a Tri-State. "Unset" means that the local Flipper config won't take precedent over the GK setting and will leave it unchanged. If a user interacts with the setting, it gets persisted into the config and will from then-on override the GK, meaning that the user has an opt-in mechanism and if we open the GK to more people, they effectively have an opt-out.

Reviewed By: jknoxville

Differential Revision: D18008259

fbshipit-source-id: bdfde9a8b9acf43aa60c84800a7979a29a4e9364
This commit is contained in:
Pascal Hartig
2019-10-22 08:08:26 -07:00
committed by Facebook Github Bot
parent 836a065e59
commit 82a253cf28
4 changed files with 43 additions and 0 deletions

View File

@@ -9,9 +9,21 @@
import {Actions} from './index';
export enum Tristate {
True,
False,
Unset,
}
export type Settings = {
androidHome: string;
enableAndroid: 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;
};
export type Action =
@@ -24,6 +36,7 @@ export type Action =
const initialState: Settings = {
androidHome: '/opt/android_sdk',
enableAndroid: true,
enablePrefetching: Tristate.Unset,
};
export default function reducer(