cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
551 stars 681 forks source link

[Health] Expand Micro Nutrient Support #983

Closed davidpryor closed 3 months ago

davidpryor commented 5 months 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 4 months 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 4 months 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 4 months 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 4 months 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 4 months 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 4 months ago

Yes, that would be better.

davidpryor commented 4 months ago

@Panosfunk sounds good! I believe I removed google fit related code from this PR. I will look into removing google fit in a new PR soon.

SlimShadyIAm commented 3 months ago

Hi @davidpryor, have you already begun working on removing Google Fit? If not I can start to look into it.

davidpryor commented 3 months ago

Hi @davidpryor, have you already begun working on removing Google Fit? If not I can start to look into it.

Sorry for the delayed response. I have not and won't actually be able to focus on it any time soon, unfortunately.

Also, thank you for updating those docs for me! I completely forgot to.

SlimShadyIAm commented 3 months ago

No worries! Thanks for your contribution :)