From 1faa97916e893ce91cd196701f2dbd9d0a941f9c Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Sat, 9 Jul 2016 12:10:44 -0400 Subject: [PATCH] standardizing naming and return objects --- .../RCTAppleHealthKit+Methods_Fitness.h | 2 +- .../RCTAppleHealthKit+Methods_Fitness.m | 2 +- RCTAppleHealthKit/RCTAppleHealthKit.m | 22 ++++++++--------- README.md | 5 ++-- .../ios/BodyMeasurements/AppDelegate.m | 4 ++-- .../StepsDemo/app/components/home/index.js | 8 +++---- .../ios/StepsDemo.xcodeproj/project.pbxproj | 24 +++++++++---------- .../StepsDemo/ios/StepsDemo/AppDelegate.m | 4 ++-- 8 files changed, 36 insertions(+), 35 deletions(-) diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h index 60c97b8..68096d9 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h @@ -11,7 +11,7 @@ @interface RCTAppleHealthKit (Methods_Fitness) - (void)fitness_getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; -- (void)fitness_getStepCountForDay:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; +- (void)fitness_getStepCountOnDay:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; - (void)fitness_getDailyStepCounts:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; - (void)fitness_getDailyStepSamples:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback; diff --git a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m index 1f52448..15c6733 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m @@ -31,7 +31,7 @@ } -- (void)fitness_getStepCountForDay:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback +- (void)fitness_getStepCountOnDay:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback { NSDate *date = [RCTAppleHealthKit dateFromOptions:input key:@"date" withDefault:[NSDate date]]; diff --git a/RCTAppleHealthKit/RCTAppleHealthKit.m b/RCTAppleHealthKit/RCTAppleHealthKit.m index 22d1c1c..5578806 100644 --- a/RCTAppleHealthKit/RCTAppleHealthKit.m +++ b/RCTAppleHealthKit/RCTAppleHealthKit.m @@ -94,22 +94,22 @@ RCT_EXPORT_METHOD(getLatestLeanBodyMass:(NSDictionary *)input callback:(RCTRespo } -RCT_EXPORT_METHOD(getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) -{ - [self fitness_getStepCountForToday:input callback:callback]; -} +//RCT_EXPORT_METHOD(getStepCountForToday:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) +//{ +// [self fitness_getStepCountForToday:input callback:callback]; +//} -RCT_EXPORT_METHOD(getStepCountForDay:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) +RCT_EXPORT_METHOD(getStepCount:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) { - [self fitness_getStepCountForDay:input callback:callback]; + [self fitness_getStepCountOnDay:input callback:callback]; } -RCT_EXPORT_METHOD(getMultiDayStepCounts:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) -{ - [self fitness_getDailyStepCounts:input callback:callback]; -} +//RCT_EXPORT_METHOD(getMultiDayStepCounts:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) +//{ +// [self fitness_getDailyStepCounts:input callback:callback]; +//} -RCT_EXPORT_METHOD(getDailyStepSamples:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) +RCT_EXPORT_METHOD(getDailyStepCountSamples:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback) { [self fitness_getDailyStepSamples:input callback:callback]; } diff --git a/README.md b/README.md index b1c0e62..72609e5 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,9 @@ A React Native bridge module for interacting with [Apple HealthKit] data. * [initHealthKit](#inithealthkit) * [getBiologicalSex](#getbiologicalsex) * [getDateOfBirth](#getdateofbirth) - * [getStepCountForToday](#getstepcountfortoday) - * [getStepCountForDay](#getstepcountforday) + * ~~[getStepCountForToday](#getstepcountfortoday)~~ + * ~~[getStepCountForDay](#getstepcountforday)~~ + * [getStepCount] * [getMultiDayStepCounts](#getmultidaystepcounts) * [getDistanceWalkingRunning](#getdistancewalkingrunning) * [getDistanceCycling](#getdistancecycling) diff --git a/examples/BodyMeasurements/ios/BodyMeasurements/AppDelegate.m b/examples/BodyMeasurements/ios/BodyMeasurements/AppDelegate.m index 6865458..56ee3b1 100644 --- a/examples/BodyMeasurements/ios/BodyMeasurements/AppDelegate.m +++ b/examples/BodyMeasurements/ios/BodyMeasurements/AppDelegate.m @@ -31,8 +31,8 @@ * on the same Wi-Fi network. */ -// jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.14:8081/index.ios.bundle?platform=ios&dev=true"]; - jsCodeLocation = [NSURL URLWithString:@"http://10.1.14.163:8081/index.ios.bundle?platform=ios&dev=true"]; + jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.14:8081/index.ios.bundle?platform=ios&dev=true"]; +// jsCodeLocation = [NSURL URLWithString:@"http://10.1.14.163:8081/index.ios.bundle?platform=ios&dev=true"]; /** * OPTION 2 * Load from pre-bundled file on disk. The static bundle is automatically diff --git a/examples/StepsDemo/app/components/home/index.js b/examples/StepsDemo/app/components/home/index.js index d8d6e00..b9b38ca 100644 --- a/examples/StepsDemo/app/components/home/index.js +++ b/examples/StepsDemo/app/components/home/index.js @@ -87,8 +87,8 @@ class Home extends Component { * @private */ _fetchStepsToday() { - AppleHealthKit.getStepCountForToday(null, (err, steps) => { - if(this._handleHKError(err, 'getStepCountForToday')){ + AppleHealthKit.getStepCount(null, (err, steps) => { + if(this._handleHKError(err, 'getStepCount')){ return; } this.setState({stepsToday: steps}); @@ -104,8 +104,8 @@ class Home extends Component { let options = { startDate: (new Date(2016,4,1)).toISOString(), }; - AppleHealthKit.getDailyStepSamples(options, (err, res) => { - if(this._handleHKError(err, 'getDailyStepSamples')){ + AppleHealthKit.getDailyStepCountSamples(options, (err, res) => { + if(this._handleHKError(err, 'getDailyStepCountSamples')){ return; } this.setState({stepHistory: res}); diff --git a/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj b/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj index dea37cf..d48058c 100644 --- a/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj +++ b/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj @@ -23,7 +23,7 @@ 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 378616B61D257B040027C300 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 378616B51D257B040027C300 /* HealthKit.framework */; }; - 379EEE991D286FEF0062AF55 /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 379EEE981D286FE80062AF55 /* libRCTAppleHealthKit.a */; }; + 378DCB461D3158A800E83D06 /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 378DCB451D31589600E83D06 /* libRCTAppleHealthKit.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; /* End PBXBuildFile section */ @@ -91,9 +91,9 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; - 379EEE971D286FE80062AF55 /* PBXContainerItemProxy */ = { + 378DCB441D31589600E83D06 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 379EEE931D286FE80062AF55 /* RCTAppleHealthKit.xcodeproj */; + containerPortal = 378DCB401D31589600E83D06 /* RCTAppleHealthKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3774C88D1D2092F20000B3F3; remoteInfo = RCTAppleHealthKit; @@ -136,7 +136,7 @@ 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 378616B51D257B040027C300 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; }; 378616B71D257B040027C300 /* StepsDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = StepsDemo.entitlements; path = StepsDemo/StepsDemo.entitlements; sourceTree = ""; }; - 379EEE931D286FE80062AF55 /* RCTAppleHealthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAppleHealthKit.xcodeproj; path = "../node_modules/react-native-apple-healthkit/RCTAppleHealthKit.xcodeproj"; sourceTree = ""; }; + 378DCB401D31589600E83D06 /* RCTAppleHealthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAppleHealthKit.xcodeproj; path = "../node_modules/react-native-apple-healthkit/RCTAppleHealthKit.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -154,7 +154,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 379EEE991D286FEF0062AF55 /* libRCTAppleHealthKit.a in Frameworks */, + 378DCB461D3158A800E83D06 /* libRCTAppleHealthKit.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 378616B61D257B040027C300 /* HealthKit.framework in Frameworks */, @@ -268,10 +268,10 @@ name = Products; sourceTree = ""; }; - 379EEE941D286FE80062AF55 /* Products */ = { + 378DCB411D31589600E83D06 /* Products */ = { isa = PBXGroup; children = ( - 379EEE981D286FE80062AF55 /* libRCTAppleHealthKit.a */, + 378DCB451D31589600E83D06 /* libRCTAppleHealthKit.a */, ); name = Products; sourceTree = ""; @@ -287,7 +287,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( - 379EEE931D286FE80062AF55 /* RCTAppleHealthKit.xcodeproj */, + 378DCB401D31589600E83D06 /* RCTAppleHealthKit.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, @@ -411,8 +411,8 @@ ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; }, { - ProductGroup = 379EEE941D286FE80062AF55 /* Products */; - ProjectRef = 379EEE931D286FE80062AF55 /* RCTAppleHealthKit.xcodeproj */; + ProductGroup = 378DCB411D31589600E83D06 /* Products */; + ProjectRef = 378DCB401D31589600E83D06 /* RCTAppleHealthKit.xcodeproj */; }, { ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; @@ -516,11 +516,11 @@ remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 379EEE981D286FE80062AF55 /* libRCTAppleHealthKit.a */ = { + 378DCB451D31589600E83D06 /* libRCTAppleHealthKit.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libRCTAppleHealthKit.a; - remoteRef = 379EEE971D286FE80062AF55 /* PBXContainerItemProxy */; + remoteRef = 378DCB441D31589600E83D06 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { diff --git a/examples/StepsDemo/ios/StepsDemo/AppDelegate.m b/examples/StepsDemo/ios/StepsDemo/AppDelegate.m index 37a1cc7..a3c062c 100644 --- a/examples/StepsDemo/ios/StepsDemo/AppDelegate.m +++ b/examples/StepsDemo/ios/StepsDemo/AppDelegate.m @@ -31,8 +31,8 @@ * on the same Wi-Fi network. */ // -// jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.14:8081/index.ios.bundle?platform=ios&dev=true"]; - jsCodeLocation = [NSURL URLWithString:@"http://10.1.14.163:8081/index.ios.bundle?platform=ios&dev=true"]; + jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.14:8081/index.ios.bundle?platform=ios&dev=true"]; +// jsCodeLocation = [NSURL URLWithString:@"http://10.1.14.163:8081/index.ios.bundle?platform=ios&dev=true"]; /** * OPTION 2 * Load from pre-bundled file on disk. The static bundle is automatically -- 2.26.2