Rename to useCervixAsSecondarySymptom
This commit is contained in:
@@ -11,7 +11,7 @@ export default function SelectTabGroup({ activeButton, buttons, onSelect }) {
|
||||
const oneTimeTransformIntoNumber =
|
||||
typeof activeButton === 'boolean' && Number(activeButton)
|
||||
const isSecondarySymptomSwitch =
|
||||
buttons[0]['label'] === labels.useCervix.secondarySymptomCervicalMucus
|
||||
buttons[0]['label'] === labels.useCervixAsSecondarySymptom.mucus
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{buttons.map(({ label, value }, i) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
savePeriodPrediction,
|
||||
saveSexTrackingCategory,
|
||||
saveTemperatureTrackingCategory,
|
||||
saveUseCervix,
|
||||
saveUseCervixAsSecondarySymptom,
|
||||
periodPredictionObservable,
|
||||
useCervixAsSecondarySymptomObservable,
|
||||
} from '../../../local-storage'
|
||||
@@ -124,11 +124,11 @@ const Settings = () => {
|
||||
// used to be onCervixToggle
|
||||
const secondarySymptomButtons = [
|
||||
{
|
||||
label: labels.useCervix.secondarySymptomCervicalMucus,
|
||||
label: labels.useCervixAsSecondarySymptom.mucus,
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: labels.useCervix.secondarySymptomCervix,
|
||||
label: labels.useCervixAsSecondarySymptom.cervix,
|
||||
value: 1,
|
||||
},
|
||||
]
|
||||
@@ -136,7 +136,7 @@ const Settings = () => {
|
||||
const onSelectTab = (value) => {
|
||||
if (isMucusTrackingCategoryEnabled && isCervixTrackingCategoryEnabled) {
|
||||
setShouldUseCervix(value)
|
||||
saveUseCervix(value)
|
||||
saveUseCervixAsSecondarySymptom(value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,21 +165,21 @@ const Settings = () => {
|
||||
saveMucusTrackingCategory(mucus)
|
||||
setCervixTrackingCategory(cervix)
|
||||
saveCervixTrackingCategory(cervix)
|
||||
saveUseCervix(shouldUseCervix)
|
||||
saveUseCervixAsSecondarySymptom(shouldUseCervix)
|
||||
}
|
||||
|
||||
const secSymptomDisabledPrompt = () => {
|
||||
if (!isMucusTrackingCategoryEnabled == isCervixTrackingCategoryEnabled) {
|
||||
Alert.alert(
|
||||
labels.useCervix.disabled.title,
|
||||
labels.useCervix.disabled.noSecondaryEnabled
|
||||
labels.useCervixAsSecondarySymptom.disabled.title,
|
||||
labels.useCervixAsSecondarySymptom.disabled.noSecondaryEnabled
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const cervixText = shouldUseCervix
|
||||
? labels.useCervix.cervixModeOn
|
||||
: labels.useCervix.cervixModeOff
|
||||
? labels.useCervixAsSecondarySymptom.cervixModeOn
|
||||
: labels.useCervixAsSecondarySymptom.cervixModeOff
|
||||
|
||||
const sliderDisabledPrompt = () => {
|
||||
if (!isTemperatureTrackingCategoryEnabled) {
|
||||
@@ -271,10 +271,10 @@ const Settings = () => {
|
||||
|
||||
{/* used to be switch for onCervixToggle */}
|
||||
<Pressable onPress={secSymptomDisabledPrompt}>
|
||||
<Segment title={labels.useCervix.title}>
|
||||
<Segment title={labels.useCervixAsSecondarySymptom.title}>
|
||||
{!isTemperatureTrackingCategoryEnabled ||
|
||||
isSecondarySymptomDisabled ? (
|
||||
<AppText>{labels.useCervix.disabled.message}</AppText>
|
||||
<AppText>{labels.useCervixAsSecondarySymptom.disabled.message}</AppText>
|
||||
) : (
|
||||
<>
|
||||
<AppText>{cervixText}</AppText>
|
||||
|
||||
+3
-3
@@ -66,7 +66,7 @@ export default {
|
||||
'To use the period reminder please first enable period predictions in the customization settings.',
|
||||
},
|
||||
},
|
||||
useCervix: {
|
||||
useCervixAsSecondarySymptom: {
|
||||
title: 'Secondary symptom',
|
||||
cervixModeOn:
|
||||
'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:
|
||||
'To switch the secondary symptom both cervical mucus an cervix need to be enabled in the customization settings.',
|
||||
},
|
||||
secondarySymptomCervicalMucus: 'cervical mucus',
|
||||
secondarySymptomCervix: 'cervix',
|
||||
mucus: 'cervical mucus',
|
||||
cervix: 'cervix',
|
||||
},
|
||||
periodPrediction: {
|
||||
title: 'Period predictions',
|
||||
|
||||
+10
-3
@@ -60,10 +60,17 @@ export async function savePeriodPrediction(bool) {
|
||||
}
|
||||
|
||||
export const useCervixAsSecondarySymptomObservable = Observable()
|
||||
setObvWithInitValue('useCervix', useCervixAsSecondarySymptomObservable, 0)
|
||||
setObvWithInitValue(
|
||||
'useCervixAsSecondarySymptom',
|
||||
useCervixAsSecondarySymptomObservable,
|
||||
0
|
||||
)
|
||||
|
||||
export async function saveUseCervix(value) {
|
||||
await AsyncStorage.setItem('useCervix', JSON.stringify(value))
|
||||
export async function saveUseCervixAsSecondarySymptom(value) {
|
||||
await AsyncStorage.setItem(
|
||||
'useCervixAsSecondarySymptom',
|
||||
JSON.stringify(value)
|
||||
)
|
||||
useCervixAsSecondarySymptomObservable.set(value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user