Disable sound -> Sound & Remove show steps setting

1. Negating is more complicated than just saying Sound
2. The exercise edit screen is already pretty small,
so this feature of hiding the steps is probably
not useful.
This commit is contained in:
Brandon Presley 2024-02-17 20:57:29 +13:00
parent 617fca0094
commit 495d6b35b7
4 changed files with 27 additions and 59 deletions

View File

@ -138,17 +138,15 @@ export default function EditExercise() {
onChangeText={setName}
onSubmitEditing={submitName}
/>
{settings?.steps && (
<AppInput
innerRef={stepsRef}
selectTextOnFocus={false}
value={steps}
onChangeText={setSteps}
label="Steps"
multiline
onSubmitEditing={() => setsRef.current?.focus()}
/>
)}
<AppInput
innerRef={stepsRef}
selectTextOnFocus={false}
value={steps}
onChangeText={setSteps}
label="Steps"
multiline
onSubmitEditing={() => setsRef.current?.focus()}
/>
<AppInput
innerRef={setsRef}
value={sets}

View File

@ -120,17 +120,15 @@ export default function EditExercises() {
onChangeText={setName}
onSubmitEditing={submitName}
/>
{settings?.steps && (
<AppInput
innerRef={stepsRef}
selectTextOnFocus={false}
value={steps}
onChangeText={setSteps}
label={`Steps: ${oldSteps}`}
multiline
onSubmitEditing={() => setsRef.current?.focus()}
/>
)}
<AppInput
innerRef={stepsRef}
selectTextOnFocus={false}
value={steps}
onChangeText={setSteps}
label={`Steps: ${oldSteps}`}
multiline
onSubmitEditing={() => setsRef.current?.focus()}
/>
<AppInput
innerRef={setsRef}
value={sets}

View File

@ -62,7 +62,10 @@ export default function EditSet() {
useFocusEffect(
useCallback(() => {
settingsRepo.findOne({ where: {} }).then(setSettings);
settingsRepo.findOne({ where: {} }).then(gotSettings => {
setSettings(gotSettings);
console.log(`${EditSet.name}.focus:`, { gotSettings })
});
}, [])
);

View File

@ -349,30 +349,14 @@ export default function SettingsPage() {
),
},
{
name: "Disable sound",
name: "Sound",
renderItem: (name: string) => (
<Switch
value={settings.noSound}
value={!settings.noSound}
onChange={async (value) => {
setValue("noSound", value);
const silentPath = Dirs.DocumentDir + "/silent.mp3";
if (value) {
await FileSystem.writeFile(silentPath, "");
setValue("sound", silentPath);
await settingsRepo.update(
{},
{
sound: silentPath,
noSound: value,
}
);
} else if (!value && settings.sound === silentPath) {
setValue("sound", null);
await settingsRepo.update({}, { sound: null, noSound: value });
}
if (value) toast("Alarms will no longer make a sound.");
setValue("noSound", !value);
await settingsRepo.update({}, { noSound: !value });
if (!value) toast("Alarms will no longer make a sound.");
else toast("Enabled sound for alarms.");
}}
title={name}
@ -424,21 +408,6 @@ export default function SettingsPage() {
/>
),
},
{
name: "Show steps",
renderItem: (name: string) => (
<Switch
value={settings.steps}
onChange={async (value) => {
setValue("steps", value);
await settingsRepo.update({}, { steps: value });
if (value) toast("Show steps for exercises.");
else toast("Hid steps for exercises.");
}}
title={name}
/>
),
},
{
name: "Show date",
renderItem: (name: string) => (