From 3f58dea0356fa8cce08f782dbf1453b83e777c86 Mon Sep 17 00:00:00 2001 From: Maxim Shishmarev Date: Thu, 30 Jan 2020 11:27:06 +1100 Subject: [PATCH] Remove mixpanel --- background.html | 1 - js/background.js | 3 +-- js/modules/loki_app_dot_net_api.js | 2 -- js/modules/loki_message_api.js | 3 --- js/modules/loki_mixpanel.js | 12 ------------ js/modules/loki_snode_api.js | 2 -- js/views/inbox_view.js | 15 --------------- libtextsecure/account_manager.js | 5 ----- package.json | 1 - preload.js | 4 ---- test/index.html | 1 - yarn.lock | 17 +---------------- 12 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 js/modules/loki_mixpanel.js diff --git a/background.html b/background.html index 7a137b73c..99018426f 100644 --- a/background.html +++ b/background.html @@ -575,7 +575,6 @@ - diff --git a/js/background.js b/js/background.js index 737355de4..4aa4e0500 100644 --- a/js/background.js +++ b/js/background.js @@ -256,8 +256,7 @@ window.getDefaultFileServer() ); } - // are there limits on tracking, is this unneeded? - // window.mixpanel.track("Desktop boot"); + window.initialisedAPI = true; if (storage.get('isSecondaryDevice')) { diff --git a/js/modules/loki_app_dot_net_api.js b/js/modules/loki_app_dot_net_api.js index 0831a4028..2760a0d61 100644 --- a/js/modules/loki_app_dot_net_api.js +++ b/js/modules/loki_app_dot_net_api.js @@ -1666,7 +1666,6 @@ class LokiPublicChannelAPI { objBody: payload, }); if (!res.err && res.response) { - window.mixpanel.track('Public Message Sent'); return res.response.data.id; } if (res.err) { @@ -1681,7 +1680,6 @@ class LokiPublicChannelAPI { } // there's no retry on desktop // this is supposed to be after retries - window.mixpanel.track('Failed to Send Public Message'); return false; } } diff --git a/js/modules/loki_message_api.js b/js/modules/loki_message_api.js index ca42bb468..b581a16ff 100644 --- a/js/modules/loki_message_api.js +++ b/js/modules/loki_message_api.js @@ -133,7 +133,6 @@ class LokiMessageAPI { try { // eslint-disable-next-line more/no-then success = await firstTrue(promises); - window.mixpanel.track('Sent Message Using Swarm API'); } catch (e) { if (e instanceof textsecure.WrongDifficultyError) { // Force nonce recalculation @@ -147,7 +146,6 @@ class LokiMessageAPI { throw e; } if (!success) { - window.mixpanel.track('Failed to Send Message Using Swarm API'); throw new window.textsecure.EmptySwarmError( pubKey, 'Ran out of swarm nodes to query' @@ -221,7 +219,6 @@ class LokiMessageAPI { } catch (e) { log.warn('Loki send message:', e); if (e instanceof textsecure.WrongSwarmError) { - window.mixpanel.track('Migrated Snode'); const { newSwarm } = e; await lokiSnodeAPI.updateSwarmNodes(params.pubKey, newSwarm); this.sendingData[params.timestamp].swarm = newSwarm; diff --git a/js/modules/loki_mixpanel.js b/js/modules/loki_mixpanel.js deleted file mode 100644 index bf9b10e23..000000000 --- a/js/modules/loki_mixpanel.js +++ /dev/null @@ -1,12 +0,0 @@ -const Mixpanel = require('mixpanel'); - -class LokiMixpanelAPI { - constructor() { - this.mixpanel = Mixpanel.init('736cd9a854a157591153efacd1164e9a'); - } - track(label) { - this.mixpanel.track(label); - } -} - -module.exports = LokiMixpanelAPI; diff --git a/js/modules/loki_snode_api.js b/js/modules/loki_snode_api.js index bb6eb9946..14a536e53 100644 --- a/js/modules/loki_snode_api.js +++ b/js/modules/loki_snode_api.js @@ -64,7 +64,6 @@ class LokiSnodeAPI { })); } catch (e) { log.warn('initialiseRandomPool error', JSON.stringify(e)); - window.mixpanel.track('Seed Node Failed'); if (seedNodes.length === 0) { throw new window.textsecure.SeedNodeError( 'Failed to contact seed node' @@ -80,7 +79,6 @@ class LokiSnodeAPI { const filteredNodes = swarmNodes.filter( node => node.address !== nodeUrl && node.ip !== nodeUrl ); - window.mixpanel.track('Unreachable Snode'); await conversation.updateSwarmNodes(filteredNodes); } diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index f0a5eab57..515fb19fd 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -327,8 +327,6 @@ $target.toggleClass('section-toggle-visible'); }, async openConversation(id, messageId) { - const conversationExists = await ConversationController.get(id); - // If we call this to create a new conversation, it can only be private // (group conversations are created elsewhere) const conversation = await ConversationController.getOrCreateAndWait( @@ -341,19 +339,6 @@ } if (conversation) { - if (conversation.isRss()) { - window.mixpanel.track('RSS Feed Opened'); - } - if (conversation.isPublic()) { - window.mixpanel.track('Loki Public Chat Opened'); - } - if (conversation.isPrivate()) { - if (conversation.isMe()) { - window.mixpanel.track('Note To Self Opened'); - } else if (conversationExists) { - window.mixpanel.track('Conversation Opened'); - } - } conversation.updateProfileName(); } diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index 14559d1cd..1dfca9417 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -25,9 +25,6 @@ (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) { @@ -142,10 +139,8 @@ ).toArrayBuffer(); return libsignal.Curve.async.createKeyPair(privKey); }; - window.mixpanel.track('Seed Restored'); } else { generateKeypair = libsignal.KeyHelper.generateIdentityKeyPair; - window.mixpanel.track('Seed Created'); } return this.queueTask(() => generateKeypair().then(async identityKeyPair => diff --git a/package.json b/package.json index b78f679e3..cbb525549 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,6 @@ "libsodium-wrappers": "^0.7.4", "linkify-it": "2.0.3", "lodash": "4.17.11", - "mixpanel": "^0.10.2", "mkdirp": "0.5.1", "moment": "2.21.0", "mustache": "2.3.0", diff --git a/preload.js b/preload.js index 005b2318b..66a510490 100644 --- a/preload.js +++ b/preload.js @@ -371,10 +371,6 @@ window.LokiFileServerAPI = require('./js/modules/loki_file_server_api'); window.LokiRssAPI = require('./js/modules/loki_rss_api'); -const LokiMixpanelAPI = require('./js/modules/loki_mixpanel.js'); - -window.mixpanel = new LokiMixpanelAPI(); - window.localServerPort = config.localServerPort; window.mnemonic = require('./libloki/modules/mnemonic'); diff --git a/test/index.html b/test/index.html index fd200152f..fb206383b 100644 --- a/test/index.html +++ b/test/index.html @@ -550,7 +550,6 @@ - diff --git a/yarn.lock b/yarn.lock index daed795cc..b5d50f439 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1976,7 +1976,7 @@ combined-stream@1.0.6: dependencies: delayed-stream "~1.0.0" -combined-stream@^1.0.6, combined-stream@~1.0.5, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.5, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -4763,14 +4763,6 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz#0106efa5d63d6d6f3ab87c999fa4877a3fd1ff97" - integrity sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ== - dependencies: - agent-base "^4.3.0" - debug "^3.1.0" - https-proxy-agent@^2.2.1: version "2.2.4" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" @@ -6399,13 +6391,6 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mixpanel@^0.10.2: - version "0.10.3" - resolved "https://registry.yarnpkg.com/mixpanel/-/mixpanel-0.10.3.tgz#2dff3bc0e17b57d6365547d315cbbf3ecfdb8a00" - integrity sha512-wIYr5o+1XSzJ80o3QED35K/yfPAKi5FigZXTSfcs4vltfeKbilIjNgwxdno7LrqzhjoSjmIyDWkI7D3lr7TwDw== - dependencies: - https-proxy-agent "3.0.0" - mkdirp@0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12"