cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
527 stars 625 forks source link

[Health] Expand Micro Nutrient Support #983

Open davidpryor opened 2 weeks ago

davidpryor commented 2 weeks ago

Hello! I am not sure about the contribution guidelines as they seem to have been deleted or moved locations: https://github.com/cph-cachet/flutter-plugins/CONTRIBUTING.md

Description

This PR aims to expand the Health package to support micro nutrients for reading and writing from Health Connect, Google Fit (to be deprecated), and Apple Health.

Nutrients we added based on the health platforms' documentation https://developer.apple.com/documentation/healthkit/data_types/nutrition_type_identifiers https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/NutritionRecord https://developers.google.com/fit/scenarios/add-nutrition-data

My intentions we to avoid any API breaking changes. I did do some clean-up on the method channel API as there seemed to be a mix of snake_case and camelCase being used.

I did change the NutritionHealthValue.fromHealthDataPoint factory, which may not be desirable, but I a open to changing that if desired.

It also seems like the ios plugin was only reading a single food in the getData method, so I also updated that code to grab all foods and return them.

Panosfunk commented 1 day ago

Hello @davidpryor, since Google Fit is to be deprecated we want to start removing its support from the plugin. Therefore this needs to be removed not only from this PR before it is merged, but from the entire plugin. It would save us a lot of time if this is something you could look into.

davidpryor commented 1 day ago

Hello @davidpryor, since Google Fit is to be deprecated we want to start removing its support from the plugin. Therefore this needs to be removed not only from this PR before it is merged, but from the entire plugin. It would save us a lot of time if this is something you could look into.

Hey @Panosfunk! Thanks for the reply. Do you mean revert any changes I made to the structure of Google Fit data (like lines 917 to 965 in the kotlin code) or do you want me to do something more?

I commented on the Google Fit support issue. I wasn't sure if that was actively being worked yet or not. I am looking forward to removing the Google Fit code myself 😎

davidpryor commented 1 day ago

Hello @davidpryor, since Google Fit is to be deprecated we want to start removing its support from the plugin. Therefore this needs to be removed not only from this PR before it is merged, but from the entire plugin. It would save us a lot of time if this is something you could look into.

I went ahead and rolled back the changes to writeMeal for the Google Fit implementation.

Panosfunk commented 12 hours ago

Hey @davidpryor, if you're willing to do the same for the entirety of the health package that would be of great help, if not then we are still very grateful for your contribution to the package!

davidpryor commented 12 hours ago

Hey @davidpryor, if you're willing to do the same for the entirety of the health package that would be of great help, if not then we are still very grateful for your contribution to the package!

@Panosfunk I can look into stripping it out, but would prefer it be a separate PR.

Panosfunk commented 9 hours ago

Yes, that would be better.