diff --git a/android/app/build.gradle b/android/app/build.gradle index fe2b0dab7..cc3990099 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -133,6 +133,7 @@ android { } dependencies { + compile project(':react-native-vector-icons') compile project(':react-native-fetch-blob') compile project(':react-native-zeroconf') compile project(':realm') @@ -147,3 +148,4 @@ task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } +apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" diff --git a/android/app/src/main/assets/fonts/Entypo.ttf b/android/app/src/main/assets/fonts/Entypo.ttf new file mode 100644 index 000000000..1c8f5e910 Binary files /dev/null and b/android/app/src/main/assets/fonts/Entypo.ttf differ diff --git a/android/app/src/main/assets/fonts/EvilIcons.ttf b/android/app/src/main/assets/fonts/EvilIcons.ttf new file mode 100644 index 000000000..b270f9851 Binary files /dev/null and b/android/app/src/main/assets/fonts/EvilIcons.ttf differ diff --git a/android/app/src/main/assets/fonts/FontAwesome.ttf b/android/app/src/main/assets/fonts/FontAwesome.ttf new file mode 100644 index 000000000..35acda2fa Binary files /dev/null and b/android/app/src/main/assets/fonts/FontAwesome.ttf differ diff --git a/android/app/src/main/assets/fonts/Foundation.ttf b/android/app/src/main/assets/fonts/Foundation.ttf new file mode 100644 index 000000000..6cce217dd Binary files /dev/null and b/android/app/src/main/assets/fonts/Foundation.ttf differ diff --git a/android/app/src/main/assets/fonts/Ionicons.ttf b/android/app/src/main/assets/fonts/Ionicons.ttf new file mode 100644 index 000000000..307ad889a Binary files /dev/null and b/android/app/src/main/assets/fonts/Ionicons.ttf differ diff --git a/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf b/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf new file mode 100644 index 000000000..69404e3d9 Binary files /dev/null and b/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf differ diff --git a/android/app/src/main/assets/fonts/MaterialIcons.ttf b/android/app/src/main/assets/fonts/MaterialIcons.ttf new file mode 100644 index 000000000..7015564ad Binary files /dev/null and b/android/app/src/main/assets/fonts/MaterialIcons.ttf differ diff --git a/android/app/src/main/assets/fonts/Octicons.ttf b/android/app/src/main/assets/fonts/Octicons.ttf new file mode 100644 index 000000000..5b1f7d6ea Binary files /dev/null and b/android/app/src/main/assets/fonts/Octicons.ttf differ diff --git a/android/app/src/main/assets/fonts/SimpleLineIcons.ttf b/android/app/src/main/assets/fonts/SimpleLineIcons.ttf new file mode 100644 index 000000000..6ecb68683 Binary files /dev/null and b/android/app/src/main/assets/fonts/SimpleLineIcons.ttf differ diff --git a/android/app/src/main/assets/fonts/Zocial.ttf b/android/app/src/main/assets/fonts/Zocial.ttf new file mode 100644 index 000000000..e4ae46c62 Binary files /dev/null and b/android/app/src/main/assets/fonts/Zocial.ttf differ diff --git a/android/app/src/main/java/com/rocketchatrn/MainApplication.java b/android/app/src/main/java/com/rocketchatrn/MainApplication.java index 7968d4e2c..80dbcc384 100644 --- a/android/app/src/main/java/com/rocketchatrn/MainApplication.java +++ b/android/app/src/main/java/com/rocketchatrn/MainApplication.java @@ -3,6 +3,7 @@ package com.rocketchatrn; import android.app.Application; import com.facebook.react.ReactApplication; +import com.oblador.vectoricons.VectorIconsPackage; import com.RNFetchBlob.RNFetchBlobPackage; import com.balthazargronon.RCTZeroconf.ZeroconfReactPackage; import io.realm.react.RealmReactPackage; @@ -26,6 +27,7 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new VectorIconsPackage(), new RNFetchBlobPackage(), new ZeroconfReactPackage(), new RealmReactPackage() diff --git a/android/settings.gradle b/android/settings.gradle index 2d578e9dd..615301479 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'RocketChatRN' +include ':react-native-vector-icons' +project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-fetch-blob' project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android') include ':react-native-zeroconf' diff --git a/app/components/Message.js b/app/components/Message.js index 13cc60761..7cc2cf616 100644 --- a/app/components/Message.js +++ b/app/components/Message.js @@ -2,8 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { View, Text, StyleSheet } from 'react-native'; import { CachedImage } from 'react-native-img-cache'; -import Markdown from 'react-native-easy-markdown'; import { emojify } from 'react-emojione'; +import Markdown from 'react-native-easy-markdown'; const styles = StyleSheet.create({ message: { diff --git a/app/components/RoomItem.js b/app/components/RoomItem.js index 89ed5c1ec..aff832999 100644 --- a/app/components/RoomItem.js +++ b/app/components/RoomItem.js @@ -1,4 +1,7 @@ import React from 'react'; + +import Ionicons from 'react-native-vector-icons/Ionicons'; +import FontAwesome from 'react-native-vector-icons/FontAwesome'; import PropTypes from 'prop-types'; import { View, Text, StyleSheet } from 'react-native'; @@ -6,37 +9,46 @@ const styles = StyleSheet.create({ container: { flex: 1, flexDirection: 'row', + padding: 24, alignItems: 'center' }, number: { minWidth: 20, - fontSize: 14, padding: 2, borderRadius: 5, backgroundColor: '#aaa', color: '#fff', textAlign: 'center', overflow: 'hidden', - marginRight: 15 + marginRight: 15, + fontSize: 14 }, roomItem: { - lineHeight: 18, - padding: 14, - flexGrow: 1 + flexGrow: 1, + fontSize: 20 + }, + icon: { + fontSize: 20, + height: 22, + width: 22 } }); export default class RoomItem extends React.PureComponent { static propTypes = { - onPressItem: PropTypes.func.isRequired, - item: PropTypes.object.isRequired, - id: PropTypes.string.isRequired + item: PropTypes.object.isRequired + } + get icon() { + const icon = { + d: 'at', + c: 'hashtag', + p: 'md-lock' + }[this.props.item.t]; + if (!icon) { + return null; + } + return ['p'].includes(this.props.item.t) ? : ; } - - _onPress = () => { - this.props.onPressItem(this.props.id); - }; - renderNumber = (item) => { if (item.unread) { return ( @@ -48,15 +60,11 @@ export default class RoomItem extends React.PureComponent { } render() { - let name = this.props.item.name; - if (this.props.item.t === 'd') { - name = `@ ${ name }`; - } else { - name = `# ${ name }`; - } + const name = this.props.item.name; return ( - { name } + {this.icon} + { name } {this.renderNumber(this.props.item)} ); diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 3ed431b5f..52102d67d 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -5,6 +5,12 @@ import realm from './realm'; export { Accounts } from 'react-native-meteor'; const RocketChat = { + + createChannel({ name, users, type }) { + return new Promise((resolve, reject) => { + Meteor.call(type ? 'createChannel' : 'createPrivateGroup', name, users, type, (err, res) => (err ? reject(err) : resolve(res))); + }); + }, get currentServer() { const current = realm.objects('servers').filtered('current = true')[0]; return current && current.id; @@ -60,6 +66,7 @@ const RocketChat = { } if (ddbMessage.collection === 'stream-notify-user') { + console.log(ddbMessage); realm.write(() => { const data = ddbMessage.fields.args[1]; data._server = { id: RocketChat.currentServer }; diff --git a/app/navigation.js b/app/navigation.js index e4b1951b7..dec315ab8 100644 --- a/app/navigation.js +++ b/app/navigation.js @@ -6,7 +6,7 @@ import NewServerView from './views/serverNew'; import ListServerView from './views/serverList'; import RoomsListView from './views/roomsList'; import RoomView from './views/room'; - +import CreateChannel from './views/CreateChannel'; const position = Platform.OS === 'ios' ? 'headerLeft' : 'headerRight'; @@ -54,6 +54,12 @@ export default new StackNavigator({ navigationOptions: ({ navigation }) => ({ headerLeft: Platform.OS === 'ios' && (