设置页面

This commit is contained in:
Developer
2026-03-19 16:34:56 +08:00
parent 965a6b411f
commit 462a090599
12 changed files with 586 additions and 156 deletions

22
store/settingsStore.ts Normal file
View File

@@ -0,0 +1,22 @@
import { create } from 'zustand';
import AsyncStorage from '@react-native-async-storage/async-storage';
interface SettingsState {
coverQuality: 'hd' | 'normal';
setCoverQuality: (q: 'hd' | 'normal') => Promise<void>;
restore: () => Promise<void>;
}
export const useSettingsStore = create<SettingsState>((set) => ({
coverQuality: 'hd',
setCoverQuality: async (q) => {
await AsyncStorage.setItem('COVER_QUALITY', q);
set({ coverQuality: q });
},
restore: async () => {
const q = await AsyncStorage.getItem('COVER_QUALITY');
if (q === 'hd' || q === 'normal') set({ coverQuality: q });
},
}));