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
b3c187be
Commit
b3c187be
authored
Oct 11, 2016
by
Greg Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented fitness_initializeStepEventObserver and exported RCT initStepCountObserver method
parent
4c74ce16
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
+2
-0
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
+36
-0
RCTAppleHealthKit/RCTAppleHealthKit.m
RCTAppleHealthKit/RCTAppleHealthKit.m
+13
-2
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
View file @
b3c187be
...
...
@@ -18,6 +18,8 @@
-
(
void
)
fitness_saveSteps
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_initializeStepEventObserver
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDistanceWalkingRunningOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getDistanceCyclingOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
fitness_getFlightsClimbedOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
View file @
b3c187be
...
...
@@ -10,8 +10,12 @@
#import "RCTAppleHealthKit+Queries.h"
#import "RCTAppleHealthKit+Utils.h"
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"
@implementation
RCTAppleHealthKit
(
Methods_Fitness
)
//- (void)fitness_getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback
//{
// HKQuantityType *stepCountType = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount];
...
...
@@ -156,6 +160,38 @@
-
(
void
)
fitness_initializeStepEventObserver
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
HKSampleType
*
sampleType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
HKObserverQuery
*
query
=
[[
HKObserverQuery
alloc
]
initWithSampleType:
sampleType
predicate:
nil
updateHandler:
^
(
HKObserverQuery
*
query
,
HKObserverQueryCompletionHandler
completionHandler
,
NSError
*
error
)
{
if
(
error
)
{
// Perform Proper Error Handling Here...
NSLog
(
@"*** An error occured while setting up the stepCount observer. %@ ***"
,
error
.
localizedDescription
);
callback
(@[
RCTMakeError
(
@"An error occured while setting up the stepCount observer"
,
error
,
nil
)]);
return
;
}
[
self
.
bridge
.
eventDispatcher
sendAppEventWithName
:
@"change:steps"
body:
@{
@"name"
:
@"change:steps"
}];
// If you have subscribed for background updates you must call the completion handler here.
// completionHandler();
}];
[
self
.
healthStore
executeQuery
:
query
];
}
-
(
void
)
fitness_getDistanceWalkingRunningOnDay
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
...
...
RCTAppleHealthKit/RCTAppleHealthKit.m
View file @
b3c187be
...
...
@@ -17,8 +17,14 @@
#import "RCTAppleHealthKit+Methods_Vitals.h"
#import "RCTAppleHealthKit+Methods_Results.h"
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"
@implementation
RCTAppleHealthKit
@synthesize
bridge
=
_bridge
;
RCT_EXPORT_MODULE
();
...
...
@@ -32,6 +38,11 @@ RCT_EXPORT_METHOD(initHealthKit:(NSDictionary *)input callback:(RCTResponseSende
[
self
initializeHealthKit
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
initStepCountObserver
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
fitness_initializeStepEventObserver
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
getBiologicalSex
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
characteristic_getBiologicalSex
:
input
callback
:
callback
];
...
...
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