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
f50b6e18
Commit
f50b6e18
authored
Oct 04, 2017
by
Terrillo Walls
Committed by
GitHub
Oct 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getActiveEnergyBurned() (#5)
* getActiveEnergyBurned * Docs update * Version update * Docs fix
parent
b198cbd6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
1 deletion
+74
-1
RCTAppleHealthKit.xcodeproj/project.pbxproj
RCTAppleHealthKit.xcodeproj/project.pbxproj
+6
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
+14
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
+45
-0
RCTAppleHealthKit/RCTAppleHealthKit.m
RCTAppleHealthKit/RCTAppleHealthKit.m
+6
-0
README.md
README.md
+2
-0
package.json
package.json
+1
-1
No files found.
RCTAppleHealthKit.xcodeproj/project.pbxproj
View file @
f50b6e18
...
...
@@ -16,6 +16,7 @@
3774C8D71D20C65F0000B3F3
/* RCTAppleHealthKit+Methods_Fitness.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3774C8D61D20C65F0000B3F3
/* RCTAppleHealthKit+Methods_Fitness.m */
;
};
377D44F31D247D0A004E35CB
/* RCTAppleHealthKit+Methods_Characteristic.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
377D44F21D247D0A004E35CB
/* RCTAppleHealthKit+Methods_Characteristic.m */
;
};
37837E7D1DCFE270000201A0
/* RCTAppleHealthKit+Methods_Sleep.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
37837E7C1DCFE270000201A0
/* RCTAppleHealthKit+Methods_Sleep.m */
;
};
58C81E6F1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
58C81E6D1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.m */
;
};
61232F931E303758000A5026
/* RCTAppleHealthKit+Methods_Mindfulness.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
61232F921E303758000A5026
/* RCTAppleHealthKit+Methods_Mindfulness.m */
;
};
64C42D4A1D351A8800A0A8F7
/* RCTAppleHealthKit+Methods_Vitals.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
64C42D491D351A8800A0A8F7
/* RCTAppleHealthKit+Methods_Vitals.m */
;
};
64E0E73F1D37947B00EAB905
/* RCTAppleHealthKit+Methods_Results.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
64E0E73E1D37947B00EAB905
/* RCTAppleHealthKit+Methods_Results.m */
;
};
...
...
@@ -52,6 +53,8 @@
377D44F21D247D0A004E35CB
/* RCTAppleHealthKit+Methods_Characteristic.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"RCTAppleHealthKit+Methods_Characteristic.m"
;
sourceTree
=
"<group>"
;
};
37837E7B1DCFE270000201A0
/* RCTAppleHealthKit+Methods_Sleep.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"RCTAppleHealthKit+Methods_Sleep.h"
;
sourceTree
=
"<group>"
;
};
37837E7C1DCFE270000201A0
/* RCTAppleHealthKit+Methods_Sleep.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"RCTAppleHealthKit+Methods_Sleep.m"
;
sourceTree
=
"<group>"
;
};
58C81E6D1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"RCTAppleHealthKit+Methods_Activity.m"
;
sourceTree
=
"<group>"
;
};
58C81E6E1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"RCTAppleHealthKit+Methods_Activity.h"
;
sourceTree
=
"<group>"
;
};
61232F911E303758000A5026
/* RCTAppleHealthKit+Methods_Mindfulness.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"RCTAppleHealthKit+Methods_Mindfulness.h"
;
sourceTree
=
"<group>"
;
};
61232F921E303758000A5026
/* RCTAppleHealthKit+Methods_Mindfulness.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"RCTAppleHealthKit+Methods_Mindfulness.m"
;
sourceTree
=
"<group>"
;
};
64C42D481D351A8800A0A8F7
/* RCTAppleHealthKit+Methods_Vitals.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"RCTAppleHealthKit+Methods_Vitals.h"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -90,6 +93,8 @@
3774C88F1D2092F20000B3F3
/* RCTAppleHealthKit */
=
{
isa
=
PBXGroup
;
children
=
(
58C81E6E1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.h */
,
58C81E6D1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.m */
,
61232F911E303758000A5026
/* RCTAppleHealthKit+Methods_Mindfulness.h */
,
61232F921E303758000A5026
/* RCTAppleHealthKit+Methods_Mindfulness.m */
,
64E0E73D1D37947B00EAB905
/* RCTAppleHealthKit+Methods_Results.h */
,
...
...
@@ -183,6 +188,7 @@
377D44F31D247D0A004E35CB
/* RCTAppleHealthKit+Methods_Characteristic.m in Sources */
,
3774C89E1D2095850000B3F3
/* RCTAppleHealthKit+TypesAndPermissions.m in Sources */
,
3774C8D71D20C65F0000B3F3
/* RCTAppleHealthKit+Methods_Fitness.m in Sources */
,
58C81E6F1F84F6970005DD48
/* RCTAppleHealthKit+Methods_Activity.m in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
0 → 100644
View file @
f50b6e18
//
// RCTAppleHealthKit+Methods_Activity.h
// RCTAppleHealthKit
//
// Created by Alexander Vallorosi on 4/27/17.
// Copyright © 2017 Alexander Vallorosi. All rights reserved.
//
#import "RCTAppleHealthKit.h"
@interface
RCTAppleHealthKit
(
Methods_Activity
)
-
(
void
)
activity_getActiveEnergyBurned
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
@end
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
0 → 100644
View file @
f50b6e18
//
// RCTAppleHealthKit+Methods_Activity.m
// RCTAppleHealthKit
//
// Created by Alexander Vallorosi on 4/27/17.
// Copyright © 2017 Alexander Vallorosi. All rights reserved.
//
#import "RCTAppleHealthKit+Methods_Activity.h"
#import "RCTAppleHealthKit+Queries.h"
#import "RCTAppleHealthKit+Utils.h"
@implementation
RCTAppleHealthKit
(
Methods_Activity
)
-
(
void
)
activity_getActiveEnergyBurned
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
HKQuantityType
*
activeEnergyType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierActiveEnergyBurned
];
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
:
activeEnergyType
unit:
cal
predicate:
predicate
ascending:
false
limit:
HKObjectQueryNoLimit
completion:
^
(
NSArray
*
results
,
NSError
*
error
)
{
if
(
results
){
callback
(@[[
NSNull
null
],
results
]);
return
;
}
else
{
NSLog
(
@"error getting active energy burned samples: %@"
,
error
);
callback
(@[
RCTMakeError
(
@"error getting active energy burned samples"
,
nil
,
nil
)]);
return
;
}
}];
}
@end
RCTAppleHealthKit/RCTAppleHealthKit.m
View file @
f50b6e18
...
...
@@ -9,6 +9,7 @@
#import "RCTAppleHealthKit.h"
#import "RCTAppleHealthKit+TypesAndPermissions.h"
#import "RCTAppleHealthKit+Methods_Activity.h"
#import "RCTAppleHealthKit+Methods_Body.h"
#import "RCTAppleHealthKit+Methods_Fitness.h"
#import "RCTAppleHealthKit+Methods_Characteristic.h"
...
...
@@ -135,6 +136,11 @@ RCT_EXPORT_METHOD(getHeartRateSamples:(NSDictionary *)input callback:(RCTRespons
[
self
vitals_getHeartRateSamples
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
getActiveEnergyBurned
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
activity_getActiveEnergyBurned
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
getBodyTemperatureSamples
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
vitals_getBodyTemperatureSamples
:
input
callback
:
callback
];
...
...
README.md
View file @
f50b6e18
...
...
@@ -88,6 +88,7 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
*
Realtime Methods
*
[
initStepCountObserver
](
https://github.com/terrillo/rn-apple-healthkit/wiki/initStepCountObserver(
)
)
*
Read Methods
*
[
getActiveEnergyBurned
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getActiveEnergyBurned(
)
)
*
[
getBiologicalSex
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getBiologicalSex(
)
)
*
[
getBloodGlucoseSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodglucosesamples(
)
)
*
[
getBloodPressureSamples
](
https://github.com/terrillo/rn-apple-healthkit/wiki/getbloodpressuresamples(
)
)
...
...
@@ -122,6 +123,7 @@ The available Healthkit permissions to use with `initHealthKit`
| Permission | Healthkit Identifier Type | Read | Write |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|-------|
| ActiveEnergyBurned |
[
HKCharacteristicTypeIdentifierActiveEnergyBurned
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier/1615771-activeenergyburned?language=objc
)
| ✓ | |
| BiologicalSex |
[
HKCharacteristicTypeIdentifierBiologicalSex
](
https://developer.apple.com/reference/Healthkit/hkcharacteristictypeidentifierbiologicalsex?language=objc
)
| ✓ | |
| BloodGlucose |
[
HKQuantityTypeIdentifierBloodGlucose
](
https://developer.apple.com/reference/Healthkit/hkquantitytypeidentifierbloodglucose?language=objc
)
| ✓ | |
| BloodPressureDiastolic |
[
HKQuantityTypeIdentifierBloodPressureDiastolic
](
https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierbloodpressurediastolic?language=objc
)
| ✓ | ✓ |
...
...
package.json
View file @
f50b6e18
{
"name"
:
"rn-apple-healthkit"
,
"version"
:
"0.6.
0
"
,
"version"
:
"0.6.
1
"
,
"description"
:
"A React Native package for interacting with Apple HealthKit"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
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