chore: preferences changes

This commit is contained in:
Aman Harwara
2023-04-26 19:02:19 +05:30
parent 157ad0b052
commit d501ae4410
8 changed files with 10 additions and 492 deletions

View File

@@ -30,11 +30,11 @@ const LabsPane: FunctionComponent<Props> = ({ application }) => {
const [experimentalFeatures, setExperimentalFeatures] = useState<ExperimentalFeatureItem[]>([])
const [isPaneGesturesEnabled, setIsPaneGesturesEnabled] = useState(() =>
application.getPreference(PrefKey.PaneGesturesEnabled, false),
application.getPreference(PrefKey.PaneGesturesEnabled),
)
useEffect(() => {
return application.addSingleEventObserver(ApplicationEvent.PreferencesChanged, async () => {
setIsPaneGesturesEnabled(application.getPreference(PrefKey.PaneGesturesEnabled, false))
setIsPaneGesturesEnabled(application.getPreference(PrefKey.PaneGesturesEnabled))
})
}, [application])
@@ -69,7 +69,7 @@ const LabsPane: FunctionComponent<Props> = ({ application }) => {
<LabsFeature
name="Pane switch gestures"
description="Allows using gestures to navigate"
isEnabled={isPaneGesturesEnabled}
isEnabled={!!isPaneGesturesEnabled}
toggleFeature={() => {
void application.setPreference(PrefKey.PaneGesturesEnabled, !isPaneGesturesEnabled)
}}