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 [predict, setPredict] = useState(false);
|
||||||
const [sound, setSound] = useState<string>('');
|
const [sound, setSound] = useState<string>('');
|
||||||
const [notify, setNotify] = useState(false);
|
const [notify, setNotify] = useState(false);
|
||||||
|
const [images, setImages] = useState(false);
|
||||||
const [battery, setBattery] = useState(false);
|
const [battery, setBattery] = useState(false);
|
||||||
const [ignoring, setIgnoring] = useState(false);
|
const [ignoring, setIgnoring] = useState(false);
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
|
@ -42,6 +43,7 @@ export default function SettingsPage() {
|
||||||
setVibrate(!!settings.vibrate);
|
setVibrate(!!settings.vibrate);
|
||||||
setSound(settings.sound);
|
setSound(settings.sound);
|
||||||
setNotify(!!settings.notify);
|
setNotify(!!settings.notify);
|
||||||
|
setImages(!!settings.images);
|
||||||
NativeModules.AlarmModule.ignoringBattery(setIgnoring);
|
NativeModules.AlarmModule.ignoringBattery(setIgnoring);
|
||||||
}, [db]);
|
}, [db]);
|
||||||
|
|
||||||
|
@ -51,10 +53,31 @@ export default function SettingsPage() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
db.executeSql(
|
db.executeSql(
|
||||||
`UPDATE settings SET vibrate=?,minutes=?,sets=?,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],
|
[
|
||||||
|
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(
|
const changeAlarmEnabled = useCallback(
|
||||||
(enabled: boolean) => {
|
(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',
|
name: 'Alarm sound',
|
||||||
element: (
|
element: (
|
||||||
|
|
3
db.ts
3
db.ts
|
@ -64,8 +64,7 @@ const selectSettings = `
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const insertSettings = `
|
const insertSettings = `
|
||||||
INSERT INTO settings(minutes,seconds,alarm,vibrate,predict,sets)
|
INSERT INTO settings(minutes) VALUES(3);
|
||||||
VALUES(3,30,false,true,true,3);
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const getDb = async () => {
|
export const getDb = async () => {
|
||||||
|
|
|
@ -7,4 +7,5 @@ export default interface Settings {
|
||||||
sets: number;
|
sets: number;
|
||||||
sound: string;
|
sound: string;
|
||||||
notify: number;
|
notify: number;
|
||||||
|
images: number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user