aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/electron/deepLinking.js5
-rw-r--r--src/index.js26
-rw-r--r--src/stores/AppStore.js5
3 files changed, 34 insertions, 2 deletions
diff --git a/src/electron/deepLinking.js b/src/electron/deepLinking.js
new file mode 100644
index 000000000..819fdd095
--- /dev/null
+++ b/src/electron/deepLinking.js
@@ -0,0 +1,5 @@
1export default function handleDeepLink(window, url) {
2 console.log(url);
3
4 window.webContents.send('navigateFromDeepLink', { url });
5}
diff --git a/src/index.js b/src/index.js
index 6a08e5e5a..4b6241f13 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,6 +8,7 @@ import { isDevMode, isWindows } from './environment';
8import ipcApi from './electron/ipc-api'; 8import ipcApi from './electron/ipc-api';
9import Tray from './lib/Tray'; 9import Tray from './lib/Tray';
10import Settings from './electron/Settings'; 10import Settings from './electron/Settings';
11import handleDeepLink from './electron/deepLinking';
11import { appId } from './package.json'; // eslint-disable-line import/no-unresolved 12import { appId } from './package.json'; // eslint-disable-line import/no-unresolved
12import './electron/exception'; 13import './electron/exception';
13 14
@@ -26,10 +27,18 @@ if (isWindows) {
26} 27}
27 28
28// Force single window 29// Force single window
29const isSecondInstance = app.makeSingleInstance(() => { 30const isSecondInstance = app.makeSingleInstance((argv) => {
30 if (mainWindow) { 31 if (mainWindow) {
31 if (mainWindow.isMinimized()) mainWindow.restore(); 32 if (mainWindow.isMinimized()) mainWindow.restore();
32 mainWindow.focus(); 33 mainWindow.focus();
34
35 if (process.platform === 'win32') {
36 // Keep only command line / deep linked arguments
37 const url = argv.slice(1);
38
39 console.log(url);
40 handleDeepLink(mainWindow, url);
41 }
33 } 42 }
34}); 43});
35 44
@@ -70,7 +79,8 @@ const createWindow = () => {
70 const trayIcon = new Tray(); 79 const trayIcon = new Tray();
71 80
72 // Initialize ipcApi 81 // Initialize ipcApi
73 ipcApi({ mainWindow, settings, trayIcon }); 82 const franzIpcApi = ipcApi({ mainWindow, settings, trayIcon });
83 console.log(franzIpcApi);
74 84
75 // Manage Window State 85 // Manage Window State
76 mainWindowState.manage(mainWindow); 86 mainWindowState.manage(mainWindow);
@@ -176,3 +186,15 @@ app.on('activate', () => {
176 mainWindow.show(); 186 mainWindow.show();
177 } 187 }
178}); 188});
189
190app.on('will-finish-launching', () => {
191 // Protocol handler for osx
192 app.on('open-url', (event, url) => {
193 event.preventDefault();
194 console.log(`open-url event: ${url}`);
195 handleDeepLink(mainWindow, url);
196 });
197});
198
199// Register App URL
200app.setAsDefaultProtocolClient('franz');
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 17ec832cf..557c9f7f2 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -116,6 +116,11 @@ export default class AppStore extends Store {
116 } 116 }
117 }); 117 });
118 118
119 // Handle deep linking (franz://)
120 ipcRenderer.on('navigateFromDeepLink', (event, data) => {
121 console.log(event, data);
122 });
123
119 // Check system idle time every minute 124 // Check system idle time every minute
120 setInterval(() => { 125 setInterval(() => {
121 this.idleTime = idleTimer.getIdleTime(); 126 this.idleTime = idleTimer.getIdleTime();