Add queryStatisticsCollectionForQuantity
Hi @robertherber - tested this out and works for getting data out. Wanted to run it by you, looking more at it I'm realizing there's some type definition issues. I can iron those out if you think this is on the right path.
Also, I have XCode 15 and had to make some pretty messy changes to the examples/ almost to the point I'm not sure it's reproducible. I'll check in those changes on another branch updated-example
Expo preview is ready for review.
There should soon be a new native build available here
With that installed just scan this QR code:
I think this looks good! 👍 An update to make the example run in XCode 15 (I haven't done it myself yet) would be nice as well, but it would fit better in a PR of its own.
Two things before we merge this PR:
- The linting fixes. If you run
yarn lint --fixit should take care of itself :) - It would be nice with an entry in the example app, I see you have that in the other branch already.
@davidyang Hope I didn't put you off. To clarify - I'd be happy to merge this if the linting goes through :) Let me know if you need any support.
Hi Robert - definitely not, just busy with other stuff, hope to get back to this shortly! Thanks for the follow-up, appreciate it!
On Wed, Nov 15, 2023 at 6:44 PM Robert Herber @.***> wrote:
@davidyang https://github.com/davidyang Hope I didn't put you off. To be clear I'd be happy to merge this if the linting goes through :)
— Reply to this email directly, view it on GitHub https://github.com/kingstinct/react-native-healthkit/pull/83#issuecomment-1813473752, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACNRMP6NRNK377DOXBFBLYEVHVVAVCNFSM6AAAAAA6YJO4GSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGQ3TGNZVGI . You are receiving this because you were mentioned.Message ID: @.***>
+1
was able to integrate this PR into my project, but I couldnt get code hints.
In addition, there seems to be an issue, as the sumQuantity object sometimes gives me a quantity number that is a double for HKQuantityTypeIdentifier.stepCount (expected whole number as the unit is count).
anchorDate doesn't seem to work but I may be using it wrong. Tried to replace the code with a static date inside the library and still didn't seem to return relevant data.
Today is Feb 8, but I get some values that seem to be reported on Feb 9 and 10?
I will be happy to test again if needed. Here is some sample data:
[
{
"sumQuantity": {
"endDate": "2021-07-22T23:00:00Z",
"quantity": 23,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2021-07-21T23:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2021-07-24T23:00:00Z",
"quantity": 593,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2021-07-23T23:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-02T00:00:00Z",
"quantity": 2,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-01T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-03T00:00:00Z",
"quantity": 799.3534183322977,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-02T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-04T00:00:00Z",
"quantity": 1250,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-03T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-05T00:00:00Z",
"quantity": 491,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-04T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-07T00:00:00Z",
"quantity": 4497.503525622739,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-06T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-08T00:00:00Z",
"quantity": 3561,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-07T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-09T00:00:00Z",
"quantity": 36,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-08T00:00:00Z",
"unit": "count"
}
},
{
"sumQuantity": {
"endDate": "2024-02-10T00:00:00Z",
"quantity": 500,
"quantityType": "HKQuantityTypeIdentifierStepCount",
"startDate": "2024-02-09T00:00:00Z",
"unit": "count"
}
}
]
@robertherber (CC: @davidyang )
Resolved lint errors, added an entry in the example app and did some refactors. Should I make a separate PR?
https://github.com/taisuke-j/react-native-healthkit/commit/851ab0f4ba311f963607774170a4960e1df31b0d
@robertherber (CC: @davidyang )
Resolved lint errors, added an entry in the example app and did some refactors. Should I make a separate PR?
Yeah, I guess it's easier as a separate PR 👍 Thanks both of you @davidyang and @taisuke-j for contributing! 🙂
@robertherber No problem! Here is the PR: https://github.com/kingstinct/react-native-healthkit/pull/111
Closing since this was merged with #111, thanks guys!