Skip to content

1.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 22 Nov 20:10
· 11 commits to main since this release

This version introduces the following changes:

  1. Add ability to interact with the Nutrition data type (i.e. check/request permission and read/write data). Example:
    // Check permission
    kHealth.checkPermissions(
      KHPermission.Nutrition(
         readBiotin = true,
         writeBiotin = true,
         readCaffeine = true,
         writeCaffeine = true
         // This class allows you to request for the precise permissions
         // that you require with total 38 food/nutrition values
     ),
    )
    
    // Request permission
    kHealth.requestPermissions(
      KHPermission.Nutrition(
         readBiotin = true,
         writeBiotin = true,
         readCaffeine = true,
         writeCaffeine = true
         // and many more params in this class (like VitaminA, Zinc, Protein, etc.)
     ),
    )
    
    // Write Nutrition
    kHealth.writeRecords(
       KHRecord.Nutrition(
           name = "KHealth Sample Meal",
           startTime = Clock.System.now() - 10.minutes,
           endTime = Clock.System.now(),
           mealType = KHMealType.Snack,
           solidUnit = KHUnit.Mass.Gram,
           biotin = 0.00003,
           caffeine = 0.45,
           // and many more...
       ),
    )
    
     // Read Nutrition
     kHealth.readRecords(
         KHReadRequest.Nutrition(
             startTime = startTime,
             endTime = endTime,
             // Optional
             solidUnit = KHUnit.Mass.Gram,
             energyUnit = KHUnit.Energy.KiloCalorie
         )
     )

Note

Nutrition supports the following types of food items

Biotin, Caffeine, Calcium, Chloride, Cholesterol, Chromium, Copper, DietaryFiber, Energy, FolicAcid, Iodine, Iron, Magnesium, Manganese, Molybdenum, MonounsaturatedFat, Niacin, PantothenicAcid, Phosphorus, PolyunsaturatedFat, Potassium, Protein, Riboflavin, SaturatedFat, Selenium, Sodium, Sugar, Thiamin, TotalCarbohydrate, TotalFat, VitaminA, VitaminB12, VitaminB6, VitaminC, VitaminD, VitaminE, VitaminK, Zinc

  1. Remove KHDataType and KHPermissionStatus classes to make user's learning curve easier

Warning

THIS IS A MAJOR CHANGE 👆🏼