diff --git a/SettingsPage.tsx b/SettingsPage.tsx index 186c5bd..87aa1a3 100644 --- a/SettingsPage.tsx +++ b/SettingsPage.tsx @@ -24,6 +24,7 @@ export default function SettingsPage() { const [predict, setPredict] = useState(false); const [sound, setSound] = useState(''); const [notify, setNotify] = useState(false); + const [images, setImages] = useState(false); const [battery, setBattery] = useState(false); const [ignoring, setIgnoring] = useState(false); const [search, setSearch] = useState(''); @@ -42,6 +43,7 @@ export default function SettingsPage() { setVibrate(!!settings.vibrate); setSound(settings.sound); setNotify(!!settings.notify); + setImages(!!settings.images); NativeModules.AlarmModule.ignoringBattery(setIgnoring); }, [db]); @@ -51,10 +53,31 @@ export default function SettingsPage() { useEffect(() => { db.executeSql( - `UPDATE settings SET vibrate=?,minutes=?,sets=?,seconds=?,alarm=?,predict=?,sound=?,notify=?`, - [vibrate, minutes, maxSets, seconds, alarm, predict, sound, notify], + `UPDATE settings SET vibrate=?,minutes=?,sets=?,seconds=?,alarm=?,predict=?,sound=?,notify=?,images=?`, + [ + vibrate, + minutes, + maxSets, + seconds, + alarm, + predict, + sound, + notify, + images, + ], ); - }, [vibrate, minutes, maxSets, seconds, alarm, predict, sound, notify, db]); + }, [ + vibrate, + minutes, + maxSets, + seconds, + alarm, + predict, + sound, + notify, + db, + images, + ]); const changeAlarmEnabled = useCallback( (enabled: boolean) => { @@ -191,6 +214,19 @@ export default function SettingsPage() { ), }, + { + name: 'Show images', + element: ( + <> + Show images + + + ), + }, { name: 'Alarm sound', element: ( diff --git a/db.ts b/db.ts index 7b2777a..20f9687 100644 --- a/db.ts +++ b/db.ts @@ -64,8 +64,7 @@ const selectSettings = ` `; const insertSettings = ` - INSERT INTO settings(minutes,seconds,alarm,vibrate,predict,sets) - VALUES(3,30,false,true,true,3); + INSERT INTO settings(minutes) VALUES(3); `; export const getDb = async () => { diff --git a/settings.ts b/settings.ts index b94877d..ff40294 100644 --- a/settings.ts +++ b/settings.ts @@ -7,4 +7,5 @@ export default interface Settings { sets: number; sound: string; notify: number; + images: number; }