about summary refs log tree commit diff
path: root/src/view/screens/Settings.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-11-12 13:31:11 -0600
committerGitHub <noreply@github.com>2023-11-12 11:31:11 -0800
commit05b728fffcdb17708fdb52685725faf7fdc545bc (patch)
treeb6523916d965f921d3f03d101dc60a7e74569bce /src/view/screens/Settings.tsx
parentc8c308e31e63607280648e3e9f1f56a371adcd05 (diff)
downloadvoidsky-05b728fffcdb17708fdb52685725faf7fdc545bc.tar.zst
Eric/preferences (#1873)
* Add initial preferences query, couple mutations

* Remove unused

* Clean up labels, migrate getModerationOpts

* Add birth date handling

* Migrate feed prefs

* Migrate thread view prefs

* Migrate homeFeed to use existing key name

* Fix up saved feeds in response, no impl yet

* Migrate saved feeds to new hooks

* Clean up more of preferences

* Fix PreferencesThreads load state

* Fix modal dismissal

* Small spacing fix

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/screens/Settings.tsx')
-rw-r--r--src/view/screens/Settings.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx
index e56a50d79..baad2227b 100644
--- a/src/view/screens/Settings.tsx
+++ b/src/view/screens/Settings.tsx
@@ -59,6 +59,7 @@ import {
 } from '#/state/preferences'
 import {useSession, useSessionApi, SessionAccount} from '#/state/session'
 import {useProfileQuery} from '#/state/queries/profile'
+import {useClearPreferencesMutation} from '#/state/queries/preferences'
 
 // TEMPORARY (APP-700)
 // remove after backend testing finishes
@@ -153,6 +154,7 @@ export const SettingsScreen = withAuthRequired(
     const {openModal} = useModalControls()
     const {isSwitchingAccounts, accounts, currentAccount} = useSession()
     const {clearCurrentAccount} = useSessionApi()
+    const {mutate: clearPreferences} = useClearPreferencesMutation()
 
     const primaryBg = useCustomPalette<ViewStyle>({
       light: {backgroundColor: colors.blue0},
@@ -219,9 +221,8 @@ export const SettingsScreen = withAuthRequired(
     }, [openModal])
 
     const onPressResetPreferences = React.useCallback(async () => {
-      await store.preferences.reset()
-      Toast.show('Preferences reset')
-    }, [store])
+      clearPreferences()
+    }, [clearPreferences])
 
     const onPressResetOnboarding = React.useCallback(async () => {
       onboardingDispatch({type: 'start'})
@@ -300,7 +301,7 @@ export const SettingsScreen = withAuthRequired(
               </View>
               <View style={[styles.infoLine]}>
                 <Text type="lg-medium" style={pal.text}>
-                  <Trans>Birthday: </Trans>
+                  <Trans>Birthday:</Trans>{' '}
                 </Text>
                 <Link onPress={() => openModal({name: 'birth-date-settings'})}>
                   <Text type="lg" style={pal.link}>