From ba0697fa9b035b42427a1d6716d77ff18fd1fd10 Mon Sep 17 00:00:00 2001 From: liyuan <940079461@qq.com> Date: Sat, 9 Dec 2017 18:12:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=BE=A4=E4=B8=BB=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/src/main/assets/index.android.bundle | 4 +- .../src/main/assets/index.android.bundle.meta | 4 +- ios/ImClient.xcodeproj/project.pbxproj | 35 +- package.json | 3 +- src/components/#SetChatRoomInfo.js# | 376 ------------------ src/components/AddFriend.js | 2 +- src/components/ChatList.js | 49 +-- src/components/ChatRoom.js | 78 +++- src/components/ContactList.js | 42 +- src/components/SetChatRoomInfo.js | 64 +-- src/components/login.js | 23 +- src/config.js | 2 +- src/index.js | 15 +- src/navigators/AppNavigator.js | 2 +- src/reducers/user/userActions.js | 91 ++++- src/reducers/user/userReducer.js | 10 +- src/reducers/user/userType.js | 3 +- 17 files changed, 312 insertions(+), 491 deletions(-) delete mode 100644 src/components/#SetChatRoomInfo.js# diff --git a/android/app/src/main/assets/index.android.bundle b/android/app/src/main/assets/index.android.bundle index c6b9ac1..adb02eb 100644 --- a/android/app/src/main/assets/index.android.bundle +++ b/android/app/src/main/assets/index.android.bundle @@ -850,7 +850,7 @@ __d(function(n,r,t,e){var o=r(547);t.exports=o(function(n,r){for(var t,e=0,o=n.l __d(function(n,t,r,e){var o=t(547);r.exports=o(function(n,t){for(var r=[],e=0,o=Math.min(n.length,t.length);e1&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(function(e){return e.json()}).then(function(e){var a,r;return regeneratorRuntime.async(function(o){for(;;)switch(o.prev=o.next){case 0:return 0!=e.code&&alert(e.msg),a=e.content,r={avatar:a.GroupAvatar,chatRoomHistory:[],id:a.GroupRoomId,name:l.groupname,isTop:!1,groupIndex:a.Index,type:"chatgroups"},o.next=5,regeneratorRuntime.awrap(n.props.addRecnentChatUnshift({content:r}));case 5:return o.next=7,regeneratorRuntime.awrap(n.setState({openGroupChatRoom:!t.state.openGroupChatRoom}));case 7:setTimeout(function(){n.props.navigation.navigate("ChatRoom",{info:r})},700);case 8:case"end":return o.stop()}},null,t)}).catch(function(e){return console.log(e)})}},{key:"_renderSeparator",value:function(e,t,a){return l.default.createElement(m.ListItem.Separator,{paddingLeft:10,key:e+"-"+t})}},{key:"render",value:function(){var e=this,t=this.props.RecentChatData;return t.length?l.default.createElement(i.View,{style:G.container},l.default.createElement(i.StatusBar,{barStyle:"light-content",backgroundColor:m.Color.Black,StatusBarAnimation:"fade"}),l.default.createElement(r,{isShow:this.state.isMenuShow,data:this.state.menuData,flatListData:t,renderItem:this._renderRow.bind(this)}),l.default.createElement(i.Modal,{onRequestClose:function(){return e.setState({openGroupChatRoom:!e.state.openGroupChatRoom})},animationType:"slide",transparent:!1,onShow:function(){return e.setState({isMenuShow:!1})},visible:this.state.openGroupChatRoom},l.default.createElement(I.default,{onSubmit:this.newGroupChat.bind(this),closeModal:function(){return e.setState({openGroupChatRoom:!e.state.openGroupChatRoom})}}))):l.default.createElement(i.View,null,l.default.createElement(i.StatusBar,{barStyle:"light-content",backgroundColor:m.Color.Black,StatusBarAnimation:"fade"}),l.default.createElement(i.View,{style:G.emptyMessage},H,l.default.createElement(i.Text,{style:G.emptyMessageText},"\u6682\u65e0\u6d88\u606f")),l.default.createElement(i.Modal,{animationType:"slide",transparent:!1,onRequestClose:function(){return e.setState({openGroupChatRoom:!1})},visible:this.state.openGroupChatRoom},l.default.createElement(I.default,{closeModal:function(){return e.setState({openGroupChatRoom:!1})}})))}}]),t}(o.Component);T.navigationOptions=function(e){var t=e.navigation,a=l.default.createElement(R.default.Button,{onPress:function(){return t.state.params.chatListSwitchMenu()},iconStyle:{zIndex:1e3},backgroundColor:m.Color.Black,name:"plus",size:20,iconStyle:{marginRight:10},color:m.Color.White});return{tabBarLabel:"\u4fe1\u4fe1",tabBarIcon:function(e){var t=e.tintColor;return l.default.createElement(D,{hintColor:t})},headerRight:a,headerTitle:"\u4fe1\u4fe1",lazy:!0,headerLeft:l.default.createElement(i.View,null),gesturesEnabled:!1}};var _=function(e){function t(e){babelHelpers.classCallCheck(this,t);var a=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Date.prototype.format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var a in t){var n=t[a];new RegExp("("+a+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?n:("00"+n).substr((""+n).length)))}return e},a}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=e.avatar,a=e.unReadMessageCount,n=e.name,r=e.latestTime,o=e.latestMessage,s=e.onPress,d=(0,c.timeDifference)(new Date(r).format("yyyy-MM-dd hh:mm:ss"));return l.default.createElement(i.TouchableHighlight,{delayPressIn:0,delayPressOut:130,onPress:s},l.default.createElement(i.View,{style:G.ConversationCell},l.default.createElement(i.View,{style:G.leftBox},l.default.createElement(i.Image,{source:{uri:""+u.default.domain+t},style:G.avatar}),l.default.createElement(m.Badge,{style:G.cellBadge,unReadMessageCount:a,height:18})),l.default.createElement(i.View,{style:G.boxRight},l.default.createElement(i.View,{style:G.boxCeil},l.default.createElement(i.Text,{style:G.sessionName,numberOfLines:1},"."==n?"\u7fa4\u804a":n),l.default.createElement(i.Text,{style:G.latestTime},d)),l.default.createElement(i.Text,{style:G.boxFloor,numberOfLines:1},o))))}}]),t}(l.default.Component);_.propTypes={avatar:p.default.string.isRequired,name:p.default.any.isRequired,latestTime:p.default.number.isRequired,latestMessage:p.default.string.isRequired,onPress:p.default.func.isRequired},r.propTypes={data:p.default.array};var G=b.default.create({menuContent:{width:120,borderRadius:5,backgroundColor:m.Color.LightBlack,alignItems:"flex-start",justifyContent:"center"},upIcon:{zIndex:800,backgroundColor:"transparent",position:"absolute",right:12,top:-16},menuBox:{paddingVertical:6,width:"100%"},menuItem:{marginLeft:16,flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},container:{position:"relative",flex:1,height:"100%",justifyContent:"flex-start",alignItems:"stretch",backgroundColor:m.Color.BackgroundGrey},ConversationCell:{flexDirection:"row",backgroundColor:m.Color.White},leftBox:{padding:6},avatar:{borderRadius:4,width:50,height:50},cellBadge:{position:"absolute",top:2,right:0},boxRight:{flex:1,padding:10},boxCeil:{flex:1,flexDirection:"row",justifyContent:"space-between"},sessionName:{fontSize:m.FontSize.Content,color:m.Color.Black},boxFloor:{fontSize:m.FontSize.Annotation,color:"#9A9A9A"},latestTime:{fontSize:m.FontSize.Annotation,color:"#B3B3B3"},emptyMessage:{flex:1,justifyContent:"center",alignItems:"center"},emptyMessageImage:{opacity:.6},emptyMessageText:{color:m.Color.LightBlack,fontSize:m.FontSize.Annotation}}),q=function(e){return{RecentChatData:e.userReducer.userRecentChat,userInfo:e.userReducer}},z=function(e){return{addRecnentChatUnshift:(0,f.compose)(e,B.addRecnentChatUnshift)}};n.default=(0,h.connect)(q,z)(T)},1099); +__d(function(e,t,a,n){function r(e){var t=e.data,a=e.isShow,n=e.flatListData,r=e.renderItem,o=l.default.createElement(i.View,{style:{position:"relative",width:"100%",height:"100%"}},l.default.createElement(i.View,{style:G.upIcon},l.default.createElement(E.default,{name:"triangle-up",size:22,color:m.Color.LightBlack})),t.map(function(e,t){return l.default.createElement(i.TouchableHighlight,{key:t,onPress:e.onPress,delayPressIn:0,delayPressOut:200,style:G.menuBox},l.default.createElement(i.View,{style:G.menuItem},e.icon,l.default.createElement(i.Text,{style:{color:m.Color.White,textAlign:"center",marginLeft:12,fontSize:16}},e.text)))}));return l.default.createElement(i.View,{style:{position:"relative",width:"100%",height:"100%",backgroundColor:"transparent"}},l.default.createElement(i.View,{style:[G.menuContent,{zIndex:10,position:"absolute",right:10,top:14}]},a?o:l.default.createElement(i.View,null)),l.default.createElement(i.ScrollView,null,l.default.createElement(i.FlatList,{data:n,keyExtractor:function(e,t){return t},renderItem:r})))}Object.defineProperty(n,"__esModule",{value:!0});var o=t(13),l=babelHelpers.interopRequireDefault(o),i=t(39),s=t(848),u=babelHelpers.interopRequireDefault(s),c=t(481),d=t(381),p=babelHelpers.interopRequireDefault(d),f=t(393),h=t(379),m=t(849),g=t(482),b=babelHelpers.interopRequireDefault(g),C=t(1070),y=(babelHelpers.interopRequireWildcard(C),t(1068)),R=babelHelpers.interopRequireDefault(y),v=t(864),E=babelHelpers.interopRequireDefault(v),w=t(1057),x=(babelHelpers.interopRequireDefault(w),t(1097)),S=(babelHelpers.interopRequireDefault(x),t(1062)),M=babelHelpers.interopRequireDefault(S),k=t(1100),I=babelHelpers.interopRequireDefault(k),B=t(498),D=function(e){var t=e.hintColor;return l.default.createElement(M.default,{name:"ios-chatbubbles",size:26,color:t})},H=l.default.createElement(E.default,{iconStyle:{},name:"chat",size:80,color:m.Color.LightGrey}),T=function(e){function t(e){babelHelpers.classCallCheck(this,t);var a=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a._renderRow=function(e){var t=e.item,n=babelHelpers.extends(t);return l.default.createElement(m.Swipeout,{key:n.key,rightButtons:[{title:"\u5220\u9664",type:"Delete",onPress:function(){}}]},l.default.createElement(_,{avatar:n.avatar,unReadMessageCount:n.unReadMessageCount,name:n.name,latestTime:n.latestTime,latestMessage:n.latestMessage,onPress:function(){a.props.navigation.navigate("ChatRoom",{info:n})}}))},a.state={openGroupChatRoom:!1,menuData:[{icon:l.default.createElement(M.default,{name:"ios-person-add",size:24,color:m.Color.White}),text:"\u53d1\u8d77\u7fa4\u804a",onPress:a._openGroupChat.bind(a)},{icon:l.default.createElement(M.default,{name:"ios-person-add",size:24,color:m.Color.White}),text:"\u6dfb\u52a0\u597d\u53cb",onPress:a._openAddFriend.bind(a)}],isMenuShow:!1},a}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"_switchMenu",value:function(){this.setState({isMenuShow:!this.state.isMenuShow})}},{key:"componentWillMount",value:function(){this.props.navigation.setParams({chatListSwitchMenu:this._switchMenu.bind(this)})}},{key:"_openGroupChat",value:function(){this.setState({openGroupChatRoom:!0})}},{key:"_openAddFriend",value:function(){this.props.navigation.navigate("AddFriend",{data:"hah"})}},{key:"newGroupChat",value:function(e){var t=this,a=e.friends,n=this,r=u.default.domain+"/creategroup",o=a.map(function(e){return e.name}),l={groupname:".",desc:".",public:!0,maxusers:200,allowinvites:!0,owner:this.props.userInfo.userName,members:o,userId:this.props.userInfo.userid+"",membersOnly:!1};a.length>1&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(function(e){return e.json()}).then(function(e){var a,r;return regeneratorRuntime.async(function(o){for(;;)switch(o.prev=o.next){case 0:return 0!=e.code&&alert(e.msg),a=e.content,r={avatar:a.GroupAvatar,chatRoomHistory:[],id:a.GroupRoomId,name:l.groupname,isTop:!1,groupIndex:a.Index,type:"chatgroups"},o.next=5,regeneratorRuntime.awrap(n.props.addRecnentChatUnshift({content:r}));case 5:return o.next=7,regeneratorRuntime.awrap(n.setState({openGroupChatRoom:!t.state.openGroupChatRoom}));case 7:setTimeout(function(){n.props.navigation.navigate("ChatRoom",{info:r})},700);case 8:case"end":return o.stop()}},null,t)}).catch(function(e){return console.log(e)})}},{key:"_renderSeparator",value:function(e,t,a){return l.default.createElement(m.ListItem.Separator,{paddingLeft:10,key:e+"-"+t})}},{key:"render",value:function(){var e=this,t=this.props.RecentChatData;return t.length?l.default.createElement(i.View,{style:G.container},l.default.createElement(i.StatusBar,{barStyle:"light-content",backgroundColor:m.Color.Black,StatusBarAnimation:"fade"}),l.default.createElement(r,{isShow:this.state.isMenuShow,data:this.state.menuData,flatListData:t,renderItem:this._renderRow.bind(this)}),l.default.createElement(i.Modal,{onRequestClose:function(){return e.setState({openGroupChatRoom:!e.state.openGroupChatRoom})},animationType:"slide",transparent:!1,onShow:function(){return e.setState({isMenuShow:!1})},visible:this.state.openGroupChatRoom},l.default.createElement(I.default,{onSubmit:this.newGroupChat.bind(this),closeModal:function(){return e.setState({openGroupChatRoom:!e.state.openGroupChatRoom})}}))):l.default.createElement(i.View,null,l.default.createElement(i.StatusBar,{barStyle:"light-content",backgroundColor:m.Color.Black,StatusBarAnimation:"fade"}),l.default.createElement(i.View,{style:G.emptyMessage},H,l.default.createElement(i.Text,{style:G.emptyMessageText},"\u6682\u65e0\u6d88\u606f")),l.default.createElement(i.Modal,{animationType:"slide",transparent:!1,onRequestClose:function(){return e.setState({openGroupChatRoom:!1})},visible:this.state.openGroupChatRoom},l.default.createElement(I.default,{closeModal:function(){return e.setState({openGroupChatRoom:!1})}})))}}]),t}(o.Component);T.navigationOptions=function(e){var t=e.navigation,a=l.default.createElement(R.default.Button,{onPress:function(){return t.state.params.chatListSwitchMenu()},iconStyle:{zIndex:1e3},backgroundColor:m.Color.Black,name:"plus",size:20,iconStyle:{marginRight:10},color:m.Color.White});return{tabBarLabel:"\u4fe1\u4fe1",tabBarIcon:function(e){var t=e.tintColor;return l.default.createElement(D,{hintColor:t})},headerRight:a,headerTitle:"\u4fe1\u4fe1",lazy:!0,headerLeft:l.default.createElement(i.View,null),gesturesEnabled:!1}};var _=function(e){function t(e){babelHelpers.classCallCheck(this,t);var a=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Date.prototype.format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var a in t){var n=t[a];new RegExp("("+a+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?n:("00"+n).substr((""+n).length)))}return e},a}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"render",value:function(){var e=this.props,t=e.avatar,a=e.unReadMessageCount,n=e.name,r=e.latestTime,o=e.latestMessage,s=e.onPress,d=(0,c.timeDifference)(new Date(r).format("yyyy-MM-dd hh:mm:ss"));return l.default.createElement(i.TouchableHighlight,{delayPressIn:60,delayPressOut:230,onPress:s},l.default.createElement(i.View,{style:G.ConversationCell},l.default.createElement(i.View,{style:G.leftBox},l.default.createElement(i.Image,{source:{uri:""+u.default.domain+t},style:G.avatar}),l.default.createElement(m.Badge,{style:G.cellBadge,unReadMessageCount:a,height:18})),l.default.createElement(i.View,{style:G.boxRight},l.default.createElement(i.View,{style:G.boxCeil},l.default.createElement(i.Text,{style:G.sessionName,numberOfLines:1},"."==n?"\u7fa4\u804a":n),l.default.createElement(i.Text,{style:G.latestTime},d)),l.default.createElement(i.Text,{style:G.boxFloor,numberOfLines:1},o))))}}]),t}(l.default.Component);_.propTypes={avatar:p.default.string.isRequired,name:p.default.any.isRequired,latestTime:p.default.number.isRequired,latestMessage:p.default.string.isRequired,onPress:p.default.func.isRequired},r.propTypes={data:p.default.array};var G=b.default.create({menuContent:{width:120,borderRadius:5,backgroundColor:m.Color.LightBlack,alignItems:"flex-start",justifyContent:"center"},upIcon:{zIndex:800,backgroundColor:"transparent",position:"absolute",right:12,top:-16},menuBox:{paddingVertical:6,width:"100%"},menuItem:{marginLeft:16,flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},container:{position:"relative",flex:1,height:"100%",justifyContent:"flex-start",alignItems:"stretch",backgroundColor:m.Color.BackgroundGrey},ConversationCell:{flexDirection:"row",backgroundColor:m.Color.White},leftBox:{padding:6},avatar:{borderRadius:4,width:50,height:50},cellBadge:{position:"absolute",top:2,right:0},boxRight:{flex:1,padding:10},boxCeil:{flex:1,flexDirection:"row",justifyContent:"space-between"},sessionName:{fontSize:m.FontSize.Content,color:m.Color.Black},boxFloor:{fontSize:m.FontSize.Annotation,color:"#9A9A9A"},latestTime:{fontSize:m.FontSize.Annotation,color:"#B3B3B3"},emptyMessage:{flex:1,justifyContent:"center",alignItems:"center"},emptyMessageImage:{opacity:.6},emptyMessageText:{color:m.Color.LightBlack,fontSize:m.FontSize.Annotation}}),q=function(e){return{RecentChatData:e.userReducer.userRecentChat,userInfo:e.userReducer}},z=function(e){return{addRecnentChatUnshift:(0,f.compose)(e,B.addRecnentChatUnshift)}};n.default=(0,h.connect)(q,z)(T)},1099); __d(function(e,t,i,r){Object.defineProperty(r,"__esModule",{value:!0});var n=t(13),l=babelHelpers.interopRequireDefault(n),a=t(379),o=t(39),s=t(1070),c=(babelHelpers.interopRequireWildcard(s),t(482)),d=babelHelpers.interopRequireDefault(c),u=t(1068),h=(babelHelpers.interopRequireDefault(u),t(864)),f=(babelHelpers.interopRequireDefault(h),t(1057)),m=(babelHelpers.interopRequireDefault(f),t(1097)),y=(babelHelpers.interopRequireDefault(m),t(1062)),g=babelHelpers.interopRequireDefault(y),p=t(848),b=babelHelpers.interopRequireDefault(p),k=t(381),x=babelHelpers.interopRequireDefault(k),C=t(849),F=(l.default.createElement(g.default,{name:"ios-person",size:30,color:"#4F8EF7"}),function(e){function t(e){babelHelpers.classCallCheck(this,t);var i=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i._keyExtractor=function(e,t){return e.key},i.state={touchDisabled:!0,friendList:e.friendList,checkBoxIconName:"ios-checkmark-circle-outline",checkedFriend:[],searchValue:"",checkState:!1,displaySelectBoxWidth:0,friendListHeight:"100%"},i}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){console.log(this.flatListHeight)}},{key:"onSubmitGroupChatRooms",value:function(){var e=this.props.onSubmit;e({friends:this.state.checkedFriend})}},{key:"switchCheckedBox",value:function(e){var t=this,i=this.state.friendList;console.log("list",i),console.log("item",e);var r=i.findIndex(function(t){return t.name===e.name});i[r].ischeck=!i[r].ischeck;var n=i.filter(function(e){return e.ischeck});e.ischeck?this.setState({friendList:Array.from(i),checkedFriend:Array.from(n),displaySelectBoxWidth:44*n.length>7*o.Dimensions.get("window").width?this.state.displaySelectBoxWidth:n.length*o.PixelRatio.get()*44},function(){n.length>1&&t._displayFlatList.scrollToEnd()}):this.deleteItemFriendList.bind(this)(e)}},{key:"deleteItemFriendList",value:function(e){var t=this.state.checkedFriend,i=this.state.friendList,r=(t.findIndex(function(t){return t.name===e.name}),this.state.friendList.findIndex(function(t){return t.name===e.name}));i[r].ischeck=!1;var n=i.filter(function(e){return e.ischeck});this.setState({friendList:Array.from(i),checkedFriend:Array.from(n),displaySelectBoxWidth:n.length*o.PixelRatio.get()*44})}},{key:"_seletFriendRow",value:function(e){var t=this,i=e.item;e.index;return l.default.createElement(o.View,null,l.default.createElement(o.TouchableOpacity,{delayPressIn:200,delayPressOut:200,onPress:function(){return t.deleteItemFriendList.bind(t)(i)},style:E.selectListBox},l.default.createElement(o.Image,{source:{uri:""+b.default.domain+i.avatar},style:E.selectFriendFace,resizeMode:o.Image.resizeMode.content})))}},{key:"_renderRow",value:function(e){var t=this,i=e.item;e.index;return l.default.createElement(o.TouchableHighlight,{underlayColor:C.Color.LightGrey,delayPressIn:0,delayPressOut:100,onPress:function(){return t.switchCheckedBox.bind(t)(i)},style:E.itemsBox},l.default.createElement(o.View,{style:E.items},l.default.createElement(o.View,{style:E.checkboxIcon},l.default.createElement(C.CheckBoxItem,{checked:i.ischeck,onPress:function(){return t.switchCheckedBox.bind(t)(i)},style:E.checkBoxIcon})),l.default.createElement(o.Image,{source:{uri:""+b.default.domain+i.avatar},style:E.avatar}),l.default.createElement(o.Text,null," ",i.name,i.ischeck," ")))}},{key:"onChangSearchValue",value:function(e){this.setState({searchValue:e})}},{key:"_separator",value:function(){return l.default.createElement(o.View,{style:{height:"100%",backgroundColor:C.Color.White,width:4}})}},{key:"getFliatFriendHeight",value:function(e){var t=e.nativeEvent.layout.y,i=o.Dimensions.get("window").height-t;this.setState({friendListHeight:i})}},{key:"render",value:function(){var e=this,t=this.props.closeModal,i=l.default.createElement(o.TouchableOpacity,{style:E.closeBtn,onPress:t},l.default.createElement(o.Text,{style:{color:C.Color.White}},"\u53d6\u6d88")),r=l.default.createElement(o.TouchableOpacity,{style:E.MuneIcon,disabled:!this.state.checkedFriend.length,onPress:this.onSubmitGroupChatRooms.bind(this)},l.default.createElement(o.Text,{style:this.state.checkedFriend.length?{color:C.Color.White,fontWeight:"bold"}:{color:C.Color.Grey,fontWeight:"bold"}},"\u5b8c\u6210")),n=l.default.createElement(o.Text,{style:E.title},"\u9009\u62e9\u8054\u7cfb\u4eba");return l.default.createElement(o.View,null,l.default.createElement(o.StatusBar,{barStyle:"light-content",backgroundColor:"#E95F38",StatusBarAnimation:"fade"}),l.default.createElement(C.PageHeader,{style:{backgroundColor:C.Color.Black},LeftComponent:i,RightComponent:r,TextComponent:n}),l.default.createElement(o.View,{style:E.selectFriendBox},l.default.createElement(o.FlatList,{data:this.state.checkedFriend,horizontal:!0,style:[E.selectedFriendContainer,{width:this.state.displaySelectBoxWidth}],renderItem:this._seletFriendRow.bind(this),ref:function(t){return e._displayFlatList=t},keyExtractor:this._keyExtractor,scrollToEnd:function(){},getItemLayout:function(e,t){return{length:44,offset:44*t,index:t}},ItemSeparatorComponent:this._separator}),l.default.createElement(C.TextInput.Search,{placeholder:"\u641c\u7d22\u624b\u673a\u53f7",style:E.searchBox,isShowIcon:0===this.state.checkedFriend.length,value:this.state.searchValue,onChangeValue:this.onChangSearchValue.bind(this)})),l.default.createElement(o.View,{style:E.friendListTitl},l.default.createElement(o.Text,{style:{color:C.Color.Grey}},"\u9009\u62e9\u52a0\u5165\u7684\u597d\u53cb")),l.default.createElement(o.View,{onLayout:this.getFliatFriendHeight.bind(this),style:{height:this.state.friendListHeight}},l.default.createElement(o.FlatList,{data:this.state.friendList,style:[E.flatlist,{height:"100%"}],keyExtractor:this._keyExtractor,renderItem:this._renderRow.bind(this)})))}}]),t}(n.Component));F.propTypes={onSubmit:x.default.func,closeModal:x.default.func};var E=d.default.create({container:{paddingLeft:C.FontSize.White},selectFriendBox:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},selectedFriendContainer:{paddingVertical:8},seachContainer:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},selectListBox:{width:40,height:40},selectFriendFace:{width:40,height:40,overflow:"hidden"},closeBtn:{padding:9},MuneIcon:{padding:9},friendListTitl:{backgroundColor:C.Color.BackgroundGrey,paddingLeft:16,paddingVertical:4},title:{color:C.Color.White,fontSize:C.FontSize.Content,fontWeight:"bold"},searchBox:{borderColor:C.Color.BackgroundGrey,borderBottomWidth:1,borderStyle:"solid",flexShrink:1},flatlist:{backgroundColor:C.Color.BackgroundGrey},itemsBox:{backgroundColor:C.Color.White,paddingLeft:16},items:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center",height:50,borderColor:C.Color.BackgroundGrey,borderStyle:"solid",borderBottomWidth:1},checkboxIcon:{alignItems:"flex-start"},avatar:{width:40,height:40,marginRight:16},checkBoxIcon:{paddingVertical:10,paddingRight:16}}),v=function(e){return{isFetch:e.userReducer.isFetch,friendList:e.userReducer.friendList.map(function(e,t){return e.ischeck=!1,e.key=t,e})}},L=function(e){return{}};r.default=(0,a.connect)(v,L)(F)},1100); __d(function(e,t,l,r){Object.defineProperty(r,"__esModule",{value:!0});var a=t(13),n=babelHelpers.interopRequireDefault(a),o=t(379),i=t(39),s=t(482),u=babelHelpers.interopRequireDefault(s),c=t(1068),f=babelHelpers.interopRequireDefault(c),d=t(864),b=babelHelpers.interopRequireDefault(d),m=t(1057),h=(babelHelpers.interopRequireDefault(m),t(1062)),p=babelHelpers.interopRequireDefault(h),g=t(1021),C=t(849),y=(n.default.createElement(p.default,{name:"ios-person",size:30,color:"#4F8EF7"}),function(e){var t=e.hintColor;return n.default.createElement(p.default,{name:"ios-chatbubbles",size:26,color:t})}),E=function(e){function t(e){babelHelpers.classCallCheck(this,t);var l=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return l.state={},l}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"_onPressWallet",value:function(){this.props.navigation.navigate("UserWallet")}},{key:"componentDidMount",value:function(){_this=this}},{key:"render",value:function(){var e=this;return n.default.createElement(i.ScrollView,{style:v.container},n.default.createElement(i.TouchableHighlight,{delayPressOut:200,delayPressIn:0,onPress:function(){return e.props.navigation.navigate("UserInfo")}},n.default.createElement(i.View,{style:[v.cell]},n.default.createElement(i.View,{style:v.leftBox},n.default.createElement(g.CachedImage,{component:i.Image,source:{uri:"https://www.sparklabs.com/forum/styles/comboot/theme/images/default_avatar.jpg"},style:v.avatar,mutable:!0}),n.default.createElement(i.View,{style:v.userInfo},n.default.createElement(i.Text,{style:v.name},"liyuan"),n.default.createElement(i.Text,{style:v.info},"\u624b\u673a\u53f7: 167263453"))),n.default.createElement(b.default,{name:"chevron-thin-right",color:C.Color.Grey}))),n.default.createElement(C.ListItem.Header,null),n.default.createElement(C.ListItem.Label,{onPress:this._onPressWallet.bind(this),icon:n.default.createElement(b.default,{name:"wallet",color:C.Color.Grey,size:28}),labelText:"\u94b1\u5305"}),n.default.createElement(C.ListItem.Separator,null),n.default.createElement(C.ListItem.Label,{onPress:this._onPressWallet.bind(this),icon:n.default.createElement(f.default,{name:"gear",color:C.Color.Grey,size:30}),labelText:"\u8bbe\u7f6e"}),n.default.createElement(C.ListItem.Separator,null))}}]),t}(a.Component);E.navigationOptions=function(e){n.default.createElement(p.default.Button,{onPress:function(){return _this._switchMenu.bind(_this)()},backgroundColor:C.Color.Black,name:"ellipsis-h",size:26,color:C.Color.White});return{title:"\u6211",tabBarIcon:function(e){var t=e.tintColor;return n.default.createElement(y,{hintColor:t})},headerLeft:null}};var v=u.default.create({container:{flex:1,backgroundColor:C.Color.BackgroundGrey,paddingTop:20},cell:{backgroundColor:C.Color.White,borderWidth:1,borderColor:C.Color.LittleGrey,flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:15},avatar:{borderWidth:1,borderColor:C.Color.LightGrey,borderRadius:6,marginRight:15,height:60,width:60},leftBox:{flexDirection:"row",alignItems:"stretch"},userInfo:{justifyContent:"space-between",marginVertical:3},name:{fontSize:C.FontSize.Content,fontWeight:"500"},info:{fontSize:C.FontSize.Annotation}}),_=function(e){return{}},w=function(e){return{}};r.default=(0,o.connect)(_,w)(E)},1101); __d(function(e,t,n,a){Object.defineProperty(a,"__esModule",{value:!0});var l=t(13),o=babelHelpers.interopRequireDefault(l),r=t(39),i=t(482),u=babelHelpers.interopRequireDefault(i),s=t(849),c=t(1068),d=babelHelpers.interopRequireDefault(c),p=t(848),f=babelHelpers.interopRequireDefault(p);t(480);var b=(o.default.createElement(d.default,{name:"rocket",size:30,color:"#900"}),function(e){function t(e){babelHelpers.classCallCheck(this,t);var n=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._onChangeText=function(){n.setState({isCanLogin:n.state.name&&n.state.phone})},n.state={name:"",phone:"",isCanLogin:!1},n}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"_register",value:function(){var e={userName:"angelporo",passWord:"angel0112",nickName:"angel",mobile:"18303403747"},t=f.default.domain+"/user";return this.state.isCanLogin?void fetch(t,{method:"PUT",headers:{"Content-type":"application/json"},body:JSON.stringify(e)}).then(function(e){return e.json()}).then(function(e){return console.log(e)}).catch(function(e){return console.log(e)}):alert("\u6761\u4ef6\u672a\u6210\u719f!")}},{key:"render",value:function(){var e=this;return o.default.createElement(r.View,{style:h.container},o.default.createElement(s.TextInput.Label,{labelText:"\u6635\u79f0",labelStyle:h.labelStyle,autoCapitalize:"none",placeholder:"\u8bf7\u586b\u5199\u6635\u79f0",onChangeText:function(t){e.setState({name:t},function(){e._onChangeText()})},value:this.state.name,returnKeyType:"done"}),o.default.createElement(s.TextInput.Label,{labelText:"\u624b\u673a\u53f7",labelStyle:h.labelStyle,autoCapitalize:"none",placeholder:"\u8bf7\u586b\u519911\u4f4d\u624b\u673a\u53f7",onChangeText:function(t){e.setState({phone:t},function(){e._onChangeText()})},value:this.state.phone,returnKeyType:"done"}),o.default.createElement(s.Button,{style:h.registerButton,textStyle:h.loginText,disabled:!1,onPress:this._register.bind(this)},"\u6ce8\u518c"))}}]),t}(l.Component));b.navigationOptions=function(e){return{title:"\u6ce8\u518c",headerRight:o.default.createElement(d.default.Button,{onPress:function(){return alert("ok")},backgroundColor:s.Color.Black,name:"ellipsis-h",size:26,color:s.Color.White})}};var h=u.default.create({container:{flex:1,backgroundColor:"#FFF",paddingTop:70,paddingHorizontal:20},registerButton:{marginVertical:20,borderColor:s.Color.WechatGreen,backgroundColor:s.Color.WechatGreen},loginText:{color:s.Color.White,fontSize:s.FontSize.Primary,paddingVertical:10},labelStyle:{textAlign:"left",paddingHorizontal:0}});a.default=b},1102); diff --git a/android/app/src/main/assets/index.android.bundle.meta b/android/app/src/main/assets/index.android.bundle.meta index ba144c2..9a02795 100644 --- a/android/app/src/main/assets/index.android.bundle.meta +++ b/android/app/src/main/assets/index.android.bundle.meta @@ -1,2 +1,2 @@ -g b -#Dy5% ot \ No newline at end of file +yLVp +p%"| \ No newline at end of file diff --git a/ios/ImClient.xcodeproj/project.pbxproj b/ios/ImClient.xcodeproj/project.pbxproj index 0682d84..6a2f0e8 100644 --- a/ios/ImClient.xcodeproj/project.pbxproj +++ b/ios/ImClient.xcodeproj/project.pbxproj @@ -5,6 +5,7 @@ }; objectVersion = 46; objects = { + /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; @@ -52,6 +53,7 @@ 2DCD954D1E0B4F2C00145EB5 /* ImClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ImClientTests.m */; }; 361F273C6014468DAA3BDA38 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = ACDA8E8417314A36BA7205AA /* MaterialIcons.ttf */; }; 3F6E80E45DDA439FB117FD44 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 84B9CE6EC6D642D5BE0C7552 /* MaterialCommunityIcons.ttf */; }; + 408DAA9933B54341A3736375 /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31572964BE904874ACF4C2E4 /* libRNFetchBlob.a */; }; 495FF45923024D3CAFDD676E /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8149E0F541A944D59BE7882D /* Ionicons.ttf */; }; 4A652B03779F4127A0EF0D57 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DBD2A6F246414D94B6EE6D32 /* SimpleLineIcons.ttf */; }; 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; @@ -68,7 +70,6 @@ DA8CFC2450DD4243B850A8F8 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2804315DAB8B4114811FAAA4 /* Entypo.ttf */; }; E1B3823FE711488083C0F1E2 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D91FBB2CC9C344C3948652EB /* libRNFS.a */; }; F0C7A2CE13C74A2DBB7A3A1A /* libRCTImageResizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 308704DF2D604318A7485AD9 /* libRCTImageResizer.a */; }; - 408DAA9933B54341A3736375 /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31572964BE904874ACF4C2E4 /* libRNFetchBlob.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -163,6 +164,13 @@ remoteGlobalIDString = 5DBEB1501B18CEA900B34395; remoteInfo = RNVectorIcons; }; + 0BFBC4541FD9481800E34402 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6EA30BAA6703476BB2108F7A /* RNFetchBlob.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = A15C300E1CD25C330074CB35; + remoteInfo = RNFetchBlob; + }; 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; @@ -367,12 +375,14 @@ 2D02E47B1E0B4A5D006451C7 /* ImClient-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ImClient-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 2D02E4901E0B4A5D006451C7 /* ImClient-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ImClient-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 308704DF2D604318A7485AD9 /* libRCTImageResizer.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTImageResizer.a; sourceTree = ""; }; + 31572964BE904874ACF4C2E4 /* libRNFetchBlob.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFetchBlob.a; sourceTree = ""; }; 43B8F1DAA3E34F4A93E3B29D /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = ""; }; 52A852C8A1854F61BEED265F /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = ""; }; 56C813F58F3048598D756768 /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = ""; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 5FCF0FB6A612436DADE581DA /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; 6C96534D3997491B89EE39FB /* RNImagePicker.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNImagePicker.xcodeproj; path = "../node_modules/react-native-image-picker/ios/RNImagePicker.xcodeproj"; sourceTree = ""; }; + 6EA30BAA6703476BB2108F7A /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = ""; }; 72575A255C61428780F0DCCC /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 7ECEF3256F2B4376854200CD /* RNFS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFS.xcodeproj; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = ""; }; @@ -391,8 +401,6 @@ DBD2A6F246414D94B6EE6D32 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = ""; }; E1CBE1CEC2A545218604EC99 /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = ""; }; E98317D7E7AB4CEA967C2338 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = ""; }; - 6EA30BAA6703476BB2108F7A /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; name = "RNFetchBlob.xcodeproj"; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - 31572964BE904874ACF4C2E4 /* libRNFetchBlob.a */ = {isa = PBXFileReference; name = "libRNFetchBlob.a"; path = "libRNFetchBlob.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -559,7 +567,7 @@ 308704DF2D604318A7485AD9 /* libRCTImageResizer.a */, D91FBB2CC9C344C3948652EB /* libRNFS.a */, CEE548344173409786D13FD8 /* libimageCropPicker.a */, - AB382DB1F9EA46CC8E6EB2F0 /* libRNFetchBlob.a */, + 31572964BE904874ACF4C2E4 /* libRNFetchBlob.a */, ); name = "Recovered References"; sourceTree = ""; @@ -597,6 +605,14 @@ name = Products; sourceTree = ""; }; + 0BFBC4511FD9481700E34402 /* Products */ = { + isa = PBXGroup; + children = ( + 0BFBC4551FD9481800E34402 /* libRNFetchBlob.a */, + ); + name = Products; + sourceTree = ""; + }; 139105B71AF99BAD00B5F7CC /* Products */ = { isa = PBXGroup; children = ( @@ -934,6 +950,10 @@ ProductGroup = 0B21B3EF1F64D4440021DD91 /* Products */; ProjectRef = 72575A255C61428780F0DCCC /* RealmReact.xcodeproj */; }, + { + ProductGroup = 0BFBC4511FD9481700E34402 /* Products */; + ProjectRef = 6EA30BAA6703476BB2108F7A /* RNFetchBlob.xcodeproj */; + }, { ProductGroup = 0B42C5AE1F70C5C6002B8ACD /* Products */; ProjectRef = 7ECEF3256F2B4376854200CD /* RNFS.xcodeproj */; @@ -1042,6 +1062,13 @@ remoteRef = 0BC624AD1F58F163005BDEB8 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 0BFBC4551FD9481800E34402 /* libRNFetchBlob.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNFetchBlob.a; + remoteRef = 0BFBC4541FD9481800E34402 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/package.json b/package.json index fe70469..1eddbc7 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "bundle-ios": "node node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --bundle-output ./ios/bundle/index.ios.jsbundle --assets-dest ./ios/bundle", "bundle-android": "react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/", "build-android": "cd android && ./gradlew installRelease", - "build-dev-android": "cd android && ./gradlew assembleDevDebug", + "build-dev-android": "cd android && ./gradlew assembleDevDebug", + "build-pro-android":"cd android && ./gradlew assembleRelease", "dev": "cross-env NODE_ENV=development", "build": "cross-env NODE_ENV=production" }, diff --git a/src/components/#SetChatRoomInfo.js# b/src/components/#SetChatRoomInfo.js# deleted file mode 100644 index 9252a55..0000000 --- a/src/components/#SetChatRoomInfo.js# +++ /dev/null @@ -1,376 +0,0 @@ -/** - * @prettier - * 是指聊天房间信息 包括群聊显示群成员 - * Param: param - * Return: {undefined} - **/ -import React, {Component} from 'react'; -import { connect } from 'react-redux'; -import { compose } from 'redux'; -import { - View, - Text, - Image, - FlatList, - TouchableOpacity, - Switch, - ScrollView, - Modal -} from 'react-native'; -import EStyleSheet from 'react-native-extended-stylesheet'; -import FIcon from 'react-native-vector-icons/FontAwesome'; -import EIcon from 'react-native-vector-icons/Entypo'; -import EEcon from 'react-native-vector-icons/EvilIcons'; -import FFIcon from 'react-native-vector-icons/Foundation'; -import Icon from 'react-native-vector-icons/Ionicons'; -import { CachedImage } from "react-native-img-cache"; -const MyIcon = (); -import { - getGroupMemberByGroupID, - switchIsTopChat, - setGroupName, - setUserNameAsGroupChat -} from '../reducers/user/userActions'; -import NewGroupChatRoom from './NewGroupModal'; -import { - FontSize, - Button, - Color, - TextInput, - ListItem -} from '../UiLibrary/'; - -class SectChatRoomInfoAndDisplayGroupMember extends Component { - static navigationOptions = props => { - return { - title: '信息', - // headerRight: headerRight, - headerBackTitle: '返回', - headerTruncatedBackTitle: '返回', - lazy: true, - }; - } - - constructor(props) { - super(props); - const { id } = props.navigation.state.params.info - this.groupIndex = props.userRecentChat.findIndex( n => id === n.id ); - const { userRecentChat } = this.props; - // const { isTop } = userRecentChat[ this.groupIndex ] - this.state = { - isFetch: false, - isMenuShow: false, - openGroupChatRoom: false, - // isTop: isTop, - }; - } - handleDeleteAndExitGroup () { - alert('delete'); - } - componentDidMount() { - _this = this; - const { getGroupMemberByGroupID } = this.props; - // 获取群成员 - getGroupMemberByGroupID( this.props.navigation.state.params.info.id ); - } - intoSetGroupName () { - const { userRecentChat } = this.props; - const { name } = userRecentChat[ this.groupIndex ] - this.props.navigation.navigate("SetInputComponent", { - title: '群聊名称', - value: name, - onSubmit: this.handleAmendGroupChatName.bind(this) - } -); - } - intoSetUserNameAsGroup() { - const { userRecentChat } = this.props; - const { groupMembers } = userRecentChat[ this.groupIndex ]; - this.props.navigation.navigate("SetInputComponent", { - title: '设置我在群内昵称', - value: groupMembers.myUserNameAsGroup, - onSubmit: this.handleAmendUserNameAsGroupChat.bind(this) - }); - } - - openAddfriendsToGroupMember () { - this.setState({ - openGroupChatRoom: true - }); - } - handleAmendUserNameAsGroupChat ({value}) { - // 提交设置群聊名称 - const { setUserNameAsGroupChat } = this.props; - setUserNameAsGroupChat({ - setType: 'setUserNameByGroup', - content: value, - index: this.groupIndex - }) - } - _switchIsTopGroup () { - // 切换顶置聊天功能 - const { userRecentChat, switchIsTopChat } = this.props; - const { isTop } = userRecentChat[ this.groupIndex ]; - switchIsTopChat({ - index: this.groupIndex, - isTop: !isTop - }); - } - - handleAmendGroupChatName ({value}) { - // 提交设置群聊名称 - const { setGroupName } = this.props; - setGroupName({ - setType: 'setGroupName', - content: value, - index: this.groupIndex - }) - } - handleAddFriendToGroupChat({ friends }) { - /** - * 选择联系人添加到群聊中 - * 发送请求到后台 添加 - * Param: param - * Return: { undefined } - **/ - alert( '添加到列表', friends.length ); - } - - componentWillUpdate(props, nextProps) { - - } - - render () { - const { userRecentChat } = this.props; - const { name, isTop, groupMembers } = userRecentChat[ this.groupIndex ] - return ( - - { - /** - - **/ - } - - - ( { name } )} - onPress={ this.intoSetGroupName.bind(this)}/> - - - ( - )} - /> - - - ( { groupMembers.myUserNameAsGroup } )} - onPress={ this.intoSetUserNameAsGroup.bind(this)} - /> - - - alert('enen') } - /> - - - { -/** - * groupMembers.affiliations > 1 (群聊) 否则单聊 - */ - groupMembers.affiliations > 1 ? ( - - - - ) : null - } - - - this.setState({ openGroupChatRoom: !this.state.openGroupChatRoom})} - animationType={ "slide" } - transparent={ false } - onShow={() => this.setState({ isMenuShow: false })} - visible={ this.state.openGroupChatRoom }> - {/*// NOTE: 发送红包type选项(群发和单发) */} - this.setState({ - openGroupChatRoom: !this.state.openGroupChatRoom - })} - onSubmit={ this.handleAddFriendToGroupChat.bind(this)} - /> - - - ); - } -} - -// 群成员组件 -export class GroupMembers extends Component{ - constructor(props) { - super(props); - } - _renderItem ({item}) { - console.log(item) - if(__DEV__) { - if(!item.avatar) throw new Error('群成员头像字段出错'); - if(!item.id) throw new Error('群成员id字段出错'); - if(!item.userName) throw new Error('群成员id字段出错'); - } - return ( - - - { item.userName } - - ); - } - _addGroupItem () { - const { handleAddFriends } = this.props; - return ( - - - - - - - ); - } - render () { - const { data } = this.props; - return ( - - { - data.map( (n, i) => { - return this._renderItem({item: n}); - } ) - } - { - this._addGroupItem() - } - - ); - } -} - -const styles = EStyleSheet.create({ - container: { - }, - utilBar: { - marginTop: 15, - }, - groupMembersItemBox: { - marginTop: 15, - justifyContent: 'center', - alignItems: 'center', - width: '25%', - }, - addGroupMembersItem: { - marginTop: 15, - width: '25%', - justifyContent: 'center', - alignItems: 'center', - }, - ListItemLabel: { - height: 45, - borderColor: Color.LightGrey, - borderStyle: 'solid', - borderBottomWidth: 1 - }, - ListItemLableBox: { - backgroundColor: Color.White - }, - AddGroupMemberItemIcon: { - width: 40, - height: 40, - borderStyle: 'solid', - borderWidth: 1, - borderRadius: 5, - borderColor: Color.LightGrey, - justifyContent: 'center', - alignItems: 'center' - }, - groupMemberItemAvatar: { - borderRadius: 4, - overflow: 'hidden', - width: 40, - height: 40, - justifyContent: 'center', - alignItems: 'center' - }, - deleteGroup: { - paddingVertical: 5, - borderColor: Color.WechatGreen , - backgroundColor: Color.WechatGreen , - marginHorizontal: 20 - }, - whiteText: { - color: Color.White, - fontSize: FontSize.Main - }, - AddGroupMemberItem: { - width: 40, - height: 40, - }, - groupMembers: { - paddingVertical: 10, - backgroundColor: Color.White, - justifyContent: 'flex-start', - alignItems: 'center', - flexDirection: 'row', - flexWrap: 'wrap' - } -}); - -let mapStateToProps = state => ({ - userRecentChat: state.userReducer.userRecentChat -}); - -let mapDispatchToProps = dispatch => ({ - getGroupMemberByGroupID: compose( dispatch, getGroupMemberByGroupID), - switchIsTopChat: compose( dispatch, switchIsTopChat ), - setGroupName: compose( dispatch, setGroupName), - setUserNameAsGroupChat: compose( dispatch, setUserNameAsGroupChat), -}); - -export default connect( mapStateToProps, mapDispatchToProps )( SectChatRoomInfoAndDisplayGroupMember ); diff --git a/src/components/AddFriend.js b/src/components/AddFriend.js index 8ef273e..6b636b9 100644 --- a/src/components/AddFriend.js +++ b/src/components/AddFriend.js @@ -63,7 +63,7 @@ class AddFriendComponent extends Component { return ( 0) { return ( @@ -357,6 +358,8 @@ Date.prototype.format = function (format) { } } + +// 好友最近聊天有上角菜单 function MenuBox({data, isShow, flatListData, @@ -376,8 +379,8 @@ function MenuBox({data, diff --git a/src/components/ChatRoom.js b/src/components/ChatRoom.js index d87e77c..ff5e715 100644 --- a/src/components/ChatRoom.js +++ b/src/components/ChatRoom.js @@ -35,7 +35,11 @@ import { import WebIM from '../Lib/WebIM.js'; import { getNowFormatDate } from '../utils.js'; import EStyleSheet from 'react-native-extended-stylesheet'; -import { changeKeyHeight, sendChatTxtMeg } from '../reducers/user/userActions'; +import { changeKeyHeight, + sendChatTxtMeg, + appendToMembersByRoomId, + getGroupsMemberByUserName + } from '../reducers/user/userActions'; import Icon from 'react-native-vector-icons/Ionicons'; import Micon from 'react-native-vector-icons/MaterialIcons'; import MMicon from 'react-native-vector-icons/MaterialCommunityIcons'; @@ -64,28 +68,27 @@ class ChatRoom extends Component { state: {}; currentMaxRowId: 0; chatListView: {}; - // 判断用户是否输入过 _userHasBeenInputed: false; _userAtPage = 0; _userReachEnd = true; static navigationOptions = ({navigation}) => { - const IconName = navigation.state.params.isPersons === "group" ? "ios-people" : "ios-person" - const headerRight = ( navigation.state.params.chatListSwitchMenu() } - name={ IconName } - backgroundColor={Color.Black} - size={ 24 } - iconStyle={{ marginRight: 10 }} - color={Color.White}/>) - return { - headerRight: headerRight , - headerTitle: navigation.state.params.roomName, - lazy: true, - gesturesEnabled: false - }; + const IconName = navigation.state.params.isPersons === config.chatgroups ? "ios-people" : "ios-person" + const headerRight = ( navigation.state.params.chatListSwitchMenu() } + name={ IconName } + backgroundColor={Color.Black} + size={ 24 } + iconStyle={{ marginRight: 10 }} + color={Color.White}/>) + return { + headerRight: headerRight , + headerTitle: navigation.state.params.roomName, + lazy: true, + gesturesEnabled: false }; + }; constructor(props) { super(props); @@ -121,6 +124,33 @@ class ChatRoom extends Component { redPackageBackground: 'transparent', // 红包背景 redPackageOpacity: 0 }; + const { appendToMembersByRoomId, + store, + getGroupsMemberByUserName, + } = props + const roomInfo = this.props.navigation.state.params.info + const rencentIdx = store.userRecentChat.findIndex( n => n.id == roomInfo.id) + let membersObj = store.userRecentChat[rencentIdx].groupMembers; + // 获取当前群聊和单聊成员 + if (roomInfo.type == 'users') { + // 单聊添加对方为成员列表中 + const member = { + name: roomInfo.id, + age: roomInfo.age, + id: roomInfo.id, + userName: roomInfo.name, + avatar: roomInfo.avatar + } + // 添加群成员到指定roomid中 + appendToMembersByRoomId({members: [member], idx: rencentIdx }) + }else { + // NOTE: 群聊成员, 服务器端获取群成员 + // store 中groupMembersEntity(成员列表实体) groupMembers(成员抽象) + if (store.userRecentChat[rencentIdx].groupMembersEntity.length != membersObj.length) { + let aaa = membersObj.map(n => n.owner == "" ? { userName: n.member } : {userName: n.owner}) + getGroupsMemberByUserName({userNames: aaa, idx: rencentIdx}) + } + } } layout(ref) { /** @@ -176,6 +206,7 @@ class ChatRoom extends Component { // 获取发送消息request getSendMsgRequestBody () { var requestBody + console.log(this.roomOption) if (this.roomOption.type === config.chat) { // 单聊 requestBody = { @@ -231,7 +262,7 @@ class ChatRoom extends Component { onPreddRedPackage={this._onOpenReadPackage.bind(this)} currentUser={ store.userName } message={ item } - key={ index } + key={ item.id } handleImg= {this.handlePressImgContent.bind(this)} /> ); @@ -273,7 +304,9 @@ class ChatRoom extends Component { } lookChatRoomInfo () { - this.props.navigation.navigate('SectChatRoomInfoAndDisplayGroupMember',{ + console.log(this.props) + // 构建和最近联系表中数据相同的结构体发送到最近联系人中, 然后打开 + this.props.navigation.navigate('SectChatRoomInfoAndDisplayGroupMember',{ info: this.props.navigation.state.params.info, }); } @@ -302,12 +335,15 @@ class ChatRoom extends Component { } componentDidMount() { // 获取取消语音滑动距离 + const { appendToMembersByRoomId, + store, + getGroupsMemberByUserName, + } = this.props this.layout(this.voiceContent) .then( tootInfo => { const ToolBoxTopDistance = tootInfo.y; this.layout(this.voiceCancelButton) .then(data => { - // console.log(data); const LCD = height; const targetPaddingTop = ToolBoxTopDistance - data.y; this.moveDistance = targetPaddingTop; @@ -832,7 +868,9 @@ const mapStateToProps = state => ({ const mapDispatchToProps = dispatch => ({ changeGlobelKeyHeight: compose( dispatch, changeKeyHeight), - sendChatTxtMeg: compose( dispatch, sendChatTxtMeg) + sendChatTxtMeg: compose( dispatch, sendChatTxtMeg), + appendToMembersByRoomId: compose( dispatch, appendToMembersByRoomId), + getGroupsMemberByUserName: compose( dispatch, getGroupsMemberByUserName) }); export default connect(mapStateToProps, mapDispatchToProps)(ChatRoom); diff --git a/src/components/ContactList.js b/src/components/ContactList.js index c29b4a2..5611780 100644 --- a/src/components/ContactList.js +++ b/src/components/ContactList.js @@ -71,6 +71,35 @@ class UserContackList extends Component { // await this.props.refresh(); this.setState({ refreshing: false }); } + + + _handleIntoChatRoom ({item}) { + const { addRecnentChatUnshift, rencentChatList } = this.props; + // NOTE: 构建最近聊天数据结构, 添加到本地最近聊天数据中 + const has = rencentChatList.findIndex( n => n.id == item.name) + const recentStruct = { + latestMessage: "", + latestTime: undefined, + name: item.name, + id: item.name, + type: item.type, + isTop: false, + affiliations: 1, + recentKey: undefined, + groupMembers: [{ + userName: item.name, + avatar: item.avatar, + }], + avatar: item.avatar, + chatRoomHistory: [] + } + if (has == -1) { + // 不存在则添加到最近联系人列表中 + addRecnentChatUnshift({ content: recentStruct}) + } + this.props.navigation.navigate('ChatRoom',{ info : recentStruct }); + } + // 好友item _renderRow ({item}) { const avatar = ( @@ -83,13 +112,12 @@ class UserContackList extends Component { item.userid = item.name; return ( alert('avatar perssed') } - onPress={()=>{ - this.props.navigation.navigate('ChatRoom',{ info : item }); - }} + onPress={() => this._handleIntoChatRoom.bind(this)({item:item})} /> ); } @@ -143,11 +171,13 @@ const styles = EStyleSheet.create({ }); const mapStateToProps = state => ({ - friendListData: state.userReducer.friendList + friendListData: state.userReducer.friendList, + rencentChatList: state.userReducer.userRecentChat, }); const mapDispatchToProps = dispatch => ({ - refresh: compose( dispatch, userAction.getRosterByIM) + refresh: compose( dispatch, userAction.getRosterByIM), + addRecnentChatUnshift: compose( dispatch, userAction.addRecnentChatUnshift), }); export default connect(mapStateToProps, mapDispatchToProps)(UserContackList); diff --git a/src/components/SetChatRoomInfo.js b/src/components/SetChatRoomInfo.js index 77d93b7..320ebcd 100644 --- a/src/components/SetChatRoomInfo.js +++ b/src/components/SetChatRoomInfo.js @@ -24,6 +24,7 @@ import EEcon from 'react-native-vector-icons/EvilIcons'; import FFIcon from 'react-native-vector-icons/Foundation'; import Icon from 'react-native-vector-icons/Ionicons'; import { CachedImage } from "react-native-img-cache"; +import config from "../config" const MyIcon = (); import { getGroupMemberByGroupID, @@ -69,19 +70,17 @@ class SectChatRoomInfoAndDisplayGroupMember extends Component { } componentDidMount() { _this = this; - const { getGroupMemberByGroupID } = this.props; // 获取群成员 - getGroupMemberByGroupID( this.props.navigation.state.params.info.id ); } - intoSetGroupName () { - const { userRecentChat } = this.props; - const { name } = userRecentChat[ this.groupIndex ] - this.props.navigation.navigate("SetInputComponent", { - title: '群聊名称', - value: name, - onSubmit: this.handleAmendGroupChatName.bind(this) - } -); + intoSetGroupName () { + const { userRecentChat } = this.props; + const { name } = userRecentChat[ this.groupIndex ] + this.props.navigation.navigate("SetInputComponent", { + title: '群聊名称', + value: name, + onSubmit: this.handleAmendGroupChatName.bind(this) + } + ); } intoSetUserNameAsGroup() { const { userRecentChat } = this.props; @@ -141,13 +140,13 @@ class SectChatRoomInfoAndDisplayGroupMember extends Component { } render () { - const { userRecentChat } = this.props; - const { name, isTop, groupMembers } = userRecentChat[ this.groupIndex ] + const { userRecentChat, userName } = this.props; + const { name, isTop, groupMembersEntity, groupMembers, type, owner } = userRecentChat[ this.groupIndex ] return ( {/*渲染群成员*/} @@ -196,7 +195,7 @@ class SectChatRoomInfoAndDisplayGroupMember extends Component { /** * groupMembers.affiliations > 1 (群聊) 否则单聊 */ - groupMembers.affiliations > 1 ? ( + type == config.chatgroups && owner == userName ? (