Browse Source

Disable send anonymous usage statistics by default and added option in Preferences

pull/1793/merge
Ramiro Saenz 7 years ago
parent
commit
19ab2d7c82
  1. 15
      app/Application.js
  2. 6
      app/view/preferences/Preferences.js
  3. 7
      electron/main.js

15
app/Application.js

@ -26,6 +26,21 @@ Ext.define('Rambox.Application', {
}
,launch: function () {
// Prevent track if the user have disabled this option (default: false)
if ( !ipc.sendSync('sendStatistics') ) {
ga_storage = {
_enableSSL: Ext.emptyFn
,_disableSSL: Ext.emptyFn
,_setAccount: Ext.emptyFn
,_setDomain: Ext.emptyFn
,_setLocale: Ext.emptyFn
,_setCustomVar: Ext.emptyFn
,_deleteCustomVar: Ext.emptyFn
,_trackPageview: Ext.emptyFn
,_trackEvent: Ext.emptyFn
}
}
// Set Google Analytics events
ga_storage._setAccount('UA-80680424-1');
ga_storage._trackPageview('/index.html', 'main');

6
app/view/preferences/Preferences.js

@ -337,6 +337,12 @@ Ext.define('Rambox.view.preferences.Preferences',{
}
]
}
,{
xtype: 'checkbox'
,name: 'sendStatistics'
,boxLabel: locale['preferences[27]']
,value: config.sendStatistics
}
]
}
];

7
electron/main.js

@ -38,6 +38,7 @@ const config = new Config({
,locale: 'en'
,enable_hidpi_support: false
,default_service: 'ramboxTab'
,sendStatistics: false
,x: undefined
,y: undefined
@ -277,7 +278,7 @@ function updateBadge(title) {
title = title.split(" - ")[0]; //Discard service name if present, could also contain digits
var messageCount = title.match(/\d+/g) ? parseInt(title.match(/\d+/g).join("")) : 0;
messageCount = isNaN(messageCount) ? 0 : messageCount;
tray.setBadge(messageCount, config.get('systemtray_indicator'));
if (process.platform === 'win32') { // Windows
@ -336,6 +337,10 @@ ipcMain.on('setConfig', function(event, values) {
}
});
ipcMain.on('sendStatistics', function(event) {
event.returnValue = config.get('sendStatistics');
});
ipcMain.on('validateMasterPassword', function(event, pass) {
if ( config.get('master_password') === require('crypto').createHash('md5').update(pass).digest('hex') ) {
createWindow();

Loading…
Cancel
Save