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
7c741d25
Commit
7c741d25
authored
Jun 28, 2016
by
Greg Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added fitness_getStepCountForDay method
parent
f3f15d4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
+1
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
+24
-0
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
View file @
7c741d25
...
@@ -11,5 +11,6 @@
...
@@ -11,5 +11,6 @@
@interface
RCTAppleHealthKit
(
Methods_Fitness
)
@interface
RCTAppleHealthKit
(
Methods_Fitness
)
-
(
void
)
fitness_getStepCountForToday
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getStepCountForToday
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getStepCountForDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
@end
@end
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
View file @
7c741d25
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#import "RCTAppleHealthKit+Methods_Fitness.h"
#import "RCTAppleHealthKit+Methods_Fitness.h"
#import "RCTAppleHealthKit+Queries.h"
#import "RCTAppleHealthKit+Queries.h"
#import "RCTAppleHealthKit+Utils.h"
@implementation
RCTAppleHealthKit
(
Methods_Fitness
)
@implementation
RCTAppleHealthKit
(
Methods_Fitness
)
...
@@ -27,4 +28,27 @@
...
@@ -27,4 +28,27 @@
}];
}];
}
}
-
(
void
)
fitness_getStepCountForDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
NSDate
*
date
=
[
RCTAppleHealthKit
dateFromOptions
:
input
];
if
(
date
==
nil
)
{
callback
(@[
RCTMakeError
(
@"could not parse date from options.date"
,
nil
,
nil
)]);
return
;
}
HKQuantityType
*
stepCountType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
HKUnit
*
stepsUnit
=
[
HKUnit
countUnit
];
[
self
fetchSumOfSamplesOnDayForType
:
stepCountType
unit
:
stepsUnit
day
:
date
completion
:^
(
double
totalSteps
,
NSError
*
error
)
{
if
(
!
totalSteps
)
{
NSLog
(
@"could not fetch step count for day: %@"
,
error
);
callback
(@[
RCTMakeError
(
@"could not fetch step count for day"
,
error
,
nil
)]);
return
;
}
callback
(@[[
NSNull
null
],
@
(
totalSteps
)]);
}];
}
@end
@end
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