Merge pull request #1730 from dpalou/MOBILE-2829

Mobile 2829
main
Juan Leyva 2019-01-16 12:48:40 +01:00 committed by GitHub
commit 6e70b4d5b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 18 deletions

View File

@ -70,6 +70,24 @@ function createWindow() {
mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + ' ' + userAgent); mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + ' ' + userAgent);
} }
// Make sure that only a single instance of the app is running.
var gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
// It's not the main instance of the app, kill it.
app.exit();
return;
}
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Another instance was launched. If it was launched with a URL, it should be in the second param.
if (commandLine && commandLine[1]) {
appLaunched(commandLine[1]);
} else {
focusApp();
}
});
// This method will be called when Electron has finished initialization and is ready to create browser windows. // This method will be called when Electron has finished initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.on('ready', function() { app.on('ready', function() {
@ -122,23 +140,6 @@ fs.readFile(path.join(__dirname, 'config.json'), 'utf8', (err, data) => {
} }
}); });
// Make sure that only a single instance of the app is running.
var shouldQuit = app.makeSingleInstance((argv, workingDirectory) => {
// Another instance was launched. If it was launched with a URL, it should be in the second param.
if (argv && argv[1]) {
appLaunched(argv[1]);
} else {
focusApp();
}
});
// For some reason, shouldQuit is always true in signed Mac apps so we should ingore it.
if (shouldQuit && os.platform().indexOf('darwin') == -1) {
// It's not the main instance of the app, kill it.
app.exit();
return;
}
// Listen for open-url events (Mac OS only). // Listen for open-url events (Mac OS only).
app.on('open-url', (event, url) => { app.on('open-url', (event, url) => {
event.preventDefault(); event.preventDefault();

View File

@ -206,7 +206,7 @@
} }
], ],
"compression": "maximum", "compression": "maximum",
"electronVersion": "2.0.4", "electronVersion": "4.0.1",
"mac": { "mac": {
"category": "public.app-category.education", "category": "public.app-category.education",
"icon": "resources/desktop/icon.icns", "icon": "resources/desktop/icon.icns",