diff options
author | André Oliveira <oliveira.andrerodrigues95@gmail.com> | 2022-07-28 10:11:04 +0100 |
---|---|---|
committer | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-07-29 07:41:26 +0530 |
commit | 36822a25fa1f978c4dc06743600cc51bf774d4ea (patch) | |
tree | a76c7cc42177956f402d216e17e2bc7a9e6b6fe5 /src | |
parent | fix: maximize window after tray clicking (diff) | |
download | ferdium-app-36822a25fa1f978c4dc06743600cc51bf774d4ea.tar.gz ferdium-app-36822a25fa1f978c4dc06743600cc51bf774d4ea.tar.zst ferdium-app-36822a25fa1f978c4dc06743600cc51bf774d4ea.zip |
fix: handleDeepLink generalization
Diffstat (limited to 'src')
-rw-r--r-- | src/electron/deepLinking.ts | 11 | ||||
-rw-r--r-- | src/index.ts | 13 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/electron/deepLinking.ts b/src/electron/deepLinking.ts index 36de1b143..104aa2d83 100644 --- a/src/electron/deepLinking.ts +++ b/src/electron/deepLinking.ts | |||
@@ -4,9 +4,18 @@ export default function handleDeepLink( | |||
4 | window: BrowserWindow, | 4 | window: BrowserWindow, |
5 | rawUrl: string, | 5 | rawUrl: string, |
6 | ): void { | 6 | ): void { |
7 | if (!rawUrl) { | ||
8 | return; | ||
9 | } | ||
10 | |||
7 | const url = rawUrl.replace('ferdium://', ''); | 11 | const url = rawUrl.replace('ferdium://', ''); |
8 | 12 | ||
9 | if (!url) return; | 13 | // The next line is a workaround after this 71c5237 [chore: Mobx & React-Router upgrade (#406)]. |
14 | // For some reason, the app won't start until because it's trying to route to './build'. | ||
15 | // TODO: Check what is wrong with DeepLinking - it is broken for some reason. This is causing several troubles. | ||
16 | const workaroundDeepLink = ['./build', '--allow-file-access-from-files']; | ||
17 | |||
18 | if (!url || workaroundDeepLink.includes(url)) return; | ||
10 | 19 | ||
11 | window.webContents.send('navigateFromDeepLink', { url }); | 20 | window.webContents.send('navigateFromDeepLink', { url }); |
12 | } | 21 | } |
diff --git a/src/index.ts b/src/index.ts index 9a1163067..05e222a25 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -119,9 +119,7 @@ if (!gotTheLock) { | |||
119 | onDidLoad((window: BrowserWindow) => { | 119 | onDidLoad((window: BrowserWindow) => { |
120 | // Keep only command line / deep linked arguments | 120 | // Keep only command line / deep linked arguments |
121 | const url = argv.slice(1); | 121 | const url = argv.slice(1); |
122 | if (url) { | 122 | handleDeepLink(window, url.toString()); |
123 | handleDeepLink(window, url.toString()); | ||
124 | } | ||
125 | 123 | ||
126 | if (argv.includes('--reset-window')) { | 124 | if (argv.includes('--reset-window')) { |
127 | // Needs to be delayed to not interfere with mainWindow.restore(); | 125 | // Needs to be delayed to not interfere with mainWindow.restore(); |
@@ -270,14 +268,7 @@ const createWindow = () => { | |||
270 | if (isWindows) { | 268 | if (isWindows) { |
271 | onDidLoad((window: BrowserWindow) => { | 269 | onDidLoad((window: BrowserWindow) => { |
272 | const url = process.argv.slice(1); | 270 | const url = process.argv.slice(1); |
273 | if ( | 271 | handleDeepLink(window, url.toString()); |
274 | url && | ||
275 | // The next line is a workaround after this 71c5237 [chore: Mobx & React-Router upgrade (#406)]. | ||
276 | // For some reason, the app won't start until because it's trying to route to './build'. | ||
277 | url.toString() !== './build' | ||
278 | ) { | ||
279 | handleDeepLink(window, url.toString()); | ||
280 | } | ||
281 | }); | 272 | }); |
282 | } | 273 | } |
283 | 274 | ||