mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
electron-17: added support to get crash directory info for users amongst other minor changes
This commit is contained in:
parent
be55c4df84
commit
9f7bc10287
@ -8,8 +8,8 @@
|
||||
"display": ""
|
||||
},
|
||||
"crashReporterDetails": {
|
||||
"backendURL": "https://crash.symphony.com/",
|
||||
"sendCrashReports": true,
|
||||
"autoSubmit": true
|
||||
"submitURL": "https://crash.symphony.com/",
|
||||
"uploadToServer": false,
|
||||
"companyName": "Symphony"
|
||||
}
|
||||
}
|
@ -1,32 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const {crashReporter} = require('electron');
|
||||
const {app} = process.type === 'browser' ? electron : electron.remote;
|
||||
|
||||
let crashReporterDetails;
|
||||
let crashDirectoryPath;
|
||||
|
||||
/**
|
||||
* Setup the crash reporter with appropriate information
|
||||
* @param crashReporterDetails: An object to get crash information
|
||||
* from the global config file
|
||||
* @param detailObj: An object to send extra parameters
|
||||
* via the crash reporter
|
||||
*/
|
||||
function setupCrashReporter(detailObj, crashReporterDetails) {
|
||||
function setupCrashReporter(detailObj) {
|
||||
|
||||
// Fetch details from config file
|
||||
if (!crashReporterDetails){
|
||||
return
|
||||
}
|
||||
|
||||
let crashReportInfo = {
|
||||
companyName: app.getName(),
|
||||
submitURL: crashReporterDetails.backendURL,
|
||||
autoSubmit: crashReporterDetails.autoSubmit,
|
||||
uploadToServer: false,
|
||||
extra: detailObj
|
||||
};
|
||||
|
||||
// App store builds cannot use crash reporter, so, return if that's the case
|
||||
// App store builds cannot use crash reporter, so, exit if that's the case
|
||||
if (process.platform === 'darwin' && process.mas) {
|
||||
return
|
||||
}
|
||||
@ -35,7 +22,26 @@ function setupCrashReporter(detailObj, crashReporterDetails) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the crash reporter info is empty, exit
|
||||
if (!crashReporterDetails){
|
||||
return
|
||||
}
|
||||
|
||||
let crashReportInfo = crashReporterDetails;
|
||||
crashReportInfo.extra = detailObj;
|
||||
crashReporter.start(crashReportInfo);
|
||||
|
||||
crashDirectoryPath = crashReporter.getCrashesDirectory();
|
||||
}
|
||||
|
||||
exports.setupCrashReporter = setupCrashReporter;
|
||||
function setCrashReporterDetails(crashReporterInfo) {
|
||||
crashReporterDetails = crashReporterInfo;
|
||||
}
|
||||
|
||||
function getCrashDirectoryPath() {
|
||||
return crashDirectoryPath;
|
||||
}
|
||||
|
||||
exports.setupCrashReporter = setupCrashReporter;
|
||||
exports.setCrashReporterDetails = setCrashReporterDetails;
|
||||
exports.getCrashDirectoryPath = getCrashDirectoryPath;
|
@ -220,12 +220,13 @@ function createWin(urlFromConfig) {
|
||||
function initializeCrashReporter () {
|
||||
getConfigField('crashReporterDetails').then(
|
||||
function (data) {
|
||||
crashReporter.setupCrashReporter({'window': 'main'}, data);
|
||||
crashReporter.setCrashReporterDetails(data);
|
||||
crashReporter.setupCrashReporter({'window': 'main'});
|
||||
}
|
||||
).catch(function (err) {
|
||||
let title = 'Error loading configuration';
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,6 +7,7 @@ const isMac = require('../utils/misc.js').isMac;
|
||||
const log = require('../log.js');
|
||||
const logLevels = require('../enums/logLevels.js');
|
||||
const eventEmitter = require('../eventEmitter');
|
||||
const crashReporter = require('../crashReporter');
|
||||
|
||||
let minimizeOnClose = false;
|
||||
let launchOnStartup = false;
|
||||
@ -97,10 +98,30 @@ const template = [{
|
||||
},
|
||||
{
|
||||
role: 'help',
|
||||
submenu: [{
|
||||
label: 'Learn More',
|
||||
click() { electron.shell.openExternal('https://www.symphony.com'); }
|
||||
}]
|
||||
submenu: [
|
||||
{
|
||||
label: 'Learn More',
|
||||
click() { electron.shell.openExternal('https://www.symphony.com'); }
|
||||
},
|
||||
{
|
||||
label: 'Crash Directory Info',
|
||||
click() {
|
||||
electron.dialog.showMessageBox(null, {
|
||||
type: 'info',
|
||||
buttons: ['Copy', 'OK'],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
noLink: true,
|
||||
title: 'Crash Directory Path',
|
||||
message: crashReporter.getCrashDirectoryPath()
|
||||
}, response);
|
||||
function response(buttonId) {
|
||||
if (buttonId === 0) {
|
||||
electron.clipboard.writeText(crashReporter.getCrashDirectoryPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -54,14 +54,7 @@ const throttledSetBadgeCount = throttle(1000, function(count) {
|
||||
});
|
||||
});
|
||||
|
||||
// Setup the crash reporter
|
||||
let demoData = {
|
||||
"backendURL": "https://crash.symphony.com/",
|
||||
"sendCrashReports": true,
|
||||
"autoSubmit": true
|
||||
};
|
||||
crashReporter.setupCrashReporter({'window': 'preloadMain'}, demoData);
|
||||
|
||||
crashReporter.setupCrashReporter({'window': 'preloadMain'});
|
||||
createAPI();
|
||||
|
||||
// creates API exposed from electron.
|
||||
|
@ -93,18 +93,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
let url = initialUrl;
|
||||
let key = getGuid();
|
||||
|
||||
/**
|
||||
* Get crash info from global config and setup crash reporter.
|
||||
*/
|
||||
getConfigField('crashReporterDetails').then(
|
||||
function (data) {
|
||||
crashReporter.setupCrashReporter({'window': 'main'}, data);
|
||||
}
|
||||
).catch(function (err) {
|
||||
let title = 'Error loading configuration';
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
});
|
||||
|
||||
crashReporter.setupCrashReporter({'window': 'windowMgr'});
|
||||
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
||||
|
||||
let newWinOpts = {
|
||||
|
Loading…
Reference in New Issue
Block a user