|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* global _, Whisper, Backbone, storage, lokiP2pAPI, textsecure, libsignal */
|
|
|
|
|
/* global _, Whisper, Backbone, storage, textsecure, libsignal */
|
|
|
|
|
|
|
|
|
|
/* eslint-disable more/no-then */
|
|
|
|
|
|
|
|
|
@ -218,14 +218,6 @@
|
|
|
|
|
async load() {
|
|
|
|
|
window.log.info('ConversationController: starting initial fetch');
|
|
|
|
|
|
|
|
|
|
// We setup online and offline listeners here because we want
|
|
|
|
|
// to minimize the amount of listeners we have to avoid memory leaks
|
|
|
|
|
if (!this.p2pListenersSet) {
|
|
|
|
|
lokiP2pAPI.on('online', this._handleOnline.bind(this));
|
|
|
|
|
lokiP2pAPI.on('offline', this._handleOffline.bind(this));
|
|
|
|
|
this.p2pListenersSet = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conversations.length) {
|
|
|
|
|
throw new Error('ConversationController: Already loaded!');
|
|
|
|
|
}
|
|
|
|
@ -273,13 +265,13 @@
|
|
|
|
|
|
|
|
|
|
return this._initialPromise;
|
|
|
|
|
},
|
|
|
|
|
_handleOnline(pubKey) {
|
|
|
|
|
_handleOnline: pubKey => {
|
|
|
|
|
try {
|
|
|
|
|
const conversation = this.get(pubKey);
|
|
|
|
|
conversation.set({ isOnline: true });
|
|
|
|
|
} catch (e) {} // eslint-disable-line
|
|
|
|
|
},
|
|
|
|
|
_handleOffline(pubKey) {
|
|
|
|
|
_handleOffline: pubKey => {
|
|
|
|
|
try {
|
|
|
|
|
const conversation = this.get(pubKey);
|
|
|
|
|
conversation.set({ isOnline: false });
|
|
|
|
|