small changes on secondary symptom to make it work nicly with the button logic instead of the former switch and to display the correct texts
This commit is contained in:
@@ -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 (
|
||||
<AppPage title={'Customization'}>
|
||||
<Segment title={'Tracking categories'}>
|
||||
@@ -273,10 +269,13 @@ const Settings = () => {
|
||||
</Segment>
|
||||
</Pressable>
|
||||
|
||||
{/* used to be switch for onCervixToggle */}
|
||||
<Pressable onPress={secSymptomDisabledPrompt}>
|
||||
<Segment title={labels.useCervix.title}>
|
||||
{/* noch condition adden like isSecondarySymptomDisabled */}
|
||||
{isTemperatureTrackingCategoryEnabled && (
|
||||
{!isTemperatureTrackingCategoryEnabled ||
|
||||
isSecondarySymptomDisabled ? (
|
||||
<AppText>{labels.useCervix.disabled.message}</AppText>
|
||||
) : (
|
||||
<>
|
||||
<AppText>{cervixText}</AppText>
|
||||
<SelectTabGroup
|
||||
@@ -286,9 +285,6 @@ const Settings = () => {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!isTemperatureTrackingCategoryEnabled && (
|
||||
<AppText>{labels.disabled.message}</AppText>
|
||||
)}
|
||||
</Segment>
|
||||
</Pressable>
|
||||
|
||||
|
||||
+1
-1
@@ -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.',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user