mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-12 01:46:03 +00:00
settings: Add option to toggle Error Reporting.
Adds an option to enable or disable sentry error reporting under Advanced section in General Settings. Handles both main and renderer processes. Also, changes the domain used to resolve proxy in proxy-util from google.com to example.com. Fixes #702.
This commit is contained in:
@@ -159,7 +159,10 @@ app.on('ready', () => {
|
||||
}
|
||||
|
||||
// Initialize sentry for main process
|
||||
const errorReporting = ConfigUtil.getConfigItem('errorReporting');
|
||||
if (errorReporting) {
|
||||
sentryInit();
|
||||
}
|
||||
|
||||
const isSystemProxy = ConfigUtil.getConfigItem('useSystemProxy');
|
||||
|
||||
@@ -344,6 +347,12 @@ app.on('ready', () => {
|
||||
ipcMain.on('realm-icon-changed', (event, serverURL, iconURL) => {
|
||||
page.send('update-realm-icon', serverURL, iconURL);
|
||||
});
|
||||
|
||||
// Using event.sender.send instead of page.send here to
|
||||
// make sure the value of errorReporting is sent only once on load.
|
||||
ipcMain.on('error-reporting', event => {
|
||||
event.sender.send('error-reporting-val', errorReporting);
|
||||
});
|
||||
});
|
||||
|
||||
app.on('before-quit', () => {
|
||||
|
||||
@@ -111,6 +111,7 @@ class ServerManagerView {
|
||||
showNotification: true,
|
||||
autoUpdate: true,
|
||||
betaUpdate: false,
|
||||
errorReporting: true,
|
||||
customCSS: false,
|
||||
silent: false,
|
||||
lastActiveTab: 0,
|
||||
|
||||
@@ -83,6 +83,10 @@ class GeneralSection extends BaseSection {
|
||||
</div>
|
||||
<div class="title">Advanced</div>
|
||||
<div class="settings-card">
|
||||
<div class="setting-row" id="enable-error-reporting">
|
||||
<div class="setting-description">Enable error reporting (requires restart)</div>
|
||||
<div class="setting-control"></div>
|
||||
</div>
|
||||
<div class="setting-row" id="show-download-folder">
|
||||
<div class="setting-description">Show downloaded files in file manager</div>
|
||||
<div class="setting-control"></div>
|
||||
@@ -145,6 +149,7 @@ class GeneralSection extends BaseSection {
|
||||
this.removeCustomCSS();
|
||||
this.downloadFolder();
|
||||
this.showDownloadFolder();
|
||||
this.enableErrorReporting();
|
||||
|
||||
// Platform specific settings
|
||||
|
||||
@@ -319,6 +324,18 @@ class GeneralSection extends BaseSection {
|
||||
});
|
||||
}
|
||||
|
||||
enableErrorReporting() {
|
||||
this.generateSettingOption({
|
||||
$element: document.querySelector('#enable-error-reporting .setting-control'),
|
||||
value: ConfigUtil.getConfigItem('errorReporting', true),
|
||||
clickHandler: () => {
|
||||
const newValue = !ConfigUtil.getConfigItem('errorReporting');
|
||||
ConfigUtil.setConfigItem('errorReporting', newValue);
|
||||
this.enableErrorReporting();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
clearAppDataDialog() {
|
||||
const clearAppDataMessage = 'By clicking proceed you will be removing all added accounts and preferences from Zulip. When the application restarts, it will be as if you are starting Zulip for the first time.';
|
||||
const getAppPath = path.join(app.getPath('appData'), app.getName());
|
||||
|
||||
@@ -6,10 +6,23 @@ const { initSetUp } = require('./default-util');
|
||||
const { sentryInit, captureException } = require('./sentry-util');
|
||||
|
||||
initSetUp();
|
||||
sentryInit();
|
||||
|
||||
let app = null;
|
||||
let reportErrors = true;
|
||||
if (process.type === 'renderer') {
|
||||
app = require('electron').remote.app;
|
||||
|
||||
// Report Errors to Sentry only if it is enabled in settings
|
||||
// Gets the value of reportErrors from config-util for renderer process
|
||||
// For main process, sentryInit() is handled in index.js
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.send('error-reporting');
|
||||
ipcRenderer.on('error-reporting-val', (event, errorReporting) => {
|
||||
reportErrors = errorReporting;
|
||||
if (reportErrors) {
|
||||
sentryInit();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
app = require('electron').app;
|
||||
}
|
||||
@@ -94,8 +107,10 @@ class Logger {
|
||||
}
|
||||
|
||||
reportSentry(err) {
|
||||
if (reportErrors) {
|
||||
captureException(err);
|
||||
}
|
||||
}
|
||||
|
||||
trimLog(file) {
|
||||
fs.readFile(file, 'utf8', (err, data) => {
|
||||
|
||||
@@ -52,7 +52,7 @@ class ProxyUtil {
|
||||
resolveSystemProxy(mainWindow) {
|
||||
const page = mainWindow.webContents;
|
||||
const ses = page.session;
|
||||
const resolveProxyUrl = 'www.google.com';
|
||||
const resolveProxyUrl = 'www.example.com';
|
||||
|
||||
// Check HTTP Proxy
|
||||
const httpProxy = new Promise(resolve => {
|
||||
|
||||
Reference in New Issue
Block a user