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
fd433d53
Commit
fd433d53
authored
Feb 04, 2018
by
Evgenii Evstropov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support multiple types of retrieving samples (just names confusing)
parent
dda3ea95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
+14
-3
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
+0
-1
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
View file @
fd433d53
...
...
@@ -54,6 +54,7 @@
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
BOOL
isTracked
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"isTracked"
withDefault
:
true
];
NSString
*
type
=
[
RCTAppleHealthKit
stringFromOptions
:
input
key
:
@"type"
withDefault
:
@"Walking"
];
NSDate
*
startDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"startDate"
withDefault
:
nil
];
NSDate
*
endDate
=
[
RCTAppleHealthKit
dateFromOptions
:
input
key
:
@"endDate"
withDefault
:
[
NSDate
date
]];
if
(
startDate
==
nil
){
...
...
@@ -62,7 +63,6 @@
}
NSDateFormatter
*
formatter
=
[[
NSDateFormatter
alloc
]
init
];
[
formatter
setDateFormat
:
@"YYYY-MM-dd-hh-mm-ss"
];
NSLog
(
@"samples interval: %@ %@"
,[
formatter
stringFromDate
:
startDate
],
[
formatter
stringFromDate
:
endDate
]);
// no isTracked
NSArray
*
subPredicates
=
[[
NSArray
alloc
]
init
];
...
...
@@ -74,11 +74,22 @@
subPredicates
=
[
subPredicatesAux
copy
];
NSPredicate
*
predicate
=
[
NSCompoundPredicate
andPredicateWithSubpredicates
:
subPredicates
];
HKQuantityType
*
stepCountType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
HKQuantityType
*
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
if
([
type
isEqual
:
@"Walking"
])
{
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
}
else
if
([
type
isEqual
:
@"StairClimbing"
])
{
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierFlightsClimbed
];
}
else
if
([
type
isEqual
:
@"Running"
]){
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceWalkingRunning
];
unit
=
[
HKUnit
mileUnit
];
}
else
if
([
type
isEqual
:
@"Cycling"
]){
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceCycling
];
unit
=
[
HKUnit
mileUnit
];
}
NSString
*
paramName
=
@"isTracked"
;
[
self
fetchQuantitySamplesOfType
:
s
tepCount
Type
[
self
fetchQuantitySamplesOfType
:
s
amples
Type
unit:
unit
predicate:
predicate
ascending:
ascending
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
View file @
fd433d53
...
...
@@ -113,7 +113,6 @@
additionalParamName
:(
NSString
*
)
paramName
additionalParam
:(
BOOL
)
param
completion
:(
void
(
^
)(
NSArray
*
,
NSError
*
))
completion
{
NSSortDescriptor
*
timeSortDescriptor
=
[[
NSSortDescriptor
alloc
]
initWithKey
:
HKSampleSortIdentifierEndDate
ascending:
asc
];
...
...
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