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
61a1e7c2
Commit
61a1e7c2
authored
Feb 26, 2019
by
Evgeny Evstropov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change back default to imperial system, add activity name field, fix docs
parent
3f919874
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
37 deletions
+27
-37
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
+4
-15
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
+2
-1
README.md
README.md
+19
-19
docs/getSamples().md
docs/getSamples().md
+2
-2
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
View file @
61a1e7c2
...
@@ -18,10 +18,7 @@
...
@@ -18,10 +18,7 @@
{
{
HKQuantityType
*
weightType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierBodyMass
];
HKQuantityType
*
weightType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierBodyMass
];
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
gramUnitWithMetricPrefix
:
HKMetricPrefixKilo
]];
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
poundUnit
]];
if
(
unit
==
nil
){
unit
=
[
HKUnit
gramUnit
];
}
[
self
fetchMostRecentQuantitySampleOfType
:
weightType
[
self
fetchMostRecentQuantitySampleOfType
:
weightType
predicate:
nil
predicate:
nil
...
@@ -151,11 +148,7 @@
...
@@ -151,11 +148,7 @@
-
(
void
)
body_getLatestHeight
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
-
(
void
)
body_getLatestHeight
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
{
HKQuantityType
*
heightType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierHeight
];
HKQuantityType
*
heightType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierHeight
];
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
inchUnit
]];;
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
meterUnitWithMetricPrefix
:
HKMetricPrefixCenti
]];;
if
(
unit
==
nil
){
unit
=
[
HKUnit
meterUnit
];
}
[
self
fetchMostRecentQuantitySampleOfType
:
heightType
[
self
fetchMostRecentQuantitySampleOfType
:
heightType
predicate:
nil
predicate:
nil
...
@@ -217,11 +210,7 @@
...
@@ -217,11 +210,7 @@
{
{
double
height
=
[
RCTAppleHealthKit
doubleValueFromOptions
:
input
];
double
height
=
[
RCTAppleHealthKit
doubleValueFromOptions
:
input
];
NSDate
*
sampleDate
=
[
RCTAppleHealthKit
dateFromOptionsDefaultNow
:
input
];
NSDate
*
sampleDate
=
[
RCTAppleHealthKit
dateFromOptionsDefaultNow
:
input
];
HKUnit
*
heightUnit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
inchUnit
]];
HKUnit
*
heightUnit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
inchUnit
]];;
if
(
heightUnit
==
nil
){
heightUnit
=
[
HKUnit
inchUnit
];
}
HKQuantity
*
heightQuantity
=
[
HKQuantity
quantityWithUnit
:
heightUnit
doubleValue
:
height
];
HKQuantity
*
heightQuantity
=
[
HKQuantity
quantityWithUnit
:
heightUnit
doubleValue
:
height
];
HKQuantityType
*
heightType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierHeight
];
HKQuantityType
*
heightType
=
[
HKQuantityType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierHeight
];
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
View file @
61a1e7c2
...
@@ -156,7 +156,8 @@
...
@@ -156,7 +156,8 @@
}
}
NSDictionary
*
elem
=
@{
NSDictionary
*
elem
=
@{
@"activityNameId"
:
[
NSNumber
numberWithInt
:[
sample
workoutActivityType
]],
@"activityId"
:
[
NSNumber
numberWithInt
:[
sample
workoutActivityType
]],
@"activityName"
:
type
,
@"calories"
:
@
(
energy
),
@"calories"
:
@
(
energy
),
@"tracked"
:
@
(
isTracked
),
@"tracked"
:
@
(
isTracked
),
@"sourceName"
:
[[[
sample
sourceRevision
]
source
]
name
],
@"sourceName"
:
[[[
sample
sourceRevision
]
source
]
name
],
...
...
README.md
View file @
61a1e7c2
...
@@ -108,34 +108,34 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
...
@@ -108,34 +108,34 @@ AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) =>
*
[
getActiveEnergyBurned
](
/docs/getActiveEnergyBurned(
)
.md)
*
[
getActiveEnergyBurned
](
/docs/getActiveEnergyBurned(
)
.md)
*
[
getBasalEnergyBurned
](
/docs/getBasalEnergyBurned(
)
.md)
*
[
getBasalEnergyBurned
](
/docs/getBasalEnergyBurned(
)
.md)
*
[
getBiologicalSex
](
/docs/getBiologicalSex(
)
.md)
*
[
getBiologicalSex
](
/docs/getBiologicalSex(
)
.md)
*
[
getBloodGlucoseSamples
](
/docs/get
bloodglucoses
amples(
)
.md)
*
[
getBloodGlucoseSamples
](
/docs/get
BloodglucoseS
amples(
)
.md)
*
[
getBloodPressureSamples
](
/docs/get
bloodpressures
amples(
)
.md)
*
[
getBloodPressureSamples
](
/docs/get
BloodPressureS
amples(
)
.md)
*
[
getBodyTemperatureSamples
](
/docs/get
bodytemperatures
amples(
)
.md)
*
[
getBodyTemperatureSamples
](
/docs/get
BodyTemperatureS
amples(
)
.md)
*
[
getDailyDistanceCyclingSamples
](
)
*
[
getDailyDistanceCyclingSamples
](
/docs/getDailyDistanceCyclingSamples(
)
.md
)
*
[
getDailyDistanceWalkingRunningSamples
](
/docs/getDailyDistanceWalkingRunningSamples(
)
.md)
*
[
getDailyDistanceWalkingRunningSamples
](
/docs/getDailyDistanceWalkingRunningSamples(
)
.md)
*
[
getDailyFlightsClimbedSamples
](
/docs/getDailyFlightsClimbedSamples(
)
.md)
*
[
getDailyFlightsClimbedSamples
](
/docs/getDailyFlightsClimbedSamples(
)
.md)
*
[
getDailyStepCountSamples
](
/docs/getDailyStepCountSamples(
)
.md)
*
[
getDailyStepCountSamples
](
/docs/getDailyStepCountSamples(
)
.md)
*
[
getDateOfBirth
](
/docs/getDateOfBirth(
)
.md)
*
[
getDateOfBirth
](
/docs/getDateOfBirth(
)
.md)
*
[
getDistanceCycling
](
/docs/get
distancec
ycling(
)
.md)
*
[
getDistanceCycling
](
/docs/get
DistanceC
ycling(
)
.md)
*
[
getDistanceWalkingRunning
](
/docs/getDistanceWalkingRunning(
)
.md)
*
[
getDistanceWalkingRunning
](
/docs/getDistanceWalkingRunning(
)
.md)
*
[
getFlightsClimbed
](
/docs/get
flightsc
limbed(
)
.md)
*
[
getFlightsClimbed
](
/docs/get
FlightsC
limbed(
)
.md)
*
[
getHeartRateSamples
](
/docs/get
heartrates
amples(
)
.md)
*
[
getHeartRateSamples
](
/docs/get
HeartRateS
amples(
)
.md)
*
[
getHeightSamples
](
/docs/get
heights
amples(
)
.md)
*
[
getHeightSamples
](
/docs/get
HeightS
amples(
)
.md)
*
[
getLatestBmi
](
/docs/get
latestb
mi(
)
.md)
*
[
getLatestBmi
](
/docs/get
LatestB
mi(
)
.md)
*
[
getLatestBodyFatPercentage
](
/docs/get
latestbodyfatp
ercentage(
)
.md)
*
[
getLatestBodyFatPercentage
](
/docs/get
LatestBodyFatP
ercentage(
)
.md)
*
[
getLatestHeight
](
/docs/get
latesth
eight(
)
.md)
*
[
getLatestHeight
](
/docs/get
LatestH
eight(
)
.md)
*
[
getLatestLeanBodyMass
](
/docs/get
latestleanbodym
ass(
)
.md)
*
[
getLatestLeanBodyMass
](
/docs/get
LatestLeanBodyM
ass(
)
.md)
*
[
getLatestWeight
](
/docs/get
latestw
eight(
)
.md)
*
[
getLatestWeight
](
/docs/get
LatestW
eight(
)
.md)
*
[
getRespiratoryRateSamples
](
/docs/get
respiratoryrates
amples(
)
.md)
*
[
getRespiratoryRateSamples
](
/docs/get
RespiratoryRateS
amples(
)
.md)
*
[
getSleepSamples
](
/docs/get
sleeps
amples(
)
.md)
*
[
getSleepSamples
](
/docs/get
SleepS
amples(
)
.md)
*
[
getStepCount
](
/docs/getStepCount(
)
.md)
*
[
getStepCount
](
/docs/getStepCount(
)
.md)
*
[
getWeightSamples
](
/docs/get
weights
amples(
)
.md)
*
[
getWeightSamples
](
/docs/get
WeightS
amples(
)
.md)
*
[
getSamples
](
docs/getSamples(
)
.md)
*
[
getSamples
](
docs/getSamples(
)
.md)
*
Write Methods
*
Write Methods
*
[
saveBmi
](
/docs/save
b
mi(
)
.md)
*
[
saveBmi
](
/docs/save
B
mi(
)
.md)
*
[
saveHeight
](
/docs/save
h
eight(
)
.md)
*
[
saveHeight
](
/docs/save
H
eight(
)
.md)
*
[
saveMindfulSession
](
/docs/saveMindfulSession(
)
.md)
*
[
saveMindfulSession
](
/docs/saveMindfulSession(
)
.md)
*
[
saveWeight
](
/docs/save
w
eight(
)
.md)
*
[
saveWeight
](
/docs/save
W
eight(
)
.md)
*
[
saveSteps
](
/docs/saveSteps(
)
.md)
*
[
saveSteps
](
/docs/saveSteps(
)
.md)
*
[
References
](
#references
)
*
[
References
](
#references
)
...
...
docs/getSamples().md
View file @
61a1e7c2
...
@@ -23,7 +23,8 @@ Resulting object has different fields for different types.
...
@@ -23,7 +23,8 @@ Resulting object has different fields for different types.
In case of workout:
In case of workout:
```
```
{
{
activityNameId: Number, // [NSNumber numberWithInt:[sample workoutActivityType]]
activityId: Number, // [NSNumber numberWithInt:[sample workoutActivityType]]
activityName: Number, // [RCTAppleHealthKit stringForHKWorkoutActivityType:[sample workoutActivityType]]
calories: Number, // [[sample totalEnergyBurned] doubleValueForUnit:[HKUnit kilocalorieUnit]]
calories: Number, // [[sample totalEnergyBurned] doubleValueForUnit:[HKUnit kilocalorieUnit]]
tracked: Boolean, // [[sample metadata][HKMetadataKeyWasUserEntered] intValue] !== 1
tracked: Boolean, // [[sample metadata][HKMetadataKeyWasUserEntered] intValue] !== 1
sourceName: String, // [[[sample sourceRevision] source] name]
sourceName: String, // [[[sample sourceRevision] source] name]
...
@@ -37,7 +38,6 @@ In case of workout:
...
@@ -37,7 +38,6 @@ In case of workout:
for other types:
for other types:
```
```
{
{
activityNameId: Number, // [NSNumber numberWithInt:[sample workoutActivityType]]
tracked: Boolean, // [[sample metadata][HKMetadataKeyWasUserEntered] intValue] !== 1
tracked: Boolean, // [[sample metadata][HKMetadataKeyWasUserEntered] intValue] !== 1
sourceName: String, // [[[sample sourceRevision] source] name]
sourceName: String, // [[[sample sourceRevision] source] name]
sourceId: String, // [[[sample sourceRevision] source] bundleIdentifier]
sourceId: String, // [[[sample sourceRevision] source] bundleIdentifier]
...
...
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