From 6f16f66dc8190e77eaa209666fd79633167591e0 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 11 Aug 2017 16:57:09 -0300 Subject: [PATCH] fix warnings and better flow servers rooms room --- app/lib/rocketchat.js | 6 +++--- app/navigation.js | 22 +++++++++++---------- app/views/Main.js | 43 ++++++++++++++++++++++++++++++++++++++++++ app/views/room.js | 1 + app/views/roomsList.js | 10 +++++----- 5 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 app/views/Main.js diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 2426ef30..7a8c0fa3 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 8044889c..6733ca1a 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' && (