diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 2426ef309..7a8c0fa36 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -40,7 +40,7 @@ const RocketChat = { }); }, get currentServer() { - const current = realm.objects('servers').filtered('current = true')[0]; + const current = realm.objects('servers').filtered('current = true').slice(0, 1)[0]; return current && current.id; }, @@ -327,6 +327,8 @@ Meteor.Accounts.onLogin(() => { subscription._updatedAt = rooms[index]._updatedAt; return subscription; }); + Meteor.subscribe('stream-notify-user', `${ Meteor.userId() }/subscriptions-changed`, false); + Meteor.subscribe('stream-notify-user', `${ Meteor.userId() }/rooms-changed`, false); realm.write(() => { data.forEach((subscription) => { // const subscription = { @@ -341,8 +343,6 @@ Meteor.Accounts.onLogin(() => { }); }); }).then(() => { - Meteor.subscribe('stream-notify-user', `${ Meteor.userId() }/subscriptions-changed`, false); - Meteor.subscribe('stream-notify-user', `${ Meteor.userId() }/rooms-changed`, false); console.log('subscriptions done.'); }); }); diff --git a/app/navigation.js b/app/navigation.js index 8044889c6..6733ca1a3 100644 --- a/app/navigation.js +++ b/app/navigation.js @@ -4,23 +4,31 @@ import { StackNavigator } from 'react-navigation'; import LoginView from './views/login'; import NewServerView from './views/serverNew'; import ListServerView from './views/serverList'; +import Main from './views/Main'; import RoomsListView from './views/roomsList'; import RoomView from './views/room'; import CreateChannel from './views/CreateChannel'; const MainCardNavigator = StackNavigator({ + Main: { + screen: Main + }, Rooms: { screen: RoomsListView }, Room: { screen: RoomView - // navigationOptions: { - // header: null - // } + }, + ListServerModal: { + screen: ListServerView, + navigationOptions: ({ navigation }) => + (Platform.OS === 'ios' ? ({ + headerLeft: Platform.OS === 'ios' && (