diff --git a/examples/StepsDemo/app/components/home/index.js b/examples/StepsDemo/app/components/home/index.js index 53858c35d1157c42e45d5bf17e5f1b86cb81ddac..2ea47c3193a5e1b06af673ed03ba8f5b0da94c2d 100644 --- a/examples/StepsDemo/app/components/home/index.js +++ b/examples/StepsDemo/app/components/home/index.js @@ -28,6 +28,7 @@ const HKOPTIONS = { HKPERMS.Height, HKPERMS.DateOfBirth, HKPERMS.BiologicalSex, + HKPERMS.SleepAnalysis, ], write: [ HKPERMS.StepCount @@ -75,6 +76,8 @@ class Home extends Component { this._fetchStepsToday(); this._fetchStepsHistory(); + + this._fetchSleepAnalysis(); }); } }); @@ -115,6 +118,28 @@ class Home extends Component { }); } + + + _fetchSleepAnalysis() { + let options = { + startDate: (new Date(2016,10,1)).toISOString(), + }; + AppleHealthKit.getSleepSamples(options, (err, res) => { + if(this._handleHKError(err, 'getSleepSamples')){ + return; + } + //this.setState({stepHistory: res}); + + console.log('######################################') + console.log('### SLEEP SAMPLES ###') + console.log('######################################') + console.log(res) + }); + } + + + + /** * render the Navigator which will render the navigation * bar and the scene diff --git a/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj b/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj index c433bfce6c74dda19f3efe00808fe221fb3f73ef..e2a37578745c68bfef5e1ba33c5edab61e08e3ec 100644 --- a/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj +++ b/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj @@ -22,7 +22,7 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 377F68B31D7A0D9C00B64DB1 /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 377F68B21D7A0D9800B64DB1 /* libRCTAppleHealthKit.a */; }; + 37837DF31DCD618B000201A0 /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 37837DF21DCD6186000201A0 /* libRCTAppleHealthKit.a */; }; 378616B61D257B040027C300 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 378616B51D257B040027C300 /* HealthKit.framework */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; /* End PBXBuildFile section */ @@ -91,9 +91,9 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; - 377F68B11D7A0D9800B64DB1 /* PBXContainerItemProxy */ = { + 37837DF11DCD6186000201A0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 377F68AD1D7A0D9800B64DB1 /* RCTAppleHealthKit.xcodeproj */; + containerPortal = 37837DED1DCD6186000201A0 /* RCTAppleHealthKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3774C88D1D2092F20000B3F3; remoteInfo = RCTAppleHealthKit; @@ -134,7 +134,7 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = StepsDemo/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = StepsDemo/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 377F68AD1D7A0D9800B64DB1 /* RCTAppleHealthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAppleHealthKit.xcodeproj; path = "../node_modules/react-native-apple-healthkit/RCTAppleHealthKit.xcodeproj"; sourceTree = ""; }; + 37837DED1DCD6186000201A0 /* RCTAppleHealthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAppleHealthKit.xcodeproj; path = "../node_modules/react-native-apple-healthkit/RCTAppleHealthKit.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 = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; @@ -154,7 +154,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 377F68B31D7A0D9C00B64DB1 /* libRCTAppleHealthKit.a in Frameworks */, + 37837DF31DCD618B000201A0 /* libRCTAppleHealthKit.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, @@ -268,10 +268,10 @@ name = Products; sourceTree = ""; }; - 377F68AE1D7A0D9800B64DB1 /* Products */ = { + 37837DEE1DCD6186000201A0 /* Products */ = { isa = PBXGroup; children = ( - 377F68B21D7A0D9800B64DB1 /* libRCTAppleHealthKit.a */, + 37837DF21DCD6186000201A0 /* libRCTAppleHealthKit.a */, ); name = Products; sourceTree = ""; @@ -287,7 +287,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( - 377F68AD1D7A0D9800B64DB1 /* RCTAppleHealthKit.xcodeproj */, + 37837DED1DCD6186000201A0 /* RCTAppleHealthKit.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, @@ -411,8 +411,8 @@ ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; }, { - ProductGroup = 377F68AE1D7A0D9800B64DB1 /* Products */; - ProjectRef = 377F68AD1D7A0D9800B64DB1 /* RCTAppleHealthKit.xcodeproj */; + ProductGroup = 37837DEE1DCD6186000201A0 /* Products */; + ProjectRef = 37837DED1DCD6186000201A0 /* RCTAppleHealthKit.xcodeproj */; }, { ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; @@ -516,11 +516,11 @@ remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 377F68B21D7A0D9800B64DB1 /* libRCTAppleHealthKit.a */ = { + 37837DF21DCD6186000201A0 /* libRCTAppleHealthKit.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libRCTAppleHealthKit.a; - remoteRef = 377F68B11D7A0D9800B64DB1 /* PBXContainerItemProxy */; + remoteRef = 37837DF11DCD6186000201A0 /* 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 1e3212c106a113b749bb43dc57f9ec89898e91c3..00d6637d59a654885dc4362c38ad33f08cd2047a 100644 --- a/examples/StepsDemo/ios/StepsDemo/AppDelegate.m +++ b/examples/StepsDemo/ios/StepsDemo/AppDelegate.m @@ -31,7 +31,7 @@ * on the same Wi-Fi network. */ // - jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.13:8081/index.ios.bundle?platform=ios&dev=true"]; + jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.12: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