Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rn-apple-healthkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ym
rn-apple-healthkit
Commits
749ec2bc
Commit
749ec2bc
authored
Nov 09, 2018
by
Terrillo Walls
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/moreDailyMethods' of
https://github.com/toml0006/rn-apple-healthkit
parents
26cd0c6d
ca5fd19c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
0 deletions
+109
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
+3
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
+88
-0
RCTAppleHealthKit/RCTAppleHealthKit.m
RCTAppleHealthKit/RCTAppleHealthKit.m
+15
-0
README.md
README.md
+3
-0
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
View file @
749ec2bc
...
@@ -16,7 +16,10 @@
...
@@ -16,7 +16,10 @@
-
(
void
)
fitness_saveSteps
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_saveSteps
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_initializeStepEventObserver
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_initializeStepEventObserver
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDistanceWalkingRunningOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDistanceWalkingRunningOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDailyDistanceWalkingRunningSamples
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDistanceCyclingOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDistanceCyclingOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDailyDistanceCyclingSamples
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getFlightsClimbedOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getFlightsClimbedOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDailyFlightsClimbedSamples
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
@end
@end
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
View file @
749ec2bc
...
@@ -165,6 +165,35 @@
...
@@ -165,6 +165,35 @@
}];
}];
}
}
-
(
void
)
fitness_getDailyDistanceWalkingRunningSamples
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
meterUnit
]];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
NSDate
*
startDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"startDate"
withDefault
:
nil
];
NSDate
*
endDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"endDate"
withDefault
:
[
NSDate
date
]];
if
(
startDate
==
nil
){
callback
(@[
RCTMakeError
(
@"startDate is required in options"
,
nil
,
nil
)]);
return
;
}
HKQuantityType
*
quantityType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceWalkingRunning
];
[
self
fetchCumulativeSumStatisticsCollection
:
quantityType
unit:
unit
startDate:
startDate
endDate:
endDate
ascending:
ascending
limit:
limit
completion:
^
(
NSArray
*
arr
,
NSError
*
err
){
if
(
err
!=
nil
)
{
NSLog
(
@"error with fetchCumulativeSumStatisticsCollection: %@"
,
err
);
callback
(@[
RCTMakeError
(
@"error with fetchCumulativeSumStatisticsCollection"
,
err
,
nil
)]);
return
;
}
callback
(@[[
NSNull
null
],
arr
]);
}];
}
-
(
void
)
fitness_getDistanceCyclingOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
-
(
void
)
fitness_getDistanceCyclingOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
{
...
@@ -190,6 +219,35 @@
...
@@ -190,6 +219,35 @@
}];
}];
}
}
-
(
void
)
fitness_getDailyDistanceCyclingSamples
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
meterUnit
]];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
NSDate
*
startDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"startDate"
withDefault
:
nil
];
NSDate
*
endDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"endDate"
withDefault
:
[
NSDate
date
]];
if
(
startDate
==
nil
){
callback
(@[
RCTMakeError
(
@"startDate is required in options"
,
nil
,
nil
)]);
return
;
}
HKQuantityType
*
quantityType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceCycling
];
[
self
fetchCumulativeSumStatisticsCollection
:
quantityType
unit:
unit
startDate:
startDate
endDate:
endDate
ascending:
ascending
limit:
limit
completion:
^
(
NSArray
*
arr
,
NSError
*
err
){
if
(
err
!=
nil
)
{
NSLog
(
@"error with fetchCumulativeSumStatisticsCollection: %@"
,
err
);
callback
(@[
RCTMakeError
(
@"error with fetchCumulativeSumStatisticsCollection"
,
err
,
nil
)]);
return
;
}
callback
(@[[
NSNull
null
],
arr
]);
}];
}
-
(
void
)
fitness_getFlightsClimbedOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
-
(
void
)
fitness_getFlightsClimbedOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
{
...
@@ -215,4 +273,34 @@
...
@@ -215,4 +273,34 @@
}];
}];
}
}
-
(
void
)
fitness_getDailyFlightsClimbedSamples
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
countUnit
]];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
NSDate
*
startDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"startDate"
withDefault
:
nil
];
NSDate
*
endDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"endDate"
withDefault
:
[
NSDate
date
]];
if
(
startDate
==
nil
){
callback
(@[
RCTMakeError
(
@"startDate is required in options"
,
nil
,
nil
)]);
return
;
}
HKQuantityType
*
quantityType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierFlightsClimbed
];
[
self
fetchCumulativeSumStatisticsCollection
:
quantityType
unit:
unit
startDate:
startDate
endDate:
endDate
ascending:
ascending
limit:
limit
completion:
^
(
NSArray
*
arr
,
NSError
*
err
){
if
(
err
!=
nil
)
{
NSLog
(
@"error with fetchCumulativeSumStatisticsCollection: %@"
,
err
);
callback
(@[
RCTMakeError
(
@"error with fetchCumulativeSumStatisticsCollection"
,
err
,
nil
)]);
return
;
}
callback
(@[[
NSNull
null
],
arr
]);
}];
}
@end
@end
RCTAppleHealthKit/RCTAppleHealthKit.m
View file @
749ec2bc
...
@@ -122,16 +122,31 @@ RCT_EXPORT_METHOD(getDistanceWalkingRunning:(NSDictionary *)input callback:(RCTR
...
@@ -122,16 +122,31 @@ RCT_EXPORT_METHOD(getDistanceWalkingRunning:(NSDictionary *)input callback:(RCTR
[
self
fitness_getDistanceWalkingRunningOnDay
:
input
callback
:
callback
];
[
self
fitness_getDistanceWalkingRunningOnDay
:
input
callback
:
callback
];
}
}
RCT_EXPORT_METHOD
(
getDailyDistanceWalkingRunningSamples
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
fitness_getDailyDistanceWalkingRunningSamples
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
getDistanceCycling
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
RCT_EXPORT_METHOD
(
getDistanceCycling
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
{
[
self
fitness_getDistanceCyclingOnDay
:
input
callback
:
callback
];
[
self
fitness_getDistanceCyclingOnDay
:
input
callback
:
callback
];
}
}
RCT_EXPORT_METHOD
(
getDailyDistanceCyclingSamples
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
fitness_getDailyDistanceCyclingSamples
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
getFlightsClimbed
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
RCT_EXPORT_METHOD
(
getFlightsClimbed
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
{
[
self
fitness_getFlightsClimbedOnDay
:
input
callback
:
callback
];
[
self
fitness_getFlightsClimbedOnDay
:
input
callback
:
callback
];
}
}
RCT_EXPORT_METHOD
(
getDailyFlightsClimbedSamples
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
fitness_getDailyFlightsClimbedSamples
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
saveFood
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
RCT_EXPORT_METHOD
(
saveFood
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
{
[
self
saveFood
:
input
callback
:
callback
];
[
self
saveFood
:
input
callback
:
callback
];
...
...
README.md
View file @
749ec2bc
...
@@ -104,6 +104,9 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
...
@@ -104,6 +104,9 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
*
[
getBloodGlucoseSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodglucosesamples(
)
)
*
[
getBloodGlucoseSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodglucosesamples(
)
)
*
[
getBloodPressureSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodpressuresamples(
)
)
*
[
getBloodPressureSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodpressuresamples(
)
)
*
[
getBodyTemperatureSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbodytemperaturesamples(
)
)
*
[
getBodyTemperatureSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbodytemperaturesamples(
)
)
*
[
getDailyDistanceCyclingSamples
](
)
*
[
getDailyDistanceWalkingRunningSamples
](
)
*
[
getDailyFlightsClimbedSamples
](
)
*
[
getDailyStepCountSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getDailyStepCountSamples(
)
)
*
[
getDailyStepCountSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getDailyStepCountSamples(
)
)
*
[
getDateOfBirth
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getDateOfBirth(
)
)
*
[
getDateOfBirth
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getDateOfBirth(
)
)
*
[
getDistanceCycling
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getdistancecycling(
)
)
*
[
getDistanceCycling
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getdistancecycling(
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment