Rename to useCervixAsSecondarySymptom

This commit is contained in:
bl00dymarie
2024-02-19 17:48:37 +01:00
parent 7fa130f9e1
commit 63bc8a1daf
4 changed files with 25 additions and 18 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ export default function SelectTabGroup({ activeButton, buttons, onSelect }) {
const oneTimeTransformIntoNumber = const oneTimeTransformIntoNumber =
typeof activeButton === 'boolean' && Number(activeButton) typeof activeButton === 'boolean' && Number(activeButton)
const isSecondarySymptomSwitch = const isSecondarySymptomSwitch =
buttons[0]['label'] === labels.useCervix.secondarySymptomCervicalMucus buttons[0]['label'] === labels.useCervixAsSecondarySymptom.mucus
return ( return (
<View style={styles.container}> <View style={styles.container}>
{buttons.map(({ label, value }, i) => { {buttons.map(({ label, value }, i) => {
+11 -11
View File
@@ -26,7 +26,7 @@ import {
savePeriodPrediction, savePeriodPrediction,
saveSexTrackingCategory, saveSexTrackingCategory,
saveTemperatureTrackingCategory, saveTemperatureTrackingCategory,
saveUseCervix, saveUseCervixAsSecondarySymptom,
periodPredictionObservable, periodPredictionObservable,
useCervixAsSecondarySymptomObservable, useCervixAsSecondarySymptomObservable,
} from '../../../local-storage' } from '../../../local-storage'
@@ -124,11 +124,11 @@ const Settings = () => {
// used to be onCervixToggle // used to be onCervixToggle
const secondarySymptomButtons = [ const secondarySymptomButtons = [
{ {
label: labels.useCervix.secondarySymptomCervicalMucus, label: labels.useCervixAsSecondarySymptom.mucus,
value: 0, value: 0,
}, },
{ {
label: labels.useCervix.secondarySymptomCervix, label: labels.useCervixAsSecondarySymptom.cervix,
value: 1, value: 1,
}, },
] ]
@@ -136,7 +136,7 @@ const Settings = () => {
const onSelectTab = (value) => { const onSelectTab = (value) => {
if (isMucusTrackingCategoryEnabled && isCervixTrackingCategoryEnabled) { if (isMucusTrackingCategoryEnabled && isCervixTrackingCategoryEnabled) {
setShouldUseCervix(value) setShouldUseCervix(value)
saveUseCervix(value) saveUseCervixAsSecondarySymptom(value)
} }
} }
@@ -165,21 +165,21 @@ const Settings = () => {
saveMucusTrackingCategory(mucus) saveMucusTrackingCategory(mucus)
setCervixTrackingCategory(cervix) setCervixTrackingCategory(cervix)
saveCervixTrackingCategory(cervix) saveCervixTrackingCategory(cervix)
saveUseCervix(shouldUseCervix) saveUseCervixAsSecondarySymptom(shouldUseCervix)
} }
const secSymptomDisabledPrompt = () => { const secSymptomDisabledPrompt = () => {
if (!isMucusTrackingCategoryEnabled == isCervixTrackingCategoryEnabled) { if (!isMucusTrackingCategoryEnabled == isCervixTrackingCategoryEnabled) {
Alert.alert( Alert.alert(
labels.useCervix.disabled.title, labels.useCervixAsSecondarySymptom.disabled.title,
labels.useCervix.disabled.noSecondaryEnabled labels.useCervixAsSecondarySymptom.disabled.noSecondaryEnabled
) )
} }
} }
const cervixText = shouldUseCervix const cervixText = shouldUseCervix
? labels.useCervix.cervixModeOn ? labels.useCervixAsSecondarySymptom.cervixModeOn
: labels.useCervix.cervixModeOff : labels.useCervixAsSecondarySymptom.cervixModeOff
const sliderDisabledPrompt = () => { const sliderDisabledPrompt = () => {
if (!isTemperatureTrackingCategoryEnabled) { if (!isTemperatureTrackingCategoryEnabled) {
@@ -271,10 +271,10 @@ const Settings = () => {
{/* used to be switch for onCervixToggle */} {/* used to be switch for onCervixToggle */}
<Pressable onPress={secSymptomDisabledPrompt}> <Pressable onPress={secSymptomDisabledPrompt}>
<Segment title={labels.useCervix.title}> <Segment title={labels.useCervixAsSecondarySymptom.title}>
{!isTemperatureTrackingCategoryEnabled || {!isTemperatureTrackingCategoryEnabled ||
isSecondarySymptomDisabled ? ( isSecondarySymptomDisabled ? (
<AppText>{labels.useCervix.disabled.message}</AppText> <AppText>{labels.useCervixAsSecondarySymptom.disabled.message}</AppText>
) : ( ) : (
<> <>
<AppText>{cervixText}</AppText> <AppText>{cervixText}</AppText>
+3 -3
View File
@@ -66,7 +66,7 @@ export default {
'To use the period reminder please first enable period predictions in the customization settings.', 'To use the period reminder please first enable period predictions in the customization settings.',
}, },
}, },
useCervix: { useCervixAsSecondarySymptom: {
title: 'Secondary symptom', title: 'Secondary symptom',
cervixModeOn: cervixModeOn:
'Cervix values are being used for symptothermal fertility detection. You can switch here to use cervical mucus values for symptothermal fertility detection', 'Cervix values are being used for symptothermal fertility detection. You can switch here to use cervical mucus values for symptothermal fertility detection',
@@ -79,8 +79,8 @@ export default {
noSecondaryEnabled: noSecondaryEnabled:
'To switch the secondary symptom both cervical mucus an cervix need to be enabled in the customization settings.', 'To switch the secondary symptom both cervical mucus an cervix need to be enabled in the customization settings.',
}, },
secondarySymptomCervicalMucus: 'cervical mucus', mucus: 'cervical mucus',
secondarySymptomCervix: 'cervix', cervix: 'cervix',
}, },
periodPrediction: { periodPrediction: {
title: 'Period predictions', title: 'Period predictions',
+10 -3
View File
@@ -60,10 +60,17 @@ export async function savePeriodPrediction(bool) {
} }
export const useCervixAsSecondarySymptomObservable = Observable() export const useCervixAsSecondarySymptomObservable = Observable()
setObvWithInitValue('useCervix', useCervixAsSecondarySymptomObservable, 0) setObvWithInitValue(
'useCervixAsSecondarySymptom',
useCervixAsSecondarySymptomObservable,
0
)
export async function saveUseCervix(value) { export async function saveUseCervixAsSecondarySymptom(value) {
await AsyncStorage.setItem('useCervix', JSON.stringify(value)) await AsyncStorage.setItem(
'useCervixAsSecondarySymptom',
JSON.stringify(value)
)
useCervixAsSecondarySymptomObservable.set(value) useCervixAsSecondarySymptomObservable.set(value)
} }