diff --git a/android/src/main/java/dev/matinzd/healthconnect/records/ReactNutritionRecord.kt b/android/src/main/java/dev/matinzd/healthconnect/records/ReactNutritionRecord.kt index 7567c0c..0f8f7a1 100644 --- a/android/src/main/java/dev/matinzd/healthconnect/records/ReactNutritionRecord.kt +++ b/android/src/main/java/dev/matinzd/healthconnect/records/ReactNutritionRecord.kt @@ -18,48 +18,48 @@ class ReactNutritionRecord : ReactHealthRecordImpl { endTime = Instant.parse(map.getString("endTime")), startZoneOffset = null, endZoneOffset = null, - biotin = getMassFromJsMap(map.getMap("biotin")), - caffeine = getMassFromJsMap(map.getMap("caffeine")), - calcium = getMassFromJsMap(map.getMap("calcium")), - energy = getEnergyFromJsMap(map.getMap("energy")), - energyFromFat = getEnergyFromJsMap(map.getMap("energyFromFat")), - chloride = getMassFromJsMap(map.getMap("chloride")), - cholesterol = getMassFromJsMap(map.getMap("cholesterol")), - chromium = getMassFromJsMap(map.getMap("chromium")), - copper = getMassFromJsMap(map.getMap("copper")), - dietaryFiber = getMassFromJsMap(map.getMap("dietaryFiber")), - folate = getMassFromJsMap(map.getMap("folate")), - folicAcid = getMassFromJsMap(map.getMap("folicAcid")), - iodine = getMassFromJsMap(map.getMap("iodine")), - iron = getMassFromJsMap(map.getMap("iron")), - magnesium = getMassFromJsMap(map.getMap("magnesium")), - manganese = getMassFromJsMap(map.getMap("manganese")), - molybdenum = getMassFromJsMap(map.getMap("molybdenum")), - monounsaturatedFat = getMassFromJsMap(map.getMap("monounsaturatedFat")), - niacin = getMassFromJsMap(map.getMap("niacin")), - pantothenicAcid = getMassFromJsMap(map.getMap("pantothenicAcid")), - phosphorus = getMassFromJsMap(map.getMap("phosphorus")), - polyunsaturatedFat = getMassFromJsMap(map.getMap("polyunsaturatedFat")), - potassium = getMassFromJsMap(map.getMap("potassium")), - protein = getMassFromJsMap(map.getMap("protein")), - riboflavin = getMassFromJsMap(map.getMap("riboflavin")), - saturatedFat = getMassFromJsMap(map.getMap("saturatedFat")), - selenium = getMassFromJsMap(map.getMap("selenium")), - sodium = getMassFromJsMap(map.getMap("sodium")), - sugar = getMassFromJsMap(map.getMap("sugar")), - thiamin = getMassFromJsMap(map.getMap("thiamin")), - totalCarbohydrate = getMassFromJsMap(map.getMap("totalCarbohydrate")), - totalFat = getMassFromJsMap(map.getMap("totalFat")), - transFat = getMassFromJsMap(map.getMap("transFat")), - unsaturatedFat = getMassFromJsMap(map.getMap("unsaturatedFat")), - vitaminA = getMassFromJsMap(map.getMap("vitaminA")), - vitaminB12 = getMassFromJsMap(map.getMap("vitaminB12")), - vitaminB6 = getMassFromJsMap(map.getMap("vitaminB6")), - vitaminC = getMassFromJsMap(map.getMap("vitaminC")), - vitaminD = getMassFromJsMap(map.getMap("vitaminD")), - vitaminE = getMassFromJsMap(map.getMap("vitaminE")), - vitaminK = getMassFromJsMap(map.getMap("vitaminK")), - zinc = getMassFromJsMap(map.getMap("zinc")), + biotin = map.getMap("biotin")?.let { getMassFromJsMap(it) }, + caffeine = map.getMap("caffeine")?.let { getMassFromJsMap(it) }, + calcium = map.getMap("calcium")?.let { getMassFromJsMap(it) }, + energy = map.getMap("energy")?.let { getEnergyFromJsMap(it) }, + energyFromFat = map.getMap("energyFromFat")?.let { getEnergyFromJsMap(it) }, + chloride = map.getMap("chloride")?.let { getMassFromJsMap(it) }, + cholesterol = map.getMap("cholesterol")?.let { getMassFromJsMap(it) }, + chromium = map.getMap("chromium")?.let { getMassFromJsMap(it) }, + copper = map.getMap("copper")?.let { getMassFromJsMap(it) }, + dietaryFiber = map.getMap("dietaryFiber")?.let { getMassFromJsMap(it) }, + folate = map.getMap("folate")?.let { getMassFromJsMap(it) }, + folicAcid = map.getMap("folicAcid")?.let { getMassFromJsMap(it) }, + iodine = map.getMap("iodine")?.let { getMassFromJsMap(it) }, + iron = map.getMap("iron")?.let { getMassFromJsMap(it) }, + magnesium = map.getMap("magnesium")?.let { getMassFromJsMap(it) }, + manganese = map.getMap("manganese")?.let { getMassFromJsMap(it) }, + molybdenum = map.getMap("molybdenum")?.let { getMassFromJsMap(it) }, + monounsaturatedFat = map.getMap("monounsaturatedFat")?.let { getMassFromJsMap(it) }, + niacin = map.getMap("niacin")?.let { getMassFromJsMap(it) }, + pantothenicAcid = map.getMap("pantothenicAcid")?.let { getMassFromJsMap(it) }, + phosphorus = map.getMap("phosphorus")?.let { getMassFromJsMap(it) }, + polyunsaturatedFat = map.getMap("polyunsaturatedFat")?.let { getMassFromJsMap(it) }, + potassium = map.getMap("potassium")?.let { getMassFromJsMap(it) }, + protein = map.getMap("protein")?.let { getMassFromJsMap(it) }, + riboflavin = map.getMap("riboflavin")?.let { getMassFromJsMap(it) }, + saturatedFat = map.getMap("saturatedFat")?.let { getMassFromJsMap(it) }, + selenium = map.getMap("selenium")?.let { getMassFromJsMap(it) }, + sodium = map.getMap("sodium")?.let { getMassFromJsMap(it) }, + sugar = map.getMap("sugar")?.let { getMassFromJsMap(it) }, + thiamin = map.getMap("thiamin")?.let { getMassFromJsMap(it) }, + totalCarbohydrate = map.getMap("totalCarbohydrate")?.let { getMassFromJsMap(it) }, + totalFat = map.getMap("totalFat")?.let { getMassFromJsMap(it) }, + transFat = map.getMap("transFat")?.let { getMassFromJsMap(it) }, + unsaturatedFat = map.getMap("unsaturatedFat")?.let { getMassFromJsMap(it) }, + vitaminA = map.getMap("vitaminA")?.let { getMassFromJsMap(it) }, + vitaminB12 = map.getMap("vitaminB12")?.let { getMassFromJsMap(it) }, + vitaminB6 = map.getMap("vitaminB6")?.let { getMassFromJsMap(it) }, + vitaminC = map.getMap("vitaminC")?.let { getMassFromJsMap(it) }, + vitaminD = map.getMap("vitaminD")?.let { getMassFromJsMap(it) }, + vitaminE = map.getMap("vitaminE")?.let { getMassFromJsMap(it) }, + vitaminK = map.getMap("vitaminK")?.let { getMassFromJsMap(it) }, + zinc = map.getMap("zinc")?.let { getMassFromJsMap(it) }, name = map.getString("name"), mealType = map.getSafeInt("mealType", MealType.MEAL_TYPE_UNKNOWN), )