Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions app/lib/methods/subscriptions/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function subscribeRoom({ rid }) {
let disconnectedListener;
let notifyRoomListener;
let messageReceivedListener;
const typingTimeouts = {};

const handleConnection = () => {
this.loadMissedMessages({ rid }).catch(e => console.log(e));
Expand Down Expand Up @@ -200,12 +199,6 @@ export default function subscribeRoom({ rid }) {
messageReceivedListener.then(removeListener);
messageReceivedListener = false;
}
Object.keys(typingTimeouts).forEach((key) => {
if (typingTimeouts[key]) {
clearTimeout(typingTimeouts[key]);
typingTimeouts[key] = null;
}
});
reduxStore.dispatch(clearUserTyping());
};

Expand Down
14 changes: 11 additions & 3 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ class RoomView extends React.Component {
this.init();
});
}
if (appState === 'background' && appState !== prevProps.appState) {
this.unsubscribe();
}
}

async componentWillUnmount() {
Expand Down Expand Up @@ -234,9 +237,7 @@ class RoomView extends React.Component {
}
}
}
if (this.sub && this.sub.stop) {
this.sub.stop();
}
this.unsubscribe();
if (this.didFocusListener && this.didFocusListener.remove) {
this.didFocusListener.remove();
}
Expand Down Expand Up @@ -282,6 +283,7 @@ class RoomView extends React.Component {
this.setLastOpen(null);
}
RocketChat.readMessages(room.rid, newLastOpen).catch(e => console.log(e));
this.unsubscribe();
this.sub = await RocketChat.subscribeRoom(room);
}
}
Expand Down Expand Up @@ -324,6 +326,12 @@ class RoomView extends React.Component {
}
}

unsubscribe = () => {
if (this.sub && this.sub.stop) {
this.sub.stop();
}
}

observeRoom = (room) => {
const observable = room.observe();
this.subSubscription = observable
Expand Down
2 changes: 1 addition & 1 deletion app/views/RoomsListView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class RoomsListView extends React.Component {
this.willFocusListener = props.navigation.addListener('willFocus', () => {
// Check if there were changes while not focused (it's set on sCU)
if (this.shouldUpdate) {
animateNextTransition();
// animateNextTransition();
this.forceUpdate();
this.shouldUpdate = false;
}
Expand Down