Enable Sandy by default if part of GK

Summary:
Inverted the condition of checking if Sandy is enabled, so by default it is enabled if user is part of the GK.

This will make it more frictionless for people joining the dogfooding group and increases the chances we receive feedback :)

Reviewed By: jknoxville

Differential Revision: D24830075

fbshipit-source-id: d20dacd9e6c2dd2387a94b8a972252f29d0dab0e
This commit is contained in:
Michel Weststrate
2020-11-09 08:22:43 -08:00
committed by Facebook GitHub Bot
parent 29e3d80669
commit c02d5341f9
4 changed files with 12 additions and 8 deletions

View File

@@ -133,7 +133,7 @@ class SettingsSheet extends Component<Props, State> {
enablePrefetching,
idbPath,
reactNative,
enableSandy,
disableSandy,
darkMode,
} = this.state.updatedSettings;
const {useSandy} = this.props;
@@ -234,17 +234,17 @@ class SettingsSheet extends Component<Props, State> {
}}
/>
<SandySettingsPanel
toggled={this.state.updatedSettings.enableSandy}
toggled={this.state.updatedSettings.disableSandy}
onChange={(v) => {
this.setState({
updatedSettings: {
...this.state.updatedSettings,
enableSandy: v,
disableSandy: v,
},
});
}}
/>
{enableSandy && (
{!disableSandy && (
<ToggledSection
label="Enable dark theme"
toggled={darkMode}

View File

@@ -103,7 +103,7 @@ function init() {
store,
{name: 'loadTheme', fireImmediately: true, throttleMs: 500},
(state) => ({
sandy: state.settingsState.enableSandy,
sandy: GK.get('flipper_sandy') && !state.settingsState.disableSandy,
dark: state.settingsState.darkMode,
}),
(theme) => {

View File

@@ -43,7 +43,7 @@ export type Settings = {
openDevMenu: string;
};
};
enableSandy: boolean;
disableSandy: boolean;
darkMode: boolean;
showWelcomeAtStartup: boolean;
};
@@ -78,7 +78,7 @@ const initialState: Settings = {
openDevMenu: 'Alt+Shift+D',
},
},
enableSandy: false,
disableSandy: false,
darkMode: false,
showWelcomeAtStartup: true,
};

View File

@@ -8,6 +8,7 @@
*/
import {useStore} from '../../../app/src/utils/useStore';
import GK from '../fb-stubs/GK';
/**
* This hook returns whether dark mode is currently being used.
* Generally should be avoided in favor of using the above theme object,
@@ -15,6 +16,9 @@ import {useStore} from '../../../app/src/utils/useStore';
*/
export function useIsDarkMode(): boolean {
return useStore(
(state) => state.settingsState.enableSandy && state.settingsState.darkMode,
(state) =>
GK.get('flipper_sandy') &&
!state.settingsState.disableSandy &&
state.settingsState.darkMode,
);
}