Use nfp mode setting in sympto adapter
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import getFertilityStatus from './sympto'
|
import getFertilityStatus from './sympto'
|
||||||
import cycleModule from './cycle'
|
import cycleModule from './cycle'
|
||||||
import { fertilityStatus } from '../i18n/en/labels'
|
import { fertilityStatus } from '../i18n/en/labels'
|
||||||
|
import { useCervixObservable } from '../local-storage'
|
||||||
|
|
||||||
export function getFertilityStatusForDay(dateString) {
|
export function getFertilityStatusForDay(dateString) {
|
||||||
const status = getCycleStatusForDay(dateString)
|
const status = getCycleStatusForDay(dateString)
|
||||||
@@ -48,6 +49,8 @@ export function getCycleStatusForDay(dateString, opts = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cycleInfo.secondarySymptom = useCervixObservable.value ? 'cervix' : 'mucus'
|
||||||
|
|
||||||
return getFertilityStatus(cycleInfo)
|
return getFertilityStatus(cycleInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ export const useCervixObservable = Observable()
|
|||||||
setObvWithInitValue('useCervix', useCervixObservable, false)
|
setObvWithInitValue('useCervix', useCervixObservable, false)
|
||||||
|
|
||||||
export async function saveUseCervix(bool) {
|
export async function saveUseCervix(bool) {
|
||||||
console.log('saving cervix to', bool)
|
|
||||||
await AsyncStorage.setItem('useCervix', JSON.stringify(bool))
|
await AsyncStorage.setItem('useCervix', JSON.stringify(bool))
|
||||||
useCervixObservable.set(bool)
|
useCervixObservable.set(bool)
|
||||||
}
|
}
|
||||||
@@ -63,8 +62,6 @@ export async function saveEncryptionFlag(bool) {
|
|||||||
|
|
||||||
async function setObvWithInitValue(key, obv, defaultValue) {
|
async function setObvWithInitValue(key, obv, defaultValue) {
|
||||||
const result = await AsyncStorage.getItem(key)
|
const result = await AsyncStorage.getItem(key)
|
||||||
console.log('result from db for key')
|
|
||||||
console.log(result)
|
|
||||||
let value
|
let value
|
||||||
if (result) {
|
if (result) {
|
||||||
value = JSON.parse(result)
|
value = JSON.parse(result)
|
||||||
|
|||||||
Reference in New Issue
Block a user