mirror of
https://github.com/selfxyz/self.git
synced 2026-04-27 03:01:15 -04:00
fix disclaimer notice reshowing after being dismissed (#62)
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { create } from 'zustand';
|
||||
import { createJSONStorage, persist } from 'zustand/middleware';
|
||||
|
||||
interface SettingsState {
|
||||
hasPrivacyNoteBeenDismissed: boolean;
|
||||
dismissPrivacyNote: () => void;
|
||||
}
|
||||
|
||||
export const useSettingStore = create<SettingsState>(set => ({
|
||||
hasPrivacyNoteBeenDismissed: false,
|
||||
dismissPrivacyNote: () => {
|
||||
set({ hasPrivacyNoteBeenDismissed: true });
|
||||
},
|
||||
}));
|
||||
/*
|
||||
* This store is used to store the settings of the app. Dont store anything sensative here
|
||||
*/
|
||||
export const useSettingStore = create<SettingsState>()(
|
||||
persist(
|
||||
(set, _get) => ({
|
||||
hasPrivacyNoteBeenDismissed: false,
|
||||
dismissPrivacyNote: () => set({ hasPrivacyNoteBeenDismissed: true }),
|
||||
}),
|
||||
{
|
||||
name: 'setting-storage',
|
||||
storage: createJSONStorage(() => AsyncStorage),
|
||||
onRehydrateStorage: () => console.log('Rehydrated settings'),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user