Merge pull request #497 from sachaaaaa/prevent_multiple_retrievers

[multi-device] Ensure API objects are inited only once
pull/501/head
sachaaaaa 6 years ago committed by GitHub
commit f9df221638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -205,7 +205,11 @@
window.log.info('Storage fetch');
storage.fetch();
let initialisedAPI = false;
const initAPIs = () => {
if (initialisedAPI) {
return;
}
const ourKey = textsecure.storage.user.getNumber();
window.lokiMessageAPI = new window.LokiMessageAPI(ourKey);
window.lokiP2pAPI = new window.LokiP2pAPI(ourKey);
@ -215,6 +219,7 @@
});
window.lokiP2pAPI.on('online', ConversationController._handleOnline);
window.lokiP2pAPI.on('offline', ConversationController._handleOffline);
initialisedAPI = true;
};
function mapOldThemeToNew(theme) {
@ -232,6 +237,9 @@
}
function startLocalLokiServer() {
if (window.localLokiServer) {
return;
}
const pems = window.getSelfSignedCert();
window.localLokiServer = new window.LocalLokiServer(pems);
}

Loading…
Cancel
Save