Add show images setting
This commit is contained in:
parent
663d0f7ba4
commit
137ecf4a77
|
@ -24,6 +24,7 @@ export default function SettingsPage() {
|
|||
const [predict, setPredict] = useState(false);
|
||||
const [sound, setSound] = useState<string>('');
|
||||
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: (
|
||||
<>
|
||||
<Text style={styles.text}>Show images</Text>
|
||||
<MassiveSwitch
|
||||
style={[styles.text, {alignSelf: 'flex-start'}]}
|
||||
value={images}
|
||||
onValueChange={setImages}
|
||||
/>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
name: 'Alarm sound',
|
||||
element: (
|
||||
|
|
3
db.ts
3
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 () => {
|
||||
|
|
|
@ -7,4 +7,5 @@ export default interface Settings {
|
|||
sets: number;
|
||||
sound: string;
|
||||
notify: number;
|
||||
images: number;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user