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/models/conversations.js b/js/models/conversations.js
index 17278914d..f6f81c0a2 100644
--- a/js/models/conversations.js
+++ b/js/models/conversations.js
@@ -233,6 +233,12 @@
const lastMessageModel = messages.at(0);
if (lastMessageModel) {
lastMessageModel.acceptFriendRequest();
+ await this.markRead();
+ window.Whisper.events.trigger(
+ 'showConversation',
+ this.id,
+ lastMessageModel.id
+ );
}
},
async declineFriendRequest() {
diff --git a/js/modules/loki_app_dot_net_api.js b/js/modules/loki_app_dot_net_api.js
index ba6ae7b1e..e5f4207fb 100644
--- a/js/modules/loki_app_dot_net_api.js
+++ b/js/modules/loki_app_dot_net_api.js
@@ -1706,7 +1706,6 @@ class LokiPublicChannelAPI {
objBody: payload,
});
if (!res.err && res.response) {
- window.mixpanel.track('Public Message Sent');
return res.response.data.id;
}
if (res.err) {
@@ -1721,7 +1720,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/main.js b/main.js
index 1f20c2a75..2eb625db8 100644
--- a/main.js
+++ b/main.js
@@ -14,7 +14,7 @@ const packageJson = require('./package.json');
const GlobalErrors = require('./app/global_errors');
GlobalErrors.addHandler();
-const { globalShortcut } = electron;
+const electronLocalshortcut = require('electron-localshortcut');
const getRealPath = pify(fs.realpath);
const {
@@ -286,10 +286,10 @@ function createWindow() {
// Disable system main menu
mainWindow.setMenu(null);
- globalShortcut.register('f5', () => {
+ electronLocalshortcut.register(mainWindow, 'f5', () => {
mainWindow.reload();
});
- globalShortcut.register('CommandOrControl+R', () => {
+ electronLocalshortcut.register(mainWindow, 'CommandOrControl+R', () => {
mainWindow.reload();
});
diff --git a/package.json b/package.json
index b78f679e3..876e1aee9 100644
--- a/package.json
+++ b/package.json
@@ -78,6 +78,7 @@
"electron-context-menu": "^0.15.0",
"electron-editor-context-menu": "1.1.1",
"electron-is-dev": "0.3.0",
+ "electron-localshortcut": "^3.2.1",
"emoji-datasource": "4.0.0",
"emoji-datasource-apple": "4.0.0",
"emoji-js": "3.4.0",
@@ -98,7 +99,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..b86fad54d 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==
@@ -2508,7 +2508,7 @@ debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6:
dependencies:
ms "^2.1.1"
-debug@^4.1.0, debug@^4.1.1:
+debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
@@ -2971,6 +2971,11 @@ electron-icon-maker@0.0.3:
icon-gen "^1.0.7"
jimp "^0.2.27"
+electron-is-accelerator@^0.1.0:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/electron-is-accelerator/-/electron-is-accelerator-0.1.2.tgz#509e510c26a56b55e17f863a4b04e111846ab27b"
+ integrity sha1-UJ5RDCala1Xhf4Y6SwThEYRqsns=
+
electron-is-dev@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-0.3.0.tgz#14e6fda5c68e9e4ecbeff9ccf037cbd7c05c5afe"
@@ -2981,6 +2986,16 @@ electron-is-dev@^1.0.1:
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-1.1.0.tgz#b15a2a600bdc48a51a857d460e05f15b19a2522c"
integrity sha512-Z1qA/1oHNowGtSBIcWk0pcLEqYT/j+13xUw/MYOrBUOL4X7VN0i0KCTf5SqyvMPmW5pSPKbo28wkxMxzZ20YnQ==
+electron-localshortcut@^3.2.1:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/electron-localshortcut/-/electron-localshortcut-3.2.1.tgz#cfc83a3eff5e28faf98ddcc87f80a2ce4f623cd3"
+ integrity sha512-DWvhKv36GsdXKnaFFhEiK8kZZA+24/yFLgtTwJJHc7AFgDjNRIBJZ/jq62Y/dWv9E4ypYwrVWN2bVrCYw1uv7Q==
+ dependencies:
+ debug "^4.0.1"
+ electron-is-accelerator "^0.1.0"
+ keyboardevent-from-electron-accelerator "^2.0.0"
+ keyboardevents-areequal "^0.2.1"
+
electron-notarize@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/electron-notarize/-/electron-notarize-0.2.1.tgz#759e8006decae19134f82996ed910db26d9192cc"
@@ -4763,14 +4778,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"
@@ -5729,6 +5736,16 @@ kew@^0.7.0:
resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b"
integrity sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=
+keyboardevent-from-electron-accelerator@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/keyboardevent-from-electron-accelerator/-/keyboardevent-from-electron-accelerator-2.0.0.tgz#ace21b1aa4e47148815d160057f9edb66567c50c"
+ integrity sha512-iQcmNA0M4ETMNi0kG/q0h/43wZk7rMeKYrXP7sqKIJbHkTU8Koowgzv+ieR/vWJbOwxx5nDC3UnudZ0aLSu4VA==
+
+keyboardevents-areequal@^0.2.1:
+ version "0.2.2"
+ resolved "https://registry.yarnpkg.com/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz#88191ec738ce9f7591c25e9056de928b40277194"
+ integrity sha512-Nv+Kr33T0mEjxR500q+I6IWisOQ0lK1GGOncV0kWE6n4KFmpcu7RUX5/2B0EUtX51Cb0HjZ9VJsSY3u4cBa0kw==
+
keyv@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373"
@@ -6399,13 +6416,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"