Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
development additional file added
Browse files Browse the repository at this point in the history
  • Loading branch information
talhasch committed Dec 29, 2018
1 parent 7b82e9e commit 0f942e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -49,6 +49,7 @@ main.js.map
npm-debug.log.*

app/config.js
app/dev-additions.js

# old branch files
src/
Expand Down
31 changes: 16 additions & 15 deletions app/main.dev.js
Expand Up @@ -9,8 +9,8 @@
* `./app/main.prod.js` using webpack. This gives us some performance wins.
*
*/
import {app, BrowserWindow, ipcMain} from 'electron';
import {autoUpdater} from 'electron-updater';
import { app, BrowserWindow, ipcMain } from 'electron';
import { autoUpdater } from 'electron-updater';

import MenuBuilder from './menu';

Expand Down Expand Up @@ -45,8 +45,7 @@ const installExtensions = async () => {
* Add event listeners...
*/


const sendProtocolUrl2Window = (u) => {
const sendProtocolUrl2Window = u => {
if (typeof u !== 'string') {
return false;
}
Expand All @@ -57,15 +56,15 @@ const sendProtocolUrl2Window = (u) => {
}

if (m[0]) {
mainWindow.webContents.executeJavaScript(`protocolHandler('${ m[0]}')`);
mainWindow.webContents.executeJavaScript(`protocolHandler('${m[0]}')`);
}
};

let deepUrl;

const singleInstance = app.makeSingleInstance((argv) => {
const singleInstance = app.makeSingleInstance(argv => {
if (process.platform === 'win32' || process.platform === 'linux') {
deepUrl = argv.slice(1)
deepUrl = argv.slice(1);
}

if (mainWindow) {
Expand All @@ -80,10 +79,9 @@ const singleInstance = app.makeSingleInstance((argv) => {
});

if (singleInstance) {
app.quit()
app.quit();
}


const setupWindow = async () => {
if (
process.env.NODE_ENV === 'development' ||
Expand Down Expand Up @@ -131,18 +129,23 @@ const setupWindow = async () => {
}, 1000 * 60 * 240);
}


// Protocol handler for win32 and linux
if (process.platform === 'win32' || process.platform === 'linux') {
deepUrl = process.argv.slice(1)
deepUrl = process.argv.slice(1);
}

if (deepUrl) {
setTimeout(() => {
sendProtocolUrl2Window(deepUrl);
}, 4000)
}, 4000);
}

try {
const devAdditions = require(`./dev-additions.js`);
devAdditions(mainWindow);
} catch (e) {
console.info('Development additions not found');
}
};

app.on('ready', setupWindow);
Expand All @@ -154,10 +157,9 @@ app.on('window-all-closed', () => {
app.setAsDefaultProtocolClient('steem');
app.setAsDefaultProtocolClient('esteem');


app.on('activate', () => {
if (mainWindow === null) {
setupWindow()
setupWindow();
}
});

Expand All @@ -177,7 +179,6 @@ app.on('open-url', (event, url) => {
sendProtocolUrl2Window(url);
});


// Event handlers for auto updater
autoUpdater.on('update-available', info => {
mainWindow.webContents.send('update-available', info.releaseName);
Expand Down

0 comments on commit 0f942e4

Please sign in to comment.