From a2a247fabc0ca686237e562c925f49d7c3b77f67 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Sun, 8 Oct 2017 18:36:37 +0100 Subject: [PATCH 1/2] Using launch agent for macOS and allowing only one instances --- app/src/app.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/app/src/app.js b/app/src/app.js index 6673156a..57ff1e23 100644 --- a/app/src/app.js +++ b/app/src/app.js @@ -57,6 +57,7 @@ const handleRedirect = (e, link) => { } }; + /** This function will create the tray icon */ function initTray() { // No idea why using let or var or const with tray causes the tray not to display anything @@ -81,23 +82,6 @@ function initTray() { function createWindow() { notify.init(); - // Some shortcuts to make development easier. - if (process.env.NODE_ENV === 'development') { - const { globalShortcut } = electron; - - const showNotifGlobal = globalShortcut.register('CommandOrControl+Alt+N', () => { - notify.show({ - body: 'This is a test notification.', - content: { comment_id: 728393, created_time: 1500665102, rant_id: 538347, read: 0, type: 'comment_mention', uid: 719925 }, - id: 538347, - }); - }); - - if (!showNotifGlobal) { - console.warn('registration failed :('); - } - } - // Send usage data to firebase if (process.env.NODE_ENV !== 'development') { let plat = ''; @@ -178,6 +162,18 @@ function createWindow() { initTray(); } +const shouldQuit = app.makeSingleInstance(() => { + // Someone tried to run a second instance, we should focus our window. + if (mainWindow) { + if (mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); + } +}); + +if (shouldQuit) { + app.quit(); +} + // 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. @@ -221,6 +217,9 @@ ipcMain.on('auto-launch', (event, arg) => { const AppAutoLauncher = new AutoLaunch({ name: 'devRantron', + mac: { + useLaunchAgent: true, + }, }); if (arg) { From c99f4a0619429d2dee075d4e9ff868b94e7013e3 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Sun, 8 Oct 2017 18:44:48 +0100 Subject: [PATCH 2/2] some UI fixes for the release_info --- app/src/res/sass/modules/common.sass | 12 +++++++----- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/res/sass/modules/common.sass b/app/src/res/sass/modules/common.sass index e8d02e92..85c922e1 100644 --- a/app/src/res/sass/modules/common.sass +++ b/app/src/res/sass/modules/common.sass @@ -20,15 +20,17 @@ $post_comment_height: 13rem margin: 0px 2px -3px 2px .release_info_container - padding: 0.1rem + padding: 0 0.5rem 0 2rem color: white + height: 100% + overflow-y: scroll + display: flex + justify-content: center + align-items: flex-start .release_info - padding: 1.5rem + padding: 0 1.5rem 1rem 1.5rem border-radius: 5px background-color: #515270 - max-width: 800px - margin-left: auto - margin-right: auto img width: 100% border-radius: 6px diff --git a/package-lock.json b/package-lock.json index e1d4aeca..bf6e13ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "devrantron", - "version": "1.4.0", + "version": "1.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5b3d46cf..5f9b74ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "devrantron", - "version": "1.4.0", + "version": "1.4.1", "main": "./build/app/app.js", "description": "An open source cross platform desktop application for devRant", "scripts": {