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
1ff4dea2
Commit
1ff4dea2
authored
Dec 22, 2017
by
王品堯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
起迄時間回傳timestamp
parent
84423f99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
+13
-13
RCTAppleHealthKit/RCTAppleHealthKit+Utils.h
RCTAppleHealthKit/RCTAppleHealthKit+Utils.h
+1
-0
RCTAppleHealthKit/RCTAppleHealthKit+Utils.m
RCTAppleHealthKit/RCTAppleHealthKit+Utils.m
+8
-0
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
View file @
1ff4dea2
...
...
@@ -527,8 +527,8 @@
HKQuantity
*
quantity
=
sample
.
quantity
;
double
value
=
[
quantity
doubleValueForUnit
:
unit
];
NSString
*
startDateString
=
[
RCTAppleHealthKit
buildISO8601String
FromDate
:
sample
.
startDate
];
NSString
*
endDateString
=
[
RCTAppleHealthKit
buildISO8601String
FromDate
:
sample
.
endDate
];
int
startDateTimestamp
=
[
RCTAppleHealthKit
buildTimestamp
FromDate
:
sample
.
startDate
];
int
endDateTimestamp
=
[
RCTAppleHealthKit
buildTimestamp
FromDate
:
sample
.
endDate
];
NSString
*
deviceName
=
sample
.
device
.
name
?
sample
.
device
.
name
:
@""
;
NSString
*
deviceManufacturer
=
sample
.
device
.
manufacturer
?
sample
.
device
.
manufacturer
:
@""
;
...
...
@@ -552,8 +552,8 @@
NSDictionary
*
elem
=
@{
@"value"
:
@
(
value
),
@"startDate"
:
startDateString
,
@"endDate"
:
endDateString
,
@"startDate"
:
@
(
startDateTimestamp
)
,
@"endDate"
:
@
(
endDateTimestamp
)
,
@"deviceName"
:
deviceName
,
@"deviceManufacturer"
:
deviceManufacturer
,
@"deviceHardware"
:
deviceHardwareVer
,
...
...
@@ -619,13 +619,13 @@
dispatch_async
(
dispatch_get_main_queue
(),
^
{
for
(
HKCorrelation
*
sample
in
sampleObjects
)
{
NSString
*
startDateString
=
[
RCTAppleHealthKit
buildISO8601String
FromDate
:
sample
.
startDate
];
NSString
*
endDateString
=
[
RCTAppleHealthKit
buildISO8601String
FromDate
:
sample
.
endDate
];
int
startDateTimestamp
=
[
RCTAppleHealthKit
buildTimestamp
FromDate
:
sample
.
startDate
];
int
endDateTimestamp
=
[
RCTAppleHealthKit
buildTimestamp
FromDate
:
sample
.
endDate
];
NSDictionary
*
elem
=
@{
@"correlation"
:
sample
,
@"startDate"
:
startDateString
,
@"endDate"
:
endDateString
,
@"startDate"
:
@
(
startDateTimestamp
)
,
@"endDate"
:
@
(
endDateTimestamp
)
,
};
[
data
addObject
:
elem
];
}
...
...
@@ -683,8 +683,8 @@
for
(
HKCategorySample
*
sample
in
sampleObjects
)
{
NSInteger
val
=
sample
.
value
;
NSString
*
startDateString
=
[
RCTAppleHealthKit
buildISO8601String
FromDate
:
sample
.
startDate
];
NSString
*
endDateString
=
[
RCTAppleHealthKit
buildISO8601String
FromDate
:
sample
.
endDate
];
int
startDateTimestamp
=
[
RCTAppleHealthKit
buildTimestamp
FromDate
:
sample
.
startDate
];
int
endDateTimestamp
=
[
RCTAppleHealthKit
buildTimestamp
FromDate
:
sample
.
endDate
];
NSString
*
valueString
=
[
NSString
stringWithFormat
:
@"%d"
,
val
];
...
...
@@ -710,8 +710,8 @@
NSDictionary
*
elem
=
@{
@"value"
:
valueString
,
@"startDate"
:
startDateString
,
@"endDate"
:
endDateString
,
@"startDate"
:
@
(
startDateTimestamp
)
,
@"endDate"
:
@
(
endDateTimestamp
)
,
@"deviceName"
:
deviceName
,
@"deviceManufacturer"
:
deviceManufacturer
,
@"deviceHardware"
:
deviceHardwareVer
,
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Utils.h
View file @
1ff4dea2
...
...
@@ -12,6 +12,7 @@
+
(
NSDate
*
)
parseISO8601DateFromString
:(
NSString
*
)
date
;
+
(
NSString
*
)
buildISO8601StringFromDate
:(
NSDate
*
)
date
;
+
(
int
)
buildTimestampFromDate
:(
NSDate
*
)
date
;
+
(
NSPredicate
*
)
predicateForSamplesToday
;
+
(
NSPredicate
*
)
predicateForSamplesOnDay
:(
NSDate
*
)
date
;
+
(
NSPredicate
*
)
predicateForSamplesBetweenDates
:(
NSDate
*
)
startDate
endDate
:(
NSDate
*
)
endDate
;
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Utils.m
View file @
1ff4dea2
...
...
@@ -33,6 +33,14 @@
}
+
(
int
)
buildTimestampFromDate
:(
NSDate
*
)
date
{
NSTimeInterval
interval
=
[
date
timeIntervalSince1970
];
NSNumber
*
timeStampObj
=
[
NSNumber
numberWithDouble
:
interval
];
return
[
timeStampObj
intValue
];
}
+
(
NSPredicate
*
)
predicateForSamplesToday
{
NSDate
*
now
=
[
NSDate
date
];
return
[
RCTAppleHealthKit
predicateForSamplesOnDay
:
now
];
...
...
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