From 29a807dc5819f9949d7209b709be76f7c47c14c9 Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Thu, 30 Jun 2016 18:21:51 -0400 Subject: [PATCH] working on StepsDemo example app... wip --- examples/StepsDemo/app/app.js | 40 ++++ .../app/assets/images/healthkit_icon.png | Bin 0 -> 4779 bytes .../StepsDemo/app/components/add/index.js | 93 ++++++++ .../StepsDemo/app/components/home/history.js | 82 +++++++ .../StepsDemo/app/components/home/index.js | 159 +++++++++++++ examples/StepsDemo/app/styles/styles.js | 209 ++++++++++++++++++ examples/StepsDemo/index.ios.js | 15 +- .../ios/StepsDemo.xcodeproj/project.pbxproj | 95 ++++++-- .../StepsDemo/ios/StepsDemo/AppDelegate.m | 2 +- examples/StepsDemo/ios/StepsDemo/Info.plist | 15 +- .../ios/StepsDemo/StepsDemo.entitlements | 8 + examples/StepsDemo/package.json | 5 +- 12 files changed, 680 insertions(+), 43 deletions(-) create mode 100644 examples/StepsDemo/app/app.js create mode 100644 examples/StepsDemo/app/assets/images/healthkit_icon.png create mode 100644 examples/StepsDemo/app/components/add/index.js create mode 100644 examples/StepsDemo/app/components/home/history.js create mode 100644 examples/StepsDemo/app/components/home/index.js create mode 100644 examples/StepsDemo/app/styles/styles.js create mode 100644 examples/StepsDemo/ios/StepsDemo/StepsDemo.entitlements diff --git a/examples/StepsDemo/app/app.js b/examples/StepsDemo/app/app.js new file mode 100644 index 0000000..fa1f7e6 --- /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 GIT binary patch literal 4779 zcmaJ_c|4T++aA>@BFPq_L1GSOY=fEX`@W8S$ryvN%`h|eC1lH1_OfM(6j>{K)`%iR zc3CHTwvg@B`JHoq?;r1ZpU>xczTf-)T-SB4e?8Iqx@xr4Y}5b%fL23Y+3@U?|NUN~ zJo~=DdQ6=itV9(vq7lx4=#BEk02J(Tb{LR`8_E%5h(X!=dVIi00|4jwu}CwbnT|FB zjdO#beq$g$Zum1c03a>rgGZrVFhr0Y#u4i-!@W`ejvIuvm*F;r=?LrKl`u|Nbw5vx zk)JLS?dO7q+jGmwf~0*AX98{*A`0Z==ITyB_{ebosf#$f|8_&UL4QJsE;8KzNyRu=G}isM6Z|JjM+c$dP9UP((HIS78SXP32o`IPP*hM5R*_Vd6c&Li ziHNAc;7Uru3XxHpb z^~AY>{wy4U{XcS15D}G97MD=@SG~Wu_Wz!X#J_T(XURZ+kN1C#`)}9T4*kCVv%F`< zKkJWiKihfFv*k{0do~FG(6MSLD6BOcau!`mnC(^`RnT^48*ug{_blTf6g*S}ve} zgp@LH$l4!#7UB6cIeFNa&1s&<>tY{AbLHS=cHPk6@#)6Vlz(ua8PU4)(AR8J_GY&- zi}%_X=0?Yz33tg=uRBQN@F8bdJabIPzV=Dqgk#lcY~Q?6G|0>c|ZD% z`raj?P4h~sy=ZMrPATv12eN0Gw7_1^!&)&OF-HduR?nP?B+X~B2Mc0caPmZyYW{mM zT3XssFer^DU(o2O=N~&-Hf4Kgl$K)Z7fYqy%Rd;;B&QB5Ef?_mtgg>5fJJYfjq`uQd`{s;IIw~GB-EZ z629KxF7B7J^bjufb?Di%XQi3`x%Z7BDNpAW@e00TCOF%pSGl`-eW)H0+wF0AQ|LC^ zlLWk0Y1VV6gxH9K<*%^>Y4KXM3VH}IiK21ky+|Jm9{FZJ zWBnk_nGJvX{ZWEE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P_?0Ovg){%~D zh&^Pl+xdH&gwu?aZB@LhQnAV9R1xBps^FUAQil@kTI&#O!OX-YHeAJi#Ah>?y+eyI z4e+`l6CY6xZ*(le zVIVk7gn>a#iQb6ZBHdQyP|h-lkO*#C6i!X~Zy3rjIX@*j;qEk6a2= zMychjfnDEu0!J>S8XcsX@qP1Mak16=b=5DbxN_-wvSy)XQQ|u9PBHMU)Z^I~TUXuS zz3{PbQ7oVYg2ko8Iz%yfLd`-KAzQj9;b``B(mkR*?AAEA2J}wsIV60b6M3LbmpF;? zfxHx#*S^gARE3XH2<%u2{CG<{Y({5Ief@Se(xeqtAVm^|CdRzfwkecx*i!kRrjzC$ z%_t3IF^dMDoMW6fpc0a~L>f$_l^t;jY*?3A_T>@3A6zJHVC4*om_Nx^UuC@~w5;3` zitr0-BOXviir+AOWYLF=dK_egoRaABj^O074t9Q#Ecmq9-v*W#h-$xkM|VcCoN~3C zX$19%CExR|Hio`~?bPR7Y837IfapjVP*qh*=Rs2U`o^=^^k_isJ}lH#A}Dpot;+8P znTAae{H8ekp!~2=pQn23TRB(BtH+1QJCxyB+1L0(guZL;r8^^%Z?k$oI)SrfIY5Hr zH+jU2q&2qUwt-ldL1Qj$dzAS6}rSd04>!1S*MX+sk#px09J}5yEr&*dxuFT zHD!kRHfjFqb`^n-%Vi$Lv0igbES!J6V>eLdkknGO+0)M~=C$!KP1k$^ie1Z5AE;l? zaa&}}Y~19jD*h$ClvHR){V8yW!pNZSG0 ', 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 0000000..dd8aaa7 --- /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 0000000..f6d4799 --- /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 0000000..d580d2a --- /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 a264879..f4566ce 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 41ece66..e74d646 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 ef314ca..216ebb5 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 b4cba0b..1680bf7 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 0000000..e10f430 --- /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 41563f6..f316862 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" } } -- 2.26.2