diff --git a/examples/StepsDemo/app/app.js b/examples/StepsDemo/app/app.js new file mode 100644 index 0000000000000000000000000000000000000000..fa1f7e6c173bbf1a57fc8ccde7bd13485ddc6566 --- /dev/null +++ b/examples/StepsDemo/app/app.js @@ -0,0 +1,40 @@ +/** + * Created by greg on 2016-06-30. + */ + +import React, { Component } from 'react'; +import { + AppRegistry, + StyleSheet, + Navigator, + Text, + View +} from 'react-native'; + + +let Home = require('./components/home/index'); +let Add = require('./components/add/index'); + + +class StepsDemoApp extends Component { + render() { + return ( + + ); + } + + renderScene(route, navigator) { + if(route.name == 'Home') { + return + } + if(route.name == 'Add') { + return + } + } +} + +module.exports = StepsDemoApp; +export default StepsDemoApp; diff --git a/examples/StepsDemo/app/assets/images/healthkit_icon.png b/examples/StepsDemo/app/assets/images/healthkit_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f56f50bc8c4b44d34332d1f01e8473b537cad3d0 Binary files /dev/null and b/examples/StepsDemo/app/assets/images/healthkit_icon.png differ diff --git a/examples/StepsDemo/app/components/add/index.js b/examples/StepsDemo/app/components/add/index.js new file mode 100644 index 0000000000000000000000000000000000000000..74e2cec746a9f0911056bb1fe53f72e7280c97b1 --- /dev/null +++ b/examples/StepsDemo/app/components/add/index.js @@ -0,0 +1,93 @@ +/** + * Created by greg on 2016-06-30. + */ + +import React, { Component } from 'react'; +import { + Navigator, + TouchableOpacity, + ScrollView, + Text, + View +} from 'react-native'; +import TimerMixin from 'react-timer-mixin'; +var reactMixin = require('react-mixin'); +import styles from '../../styles/styles'; + + +class Add extends Component { + + constructor(props) { + super(props); + this.state = {}; + } + + componentDidMount() { + + } + + componentWillUnmount() { + + } + + _onPressItem(key) { + console.log('_onPressItem() ==> ', key); + let self = this; + this.requestAnimationFrame(() => { + this.props.navigator.push({ + name: key + }); + }) + } + + + render() { + return ( + + }/> + ); + } + + renderScene(route, navigator) { + return ( + + Add Steps + + ); + } +} + +reactMixin(Add.prototype, TimerMixin); + +var NavigationBarRouteMapper = { + LeftButton(route, navigator, index, nextState) { + return ( + {navigator.parentNavigator.pop()}}> + + Back + + + ); + }, + RightButton(route, navigator, index, nextState) { + return null; + }, + Title(route, navigator, index, nextState) { + return ( + + + Add Steps + + + ); + } +}; + + +module.exports = Add; +export default Add; \ No newline at end of file diff --git a/examples/StepsDemo/app/components/home/history.js b/examples/StepsDemo/app/components/home/history.js new file mode 100644 index 0000000000000000000000000000000000000000..dd8aaa7a8eaeac5eb9d32fb2c0f2f6bfe412426e --- /dev/null +++ b/examples/StepsDemo/app/components/home/history.js @@ -0,0 +1,82 @@ +/** + * Created by greg on 2016-06-30. + */ + +import React, { Component } from 'react'; +import { + Navigator, + TouchableOpacity, + TouchableHighlight, + ScrollView, + ListView, + RecyclerViewBackedScrollView, + Text, + View +} from 'react-native'; +import _ from 'lodash'; +//import TimerMixin from 'react-timer-mixin'; +//var reactMixin = require('react-mixin'); +import styles from '../../styles/styles'; + + +class History extends Component { + + constructor(props) { + super(props); + let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); + if(_.isArray(this.props.data)){ + ds = ds.cloneWithRows(this.props.data); + } + this.state = { + dataSource: ds, + }; + } + + componentDidMount() {} + + componentWillUnmount() {} + + + componentWillReceiveProps(newProps) { + if(newProps && newProps.data && _.isArray(newProps.data)){ + this.setState({ + dataSource: this.state.dataSource.cloneWithRows(newProps.data), + }); + } + } + + + render() { + return ( + } + /> + ); + } + + _renderRow(rowData: Object, sectionID: number, rowID: number, highlightRow: (sectionID: number, rowID: number) => void) { + return ( + { + //this._pressRow(rowID); + highlightRow(sectionID, rowID); + }}> + + + + {rowData.value + ' - ' + rowData.startDate} + + + + + ); + } + +} + +//reactMixin(History.prototype, TimerMixin); + + +module.exports = History; +export default History; diff --git a/examples/StepsDemo/app/components/home/index.js b/examples/StepsDemo/app/components/home/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f6d479917dcfa1a25cce7bf142b077a51c7a6a8d --- /dev/null +++ b/examples/StepsDemo/app/components/home/index.js @@ -0,0 +1,159 @@ +/** + * Created by greg on 2016-06-30. + */ + +import React, { Component } from 'react'; +import { + Navigator, + TouchableOpacity, + ScrollView, + Text, + View +} from 'react-native'; + +import TimerMixin from 'react-timer-mixin'; +var reactMixin = require('react-mixin'); +import styles from '../../styles/styles'; + +var AppleHealthKit = require('react-native-apple-healthkit'); + + +import History from './history'; + + +const HKOPTIONS = { + permissions: { + read: ['Steps'], + write: ['Steps'], + } +}; + + +class Home extends Component { + + constructor(props) { + super(props); + this.state = { + stepsToday: 0, + stepHistory: [], + }; + } + + componentDidMount() { + AppleHealthKit.isAvailable((err,available) => { + if(available){ + AppleHealthKit.initHealthKit(HKOPTIONS, (err, res) => { + if(this._handleHKError(err, 'initHealthKit')){ + return; + } + this._fetchStepsToday(); + this._fetchStepsHistory(); + }); + } + }); + } + + componentWillUnmount() { + + } + + _fetchStepsToday() { + AppleHealthKit.getStepCountForToday(null, (err, steps) => { + if(this._handleHKError(err, 'getStepCountForToday')){ + return; + } + this.setState({stepsToday: steps}); + }); + } + + _fetchStepsHistory() { + let options = { + startDate: (new Date(2016,4,1)).toISOString(), + }; + AppleHealthKit.getDailyStepSamples(options, (err, res) => { + if(this._handleHKError(err, 'getDailyStepSamples')){ + return; + } + this.setState({stepHistory: res}); + }); + } + + _onPressItem(key) { + console.log('_onPressItem() ==> ', key); + let self = this; + this.requestAnimationFrame(() => { + this.props.navigator.push({ + name: key + }); + }) + } + + render() { + return ( + + }/> + ); + } + + renderScene(route, navigator) { + return ( + + + + + STEPS: {this.state.stepsToday} + + + + + + + + + ); + } + + _handleHKError(err, method) : boolean { + if(err){ + let errStr = 'HealthKit_ERROR['+method+'] : '; + if(typeof err === 'string'){ + errStr += err; + } else if (typeof err === 'object' && err.message){ + errStr += err.message; + } + console.log(errStr); + return true; + } + return false; + } + +} + +reactMixin(Home.prototype, TimerMixin); + +var NavigationBarRouteMapper = { + LeftButton(route, navigator, index, nextState) { + return null; + }, + RightButton(route, navigator, index, nextState) { + return null; + }, + Title(route, navigator, index, nextState) { + return ( + + + HealthKit Steps + + + ); + } +}; + + +module.exports = Home; +export default Home; diff --git a/examples/StepsDemo/app/styles/styles.js b/examples/StepsDemo/app/styles/styles.js new file mode 100644 index 0000000000000000000000000000000000000000..d580d2a3ff697ea1d0a533136434e0d2856d4dcb --- /dev/null +++ b/examples/StepsDemo/app/styles/styles.js @@ -0,0 +1,209 @@ +/** + * Created by greg on 2016-06-30. + */ + + +import { + Platform, + StyleSheet +} from 'react-native'; + + + +const styles = StyleSheet.create({ + + sceneContainerWithNavbar: { + flex: 1, + flexDirection: 'column', + //justifyContent: 'flex-start', + //alignItems: 'flex-start', + marginTop: (Platform.OS === 'ios') ? 64 : 54, + backgroundColor: '#FFFFFF' + }, + + navigationBar: { + borderBottomWidth: 1, + borderBottomColor: '#cccccc', + backgroundColor: '#f5f5f5' + }, + + navbarTitleTouchable: { + flex: 1, + justifyContent: 'center' + }, + navbarTitle: { + color: '#FD2D55', + margin: 10, + fontSize: 18 + }, + + + + stepsContainer: { + height:100, + backgroundColor: '#FF8000', + }, + + historyContainer: { + flex: 1, + backgroundColor: '#0088cc', + }, + + + + listViewRow: { + flexDirection: 'row', + justifyContent: 'center', + padding: 10, + backgroundColor: '#F6F6F6', + }, + + + + row_1_3: { + flex: 0.33, + flexDirection:'column', + padding:10, + //backgroundColor: '#FF8000' + }, + + row_2_3: { + flex: 0.66, + flexDirection:'column', + padding:10, + //backgroundColor: '#0088cc' + }, + + borderTopLightGrey: { + borderTopColor: '#CCCCCC', + borderTopWidth: 1, + }, + + largeCenteredText: { + textAlign: 'center', + flexDirection:'row', + fontSize:34, + marginTop:60, + }, + + dashboardListItemLabel: { + fontSize:12, + color: '#FD2D55', + position:'absolute', + left: 70, + top:0, + }, + + dashboardListItemValue: { + fontSize:22, + color: '#47a292', + position:'absolute', + left: 70, + top:15, + }, + + sceneContainerFull: { + flex: 1, + flexDirection: 'column', + //justifyContent: 'flex-start', + //alignItems: 'flex-start', + marginTop: 0, + backgroundColor: '#FFFFFF' + }, + + + dashboardToday: { + height: 30, + alignItems: 'stretch', + justifyContent: 'center', + alignItems: 'center', + backgroundColor: 'rgba(162, 162, 162, 0.2)', + }, + dashboardTodayText: { + + color: '#a2a2a2', + }, + + dashboardListItemHighlight: { + flexDirection: 'row', + alignSelf: 'stretch', + justifyContent: 'center', + //flex:1, + //alignSelf: 'stretch', + //overflow: 'hidden', + }, + + dashboardListItemView: { + flex: 1, + //backgroundColor: '#FDFDFD', + backgroundColor: '#FDFDFD', + //paddingTop:74, + //flexDirection: 'row', + flexDirection: 'column', + alignSelf: 'stretch', + justifyContent: 'flex-start', + alignItems: 'flex-start', + paddingTop:15, + paddingBottom: 15, + + //flexWrap: 'wrap', + + borderBottomColor: '#AAAAAA', + borderBottomWidth: 1, + }, + + dashboardListItemViewTransparent: { + flex: 1, + //backgroundColor: '#FDFDFD', + backgroundColor: 'transparent', + //paddingTop:74, + //flexDirection: 'row', + flexDirection: 'column', + alignSelf: 'stretch', + justifyContent: 'flex-start', + alignItems: 'flex-start', + paddingTop:15, + paddingBottom: 15, + + //flexWrap: 'wrap', + + borderBottomColor: '#AAAAAA', + borderBottomWidth: 1, + }, + + dashboardListItem: { + flexDirection: 'row', + alignSelf: 'stretch', + justifyContent: 'space-between', + flex:1, + backgroundColor: 'transparent', + }, + + + dashboardListItemIcon: { + width: 40, + height: 40, + marginLeft: 10, + opacity:0.7, + //marginTop: 50, + //backgroundColor: 'transparent', + alignSelf: 'flex-start', + }, + + dashboardListItemText: { + flex: 1, + flexDirection: 'column', + alignSelf: 'flex-start', + marginLeft: 20, + fontSize: 29, + color: '#47a292', + //color: '#98CA3F', + //color: '#644496', + flexWrap: 'wrap', + backgroundColor:'transparent', + }, + +}); + +module.exports = styles; +export default styles; \ No newline at end of file diff --git a/examples/StepsDemo/index.ios.js b/examples/StepsDemo/index.ios.js index a26487989b151345640c07846f8f6b1f2d94daa0..f4566ce0bfd33c21189135b7b70369280215b360 100644 --- a/examples/StepsDemo/index.ios.js +++ b/examples/StepsDemo/index.ios.js @@ -12,21 +12,12 @@ import { View } from 'react-native'; +import App from './app/app'; + class StepsDemo extends Component { render() { return ( - - - Welcome to React Native! - - - To get started, edit index.ios.js - - - Press Cmd+R to reload,{'\n'} - Cmd+D or shake for dev menu - - + ); } } diff --git a/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj b/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj index 41ece6662b28847093f799a91738771abef5071b..e74d646845a5aaba2a2d17c22c7299902965c260 100644 --- a/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj +++ b/examples/StepsDemo/ios/StepsDemo.xcodeproj/project.pbxproj @@ -22,6 +22,8 @@ 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 */; }; + 378616B61D257B040027C300 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 378616B51D257B040027C300 /* HealthKit.framework */; }; + 378616C51D259EE50027C300 /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 378616C41D259EE10027C300 /* libRCTAppleHealthKit.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; /* End PBXBuildFile section */ @@ -89,6 +91,13 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; + 378616C31D259EE10027C300 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 378616BF1D259EE00027C300 /* RCTAppleHealthKit.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3774C88D1D2092F20000B3F3; + remoteInfo = RCTAppleHealthKit; + }; 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; @@ -106,17 +115,17 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; + 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; + 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; + 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; + 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; + 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; + 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 00E356EE1AD99517003FC87E /* StepsDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StepsDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* StepsDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StepsDemoTests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; + 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; + 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* StepsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StepsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = StepsDemo/AppDelegate.h; sourceTree = ""; }; 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = StepsDemo/AppDelegate.m; sourceTree = ""; }; @@ -124,9 +133,12 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = StepsDemo/Images.xcassets; sourceTree = ""; }; 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 = ""; }; - 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 = ""; }; + 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 = ""; }; + 378616BF1D259EE00027C300 /* 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 */ /* Begin PBXFrameworksBuildPhase section */ @@ -142,8 +154,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 378616C51D259EE50027C300 /* libRCTAppleHealthKit.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, + 378616B61D257B040027C300 /* HealthKit.framework in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, @@ -234,6 +248,7 @@ 13B07FAE1A68108700A75B9A /* StepsDemo */ = { isa = PBXGroup; children = ( + 378616B71D257B040027C300 /* StepsDemo.entitlements */, 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.m */, @@ -253,6 +268,14 @@ name = Products; sourceTree = ""; }; + 378616C01D259EE00027C300 /* Products */ = { + isa = PBXGroup; + children = ( + 378616C41D259EE10027C300 /* libRCTAppleHealthKit.a */, + ); + name = Products; + sourceTree = ""; + }; 78C398B11ACF4ADC00677621 /* Products */ = { isa = PBXGroup; children = ( @@ -264,6 +287,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + 378616BF1D259EE00027C300 /* RCTAppleHealthKit.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, @@ -289,6 +313,7 @@ 83CBB9F61A601CBA00E9B192 = { isa = PBXGroup; children = ( + 378616B51D257B040027C300 /* HealthKit.framework */, 13B07FAE1A68108700A75B9A /* StepsDemo */, 832341AE1AAA6A7D00B99B32 /* Libraries */, 00E356EF1AD99517003FC87E /* StepsDemoTests */, @@ -359,6 +384,14 @@ CreatedOnToolsVersion = 6.2; TestTargetID = 13B07F861A680F5B00A75B9A; }; + 13B07F861A680F5B00A75B9A = { + DevelopmentTeam = 95ZTJFHCUG; + SystemCapabilities = { + com.apple.HealthKit = { + enabled = 1; + }; + }; + }; }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "StepsDemo" */; @@ -377,6 +410,10 @@ ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; }, + { + ProductGroup = 378616C01D259EE00027C300 /* Products */; + ProjectRef = 378616BF1D259EE00027C300 /* RCTAppleHealthKit.xcodeproj */; + }, { ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; @@ -479,6 +516,13 @@ remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 378616C41D259EE10027C300 /* libRCTAppleHealthKit.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTAppleHealthKit.a; + remoteRef = 378616C31D259EE10027C300 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -528,7 +572,6 @@ runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; - showEnvVarsInLog = 1; }; /* End PBXShellScriptBuildPhase section */ @@ -606,19 +649,23 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = StepsDemo/StepsDemo.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEAD_CODE_STRIPPING = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - INFOPLIST_FILE = "StepsDemo/Info.plist"; + INFOPLIST_FILE = StepsDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); PRODUCT_NAME = StepsDemo; + PROVISIONING_PROFILE = ""; }; name = Debug; }; @@ -626,18 +673,22 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = StepsDemo/StepsDemo.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - INFOPLIST_FILE = "StepsDemo/Info.plist"; + INFOPLIST_FILE = StepsDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); PRODUCT_NAME = StepsDemo; + PROVISIONING_PROFILE = ""; }; name = Release; }; diff --git a/examples/StepsDemo/ios/StepsDemo/AppDelegate.m b/examples/StepsDemo/ios/StepsDemo/AppDelegate.m index ef314ca1c8a047676991ed5695de49836d2fbef7..216ebb516e03c6a39467cc439c93d2800e21e6fe 100644 --- a/examples/StepsDemo/ios/StepsDemo/AppDelegate.m +++ b/examples/StepsDemo/ios/StepsDemo/AppDelegate.m @@ -32,7 +32,7 @@ */ 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/ios/StepsDemo/Info.plist b/examples/StepsDemo/ios/StepsDemo/Info.plist index b4cba0bfd17b747baf3215f84c60d5eccce90a1e..1680bf7e82c75d70cc371b972e9ddfb804930c34 100644 --- a/examples/StepsDemo/ios/StepsDemo/Info.plist +++ b/examples/StepsDemo/ios/StepsDemo/Info.plist @@ -22,11 +22,19 @@ 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSLocationWhenInUseUsageDescription + UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities armv7 + healthkit UISupportedInterfaceOrientations @@ -36,12 +44,5 @@ UIViewControllerBasedStatusBarAppearance - NSLocationWhenInUseUsageDescription - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - diff --git a/examples/StepsDemo/ios/StepsDemo/StepsDemo.entitlements b/examples/StepsDemo/ios/StepsDemo/StepsDemo.entitlements new file mode 100644 index 0000000000000000000000000000000000000000..e10f4302d524a2c6313dc968df134285905acfc8 --- /dev/null +++ b/examples/StepsDemo/ios/StepsDemo/StepsDemo.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.developer.healthkit + + + diff --git a/examples/StepsDemo/package.json b/examples/StepsDemo/package.json index 41563f6319b25484e6fcb08bab2d8c9bf37a138d..f31686206dede6ddc0909c36b2156ac3b6dcce51 100644 --- a/examples/StepsDemo/package.json +++ b/examples/StepsDemo/package.json @@ -6,7 +6,10 @@ "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { + "lodash": "^4.13.1", "react": "15.1.0", - "react-native": "^0.28.0" + "react-mixin": "^2.0.2", + "react-native": "^0.28.0", + "react-native-apple-healthkit": "file:///Users/greg/Dev/experimental/RCTAppleHealthKit" } }