2018-04-03 12:35:41 +00:00
|
|
|
const { SentryClient } = require('@sentry/electron');
|
2018-04-06 11:15:23 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
const { ipcMain } = require('electron');
|
2018-04-03 12:35:41 +00:00
|
|
|
|
2018-04-06 11:15:23 +00:00
|
|
|
let crashReportsEnabled = true;
|
2018-04-03 12:35:41 +00:00
|
|
|
const DSN =
|
|
|
|
'https://cb7b474b2e874afb8e400c47d1452ecc:7876224cbff543d992cb0ac4021962f8@sentry.io/1040940';
|
|
|
|
|
2018-04-03 13:58:21 +00:00
|
|
|
const isDev = () => {
|
|
|
|
return fs.existsSync('.git');
|
|
|
|
};
|
|
|
|
|
2018-04-06 11:15:23 +00:00
|
|
|
const shouldSendCallback = () => {
|
|
|
|
return !isDev() && crashReportsEnabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ipcMain.on('settings.changed', function (event, settings) {
|
|
|
|
crashReportsEnabled = settings.crash_reports;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
SentryClient.create({
|
|
|
|
dsn: DSN,
|
|
|
|
shouldSendCallback: shouldSendCallback
|
|
|
|
});
|