From c921d3e3b3abf085ceb99b9ed4aec11510d0a373 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Wed, 18 Sep 2019 16:12:16 -0700 Subject: [PATCH] allow mixpanel to be already set up elsewhere --- js/background.js | 3 ++- libtextsecure/account_manager.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/background.js b/js/background.js index 1c58b43c1..04be3a822 100644 --- a/js/background.js +++ b/js/background.js @@ -230,7 +230,8 @@ window.feeds = []; window.lokiMessageAPI = new window.LokiMessageAPI(ourKey); window.lokiPublicChatAPI = new window.LokiPublicChatAPI(ourKey); - window.mixpanel = new window.LokiMixpanelAPI(); + // set up mixpanel + window.mixpanel = window.mixpanel || new window.LokiMixpanelAPI(); // incase account manager already set it up // window.mixpanel.track("Desktop boot"); window.lokiP2pAPI = new window.LokiP2pAPI(ourKey); window.lokiP2pAPI.on('pingContact', pubKey => { diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index bd7843922..e12f5db41 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -22,13 +22,14 @@ (function() { window.textsecure = window.textsecure || {}; + // set up mixpanel + window.mixpanel = window.mixpanel || new window.LokiMixpanelAPI(); + const ARCHIVE_AGE = 7 * 24 * 60 * 60 * 1000; function AccountManager(username, password) { // this.server = window.WebAPI.connect({ username, password }); this.pending = Promise.resolve(); - // set up mixpanel - window.mixpanel = new window.LokiMixpanelAPI(); } function getNumber(numberId) {