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
0df666ea
Commit
0df666ea
authored
Nov 09, 2018
by
Terrillo Walls
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:terrillo/rn-apple-healthkit
parents
ff4d09cd
e0bf1bd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
1 deletion
+40
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
+1
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
+31
-0
RCTAppleHealthKit/RCTAppleHealthKit.m
RCTAppleHealthKit/RCTAppleHealthKit.m
+5
-0
README.md
README.md
+3
-1
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
View file @
0df666ea
...
@@ -10,5 +10,6 @@
...
@@ -10,5 +10,6 @@
@interface
RCTAppleHealthKit
(
Methods_Activity
)
@interface
RCTAppleHealthKit
(
Methods_Activity
)
-
(
void
)
activity_getActiveEnergyBurned
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
activity_getActiveEnergyBurned
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
activity_getBasalEnergyBurned
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
@end
@end
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
View file @
0df666ea
...
@@ -42,4 +42,35 @@
...
@@ -42,4 +42,35 @@
}];
}];
}
}
-
(
void
)
activity_getBasalEnergyBurned
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
HKQuantityType
*
basalEnergyType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierBasalEnergyBurned
];
NSDate
*
startDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"startDate"
withDefault
:
nil
];
NSDate
*
endDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"endDate"
withDefault
:
[
NSDate
date
]];
HKUnit
*
cal
=
[
HKUnit
kilocalorieUnit
];
if
(
startDate
==
nil
){
callback
(@[
RCTMakeError
(
@"startDate is required in options"
,
nil
,
nil
)]);
return
;
}
NSPredicate
*
predicate
=
[
RCTAppleHealthKit
predicateForSamplesBetweenDates
:
startDate
endDate
:
endDate
];
[
self
fetchQuantitySamplesOfType
:
basalEnergyType
unit:
cal
predicate:
predicate
ascending:
false
limit:
HKObjectQueryNoLimit
completion:
^
(
NSArray
*
results
,
NSError
*
error
)
{
if
(
results
){
callback
(@[[
NSNull
null
],
results
]);
return
;
}
else
{
NSLog
(
@"error getting basal energy burned samples: %@"
,
error
);
callback
(@[
RCTMakeError
(
@"error getting basal energy burned samples"
,
nil
,
nil
)]);
return
;
}
}];
}
@end
@end
RCTAppleHealthKit/RCTAppleHealthKit.m
View file @
0df666ea
...
@@ -152,6 +152,11 @@ RCT_EXPORT_METHOD(getActiveEnergyBurned:(NSDictionary *)input callback:(RCTRespo
...
@@ -152,6 +152,11 @@ RCT_EXPORT_METHOD(getActiveEnergyBurned:(NSDictionary *)input callback:(RCTRespo
[
self
activity_getActiveEnergyBurned
:
input
callback
:
callback
];
[
self
activity_getActiveEnergyBurned
:
input
callback
:
callback
];
}
}
RCT_EXPORT_METHOD
(
getBasalEnergyBurned
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
activity_getBasalEnergyBurned
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
getBodyTemperatureSamples
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
RCT_EXPORT_METHOD
(
getBodyTemperatureSamples
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
{
[
self
vitals_getBodyTemperatureSamples
:
input
callback
:
callback
];
[
self
vitals_getBodyTemperatureSamples
:
input
callback
:
callback
];
...
...
README.md
View file @
0df666ea
...
@@ -93,6 +93,7 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
...
@@ -93,6 +93,7 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
*
[
initStepCountObserver
](
https://github.com/terrillo/rn-apple-healthkit/wiki/initStepCountObserver(
)
)
*
[
initStepCountObserver
](
https://github.com/terrillo/rn-apple-healthkit/wiki/initStepCountObserver(
)
)
*
Read Methods
*
Read Methods
*
[
getActiveEnergyBurned
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getActiveEnergyBurned(
)
)
*
[
getActiveEnergyBurned
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getActiveEnergyBurned(
)
)
*
[
getBasalEnergyBurned
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getBasalEnergyBurned(
)
)
*
[
getBiologicalSex
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getBiologicalSex(
)
)
*
[
getBiologicalSex
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getBiologicalSex(
)
)
*
[
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(
)
)
...
@@ -127,7 +128,8 @@ The available Healthkit permissions to use with `initHealthKit`
...
@@ -127,7 +128,8 @@ The available Healthkit permissions to use with `initHealthKit`
| Permission | Healthkit Identifier Type | Read | Write |
| Permission | Healthkit Identifier Type | Read | Write |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|-------|
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|-------|
| ActiveEnergyBurned |
[
HKCharacteristicTypeIdentifierActiveEnergyBurned
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier/1615771-activeenergyburned?language=objc
)
| ✓ | |
| ActiveEnergyBurned |
[
HKQuantityTypeIdentifierActiveEnergyBurned
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier/1615771-activeenergyburned?language=objc
)
| ✓ | |
| BasalEnergyBurned |
[
HKQuantityTypeIdentifierBasalEnergyBurned
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier/1615512-basalenergyburned?language=objc
)
| ✓ | |
| BiologicalSex |
[
HKCharacteristicTypeIdentifierBiologicalSex
](
https://developer.apple.com/reference/Healthkit/hkcharacteristictypeidentifierbiologicalsex?language=objc
)
| ✓ | |
| BiologicalSex |
[
HKCharacteristicTypeIdentifierBiologicalSex
](
https://developer.apple.com/reference/Healthkit/hkcharacteristictypeidentifierbiologicalsex?language=objc
)
| ✓ | |
| BloodGlucose |
[
HKQuantityTypeIdentifierBloodGlucose
](
https://developer.apple.com/reference/Healthkit/hkquantitytypeidentifierbloodglucose?language=objc
)
| ✓ | |
| BloodGlucose |
[
HKQuantityTypeIdentifierBloodGlucose
](
https://developer.apple.com/reference/Healthkit/hkquantitytypeidentifierbloodglucose?language=objc
)
| ✓ | |
| BloodPressureDiastolic |
[
HKQuantityTypeIdentifierBloodPressureDiastolic
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierbloodpressurediastolic?language=objc
)
| ✓ | ✓ |
| BloodPressureDiastolic |
[
HKQuantityTypeIdentifierBloodPressureDiastolic
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierbloodpressurediastolic?language=objc
)
| ✓ | ✓ |
...
...
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