From c02d5341f9aa52b09647c9bbf9e20d43a3baa6c0 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 9 Nov 2020 08:22:43 -0800 Subject: [PATCH] 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 --- desktop/app/src/chrome/SettingsSheet.tsx | 8 ++++---- desktop/app/src/init.tsx | 2 +- desktop/app/src/reducers/settings.tsx | 4 ++-- desktop/app/src/utils/useIsDarkMode.tsx | 6 +++++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/desktop/app/src/chrome/SettingsSheet.tsx b/desktop/app/src/chrome/SettingsSheet.tsx index 0610932b7..717697f62 100644 --- a/desktop/app/src/chrome/SettingsSheet.tsx +++ b/desktop/app/src/chrome/SettingsSheet.tsx @@ -133,7 +133,7 @@ class SettingsSheet extends Component { enablePrefetching, idbPath, reactNative, - enableSandy, + disableSandy, darkMode, } = this.state.updatedSettings; const {useSandy} = this.props; @@ -234,17 +234,17 @@ class SettingsSheet extends Component { }} /> { this.setState({ updatedSettings: { ...this.state.updatedSettings, - enableSandy: v, + disableSandy: v, }, }); }} /> - {enableSandy && ( + {!disableSandy && ( ({ - sandy: state.settingsState.enableSandy, + sandy: GK.get('flipper_sandy') && !state.settingsState.disableSandy, dark: state.settingsState.darkMode, }), (theme) => { diff --git a/desktop/app/src/reducers/settings.tsx b/desktop/app/src/reducers/settings.tsx index ef672cd8d..42e511bdf 100644 --- a/desktop/app/src/reducers/settings.tsx +++ b/desktop/app/src/reducers/settings.tsx @@ -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, }; diff --git a/desktop/app/src/utils/useIsDarkMode.tsx b/desktop/app/src/utils/useIsDarkMode.tsx index 5844070f2..75568c07a 100644 --- a/desktop/app/src/utils/useIsDarkMode.tsx +++ b/desktop/app/src/utils/useIsDarkMode.tsx @@ -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, ); }