tweak(settings): switced to useLocalStorage hook

This commit is contained in:
Christopher committed 2021-01-09 18:45:18 +01:00
1 parent 5fdb9ba21c
commit 6458bce17f
1 file changed
+14 -15
@@ -40,31 +40,30 @@ export const SettingsApp = () => {
const [config] = useConfig(); const [config] = useConfig();
const simcard = useSimcard(); const simcard = useSimcard();
const [wallpaper, setWallpaper] = useLocalStorage<any>(
'wallpaper',
'surf.jpg'
);
const [frame, setFrame] = useLocalStorage<any>('frame', 's10.png');
const [theme, setTheme] = useLocalStorage<any>('theme', 'default-dark');
const [zoom, setZoom] = useLocalStorage<any>('zoom', '100%');
const [ringtone, setRingtone] = useLocalStorage<any>('ringtone', '');
const wallpapers = config.wallpapers.map( const wallpapers = config.wallpapers.map(
MapStringOptions(getStorage('wallpaper'), (val: string) => MapStringOptions(wallpaper, (val: string) => setWallpaper(val))
writeStorage('wallpaper', val)
)
); );
const frames = config.frames.map( const frames = config.frames.map(
MapStringOptions(getStorage('frame'), (val: string) => MapStringOptions(frame, (val: string) => setFrame(val))
writeStorage('frame', val)
)
); );
const themes = Object.keys(config.themes).map( const themes = Object.keys(config.themes).map(
MapStringOptions(getStorage('theme'), (val: string) => MapStringOptions(theme, (val: string) => setTheme(val))
writeStorage('theme', val)
)
); );
const zoomOptions = config.zoomOptions.map( const zoomOptions = config.zoomOptions.map(
MapStringOptions(getStorage('zoom'), (val: string) => MapStringOptions(zoom, (val: string) => setZoom(val))
writeStorage('zoom', val)
)
); );
// Doesn't actually do anything for the time being // Doesn't actually do anything for the time being
const ringtones = config.ringtones.map( const ringtones = config.ringtones.map(
MapStringOptions(getStorage('ringtone'), (val: string) => MapStringOptions(ringtone, (val: string) => setRingtone(val))
writeStorage('ringtone', val)
)
); );
// * Probably gonna make this a slider component in the future // * Probably gonna make this a slider component in the future
// const ringtoneVols = config.ringtoneVols.map( // const ringtoneVols = config.ringtoneVols.map(