diff --git a/components/settings/customization/index.js b/components/settings/customization/index.js index 49a65ff..386225a 100644 --- a/components/settings/customization/index.js +++ b/components/settings/customization/index.js @@ -121,6 +121,7 @@ const Settings = () => { ? labels.periodPrediction.on : labels.periodPrediction.off + // used to be onCervixToggle const secondarySymptomButtons = [ { label: labels.useCervix.secondarySymptomCervicalMucus, @@ -139,6 +140,7 @@ const Settings = () => { } } + // is needed so secondary symptom is set correct on load useEffect(() => { manageSecondarySymptom( cervixTrackingCategoryObservable.value, @@ -146,15 +148,16 @@ const Settings = () => { ) }, []) + // shoutUseCervix changed to 0/1 instead of false/true const manageSecondarySymptom = (cervix, mucus) => { if (!cervix && mucus) { - setShouldUseCervix(false) - setIsSecondarySymptomDisabled(true) + setShouldUseCervix(0) + setIsSecondarySymptomDisabled(false) } else if (cervix && mucus) { setIsSecondarySymptomDisabled(false) } else if (cervix && !mucus) { - setShouldUseCervix(true) - setIsSecondarySymptomDisabled(true) + setShouldUseCervix(1) + setIsSecondarySymptomDisabled(false) } else if (!cervix && !mucus) { setIsSecondarySymptomDisabled(true) } @@ -166,15 +169,7 @@ const Settings = () => { } const secSymptomDisabledPrompt = () => { - if (!isMucusTrackingCategoryEnabled && !isCervixTrackingCategoryEnabled) { - Alert.alert( - labels.useCervix.disabled.title, - labels.useCervix.disabled.message - ) - } else if ( - !isMucusTrackingCategoryEnabled || - !isCervixTrackingCategoryEnabled - ) { + if (!isMucusTrackingCategoryEnabled == isCervixTrackingCategoryEnabled) { Alert.alert( labels.useCervix.disabled.title, labels.useCervix.disabled.noSecondaryEnabled @@ -191,6 +186,7 @@ const Settings = () => { Alert.alert(labels.disabled.title, labels.disabled.message) } } + return ( @@ -273,10 +269,13 @@ const Settings = () => { + {/* used to be switch for onCervixToggle */} - {/* noch condition adden like isSecondarySymptomDisabled */} - {isTemperatureTrackingCategoryEnabled && ( + {!isTemperatureTrackingCategoryEnabled || + isSecondarySymptomDisabled ? ( + {labels.useCervix.disabled.message} + ) : ( <> {cervixText} { /> )} - {!isTemperatureTrackingCategoryEnabled && ( - {labels.disabled.message} - )} diff --git a/i18n/en/settings.js b/i18n/en/settings.js index d4b307a..7afa9be 100644 --- a/i18n/en/settings.js +++ b/i18n/en/settings.js @@ -75,7 +75,7 @@ export default { disabled: { title: 'Disabled', message: - 'To set the secondary symptom please first enable the temperature, cervical mucus or cervix tracking category as well as the fertility feature in the customization settings.', + 'To set a secondary symptom please first enable the temperature, cervical mucus or cervix tracking category as well as the fertility feature in the customization settings.', noSecondaryEnabled: 'To switch the secondary symptom both cervical mucus an cervix need to be enabled in the customization settings.', },