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
c85fc759
Commit
c85fc759
authored
Feb 01, 2018
by
王品堯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HA-79
Anchor 不需使用 predicate
parent
c8e94936
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
36 deletions
+6
-36
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
+1
-9
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m
+1
-9
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m
+2
-16
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
+2
-2
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
View file @
c85fc759
...
@@ -87,20 +87,12 @@
...
@@ -87,20 +87,12 @@
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
countUnit
]];
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
countUnit
]];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
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
*
stepCountType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
HKQuantityType
*
stepCountType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
NSPredicate
*
predicate
=
[
RCTAppleHealthKit
predicateForSamplesBetweenDates
:
startDate
endDate
:
endDate
];
[
self
fetchQuantitySamplesOfTypeByAnchor
:
stepCountType
[
self
fetchQuantitySamplesOfTypeByAnchor
:
stepCountType
unit:
unit
unit:
unit
predicate:
predicate
predicate:
nil
ascending:
ascending
ascending:
ascending
limit:
limit
limit:
limit
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m
View file @
c85fc759
...
@@ -45,17 +45,9 @@
...
@@ -45,17 +45,9 @@
-
(
void
)
sleep_getSleepSamplesByAnchor
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
-
(
void
)
sleep_getSleepSamplesByAnchor
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
{
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
;
}
NSPredicate
*
predicate
=
[
RCTAppleHealthKit
predicateForSamplesBetweenDates
:
startDate
endDate
:
endDate
];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
[
self
fetchSleepCategorySamplesForPredicateByAnchor
:
predicate
[
self
fetchSleepCategorySamplesForPredicateByAnchor
:
nil
limit:
limit
limit:
limit
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
if
(
results
){
if
(
results
){
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Vitals.m
View file @
c85fc759
...
@@ -50,17 +50,10 @@
...
@@ -50,17 +50,10 @@
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
count
unitDividedByUnit
:
minute
]];
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
count
unitDividedByUnit
:
minute
]];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
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
;
}
NSPredicate
*
predicate
=
[
RCTAppleHealthKit
predicateForSamplesBetweenDates
:
startDate
endDate
:
endDate
];
[
self
fetchQuantitySamplesOfTypeByAnchor
:
heartRateType
[
self
fetchQuantitySamplesOfTypeByAnchor
:
heartRateType
unit:
unit
unit:
unit
predicate:
predicate
predicate:
nil
ascending:
ascending
ascending:
ascending
limit:
limit
limit:
limit
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
...
@@ -193,17 +186,10 @@
...
@@ -193,17 +186,10 @@
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
millimeterOfMercuryUnit
]];
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
millimeterOfMercuryUnit
]];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
NSUInteger
limit
=
[
RCTAppleHealthKit
uintFromOptions
:
input
key
:
@"limit"
withDefault
:
HKObjectQueryNoLimit
];
BOOL
ascending
=
[
RCTAppleHealthKit
boolFromOptions
:
input
key
:
@"ascending"
withDefault
:
false
];
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
;
}
NSPredicate
*
predicate
=
[
RCTAppleHealthKit
predicateForSamplesBetweenDates
:
startDate
endDate
:
endDate
];
[
self
fetchCorrelationSamplesOfTypeByAnchor
:
bloodPressureCorrelationType
[
self
fetchCorrelationSamplesOfTypeByAnchor
:
bloodPressureCorrelationType
unit:
unit
unit:
unit
predicate:
predicate
predicate:
nil
ascending:
ascending
ascending:
ascending
limit:
limit
limit:
limit
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
completion:
^
(
NSDictionary
*
results
,
NSError
*
error
)
{
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
View file @
c85fc759
...
@@ -568,7 +568,7 @@
...
@@ -568,7 +568,7 @@
HKQueryAnchor
*
anchor
=
[
NSKeyedUnarchiver
unarchiveObjectWithData
:
data
];
HKQueryAnchor
*
anchor
=
[
NSKeyedUnarchiver
unarchiveObjectWithData
:
data
];
HKAnchoredObjectQuery
*
anchorQuery
=
[[
HKAnchoredObjectQuery
alloc
]
initWithType
:
quantityType
HKAnchoredObjectQuery
*
anchorQuery
=
[[
HKAnchoredObjectQuery
alloc
]
initWithType
:
quantityType
predicate:
predicate
predicate:
nil
anchor:
anchor
anchor:
anchor
limit:
lim
limit:
lim
resultsHandler:
anchorHandlerBlock
];
resultsHandler:
anchorHandlerBlock
];
...
@@ -630,7 +630,7 @@
...
@@ -630,7 +630,7 @@
HKQueryAnchor
*
anchor
=
[
NSKeyedUnarchiver
unarchiveObjectWithData
:
data
];
HKQueryAnchor
*
anchor
=
[
NSKeyedUnarchiver
unarchiveObjectWithData
:
data
];
HKAnchoredObjectQuery
*
anchorQuery
=
[[
HKAnchoredObjectQuery
alloc
]
initWithType
:
quantityType
HKAnchoredObjectQuery
*
anchorQuery
=
[[
HKAnchoredObjectQuery
alloc
]
initWithType
:
quantityType
predicate:
predicate
predicate:
nil
anchor:
anchor
anchor:
anchor
limit:
lim
limit:
lim
resultsHandler:
anchorHandlerBlock
];
resultsHandler:
anchorHandlerBlock
];
...
...
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