diff options
author | Stefan <stefan@adlk.io> | 2019-02-12 11:27:25 +0100 |
---|---|---|
committer | Stefan <stefan@adlk.io> | 2019-02-12 11:27:25 +0100 |
commit | afb6a91741c4c5ce9ef1e52266223faa35469d8b (patch) | |
tree | 4bfac28105b1340e17256242c1d6948cc546ac59 /src | |
parent | Merge branch 'master' into develop (diff) | |
download | ferdium-app-afb6a91741c4c5ce9ef1e52266223faa35469d8b.tar.gz ferdium-app-afb6a91741c4c5ce9ef1e52266223faa35469d8b.tar.zst ferdium-app-afb6a91741c4c5ce9ef1e52266223faa35469d8b.zip |
Fix windows token login
Diffstat (limited to 'src')
-rw-r--r-- | src/index.js | 41 | ||||
-rw-r--r-- | src/stores/AppStore.js | 6 | ||||
-rw-r--r-- | src/stores/UserStore.js | 2 |
3 files changed, 31 insertions, 18 deletions
diff --git a/src/index.js b/src/index.js index 494fa97f1..a2b4acb00 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -74,21 +74,22 @@ if (!gotTheLock) { | |||
74 | mainWindow.focus(); | 74 | mainWindow.focus(); |
75 | 75 | ||
76 | if (isWindows) { | 76 | if (isWindows) { |
77 | // Keep only command line / deep linked arguments | 77 | onDidLoad((window) => { |
78 | const url = argv.slice(1); | 78 | // Keep only command line / deep linked arguments |
79 | 79 | const url = argv.slice(1); | |
80 | if (url) { | 80 | if (url) { |
81 | handleDeepLink(mainWindow, url.toString()); | 81 | handleDeepLink(window, url.toString()); |
82 | } | 82 | } |
83 | } | 83 | |
84 | 84 | if (argv.includes('--reset-window')) { | |
85 | if (argv.includes('--reset-window')) { | 85 | // Needs to be delayed to not interfere with mainWindow.restore(); |
86 | // Needs to be delayed to not interfere with mainWindow.restore(); | 86 | setTimeout(() => { |
87 | setTimeout(() => { | 87 | debug('Resetting windows via Task'); |
88 | debug('Resetting windows via Task'); | 88 | window.setPosition(DEFAULT_WINDOW_OPTIONS.x + 100, DEFAULT_WINDOW_OPTIONS.y + 100); |
89 | mainWindow.setPosition(DEFAULT_WINDOW_OPTIONS.x + 100, DEFAULT_WINDOW_OPTIONS.y + 100); | 89 | window.setSize(DEFAULT_WINDOW_OPTIONS.width, DEFAULT_WINDOW_OPTIONS.height); |
90 | mainWindow.setSize(DEFAULT_WINDOW_OPTIONS.width, DEFAULT_WINDOW_OPTIONS.height); | 90 | }, 1); |
91 | }, 1); | 91 | } |
92 | }); | ||
92 | } | 93 | } |
93 | } | 94 | } |
94 | }); | 95 | }); |
@@ -174,6 +175,16 @@ const createWindow = () => { | |||
174 | mainWindow.webContents.openDevTools(); | 175 | mainWindow.webContents.openDevTools(); |
175 | } | 176 | } |
176 | 177 | ||
178 | // Windows deep linking handling on app launch | ||
179 | if (isWindows) { | ||
180 | onDidLoad((window) => { | ||
181 | const url = process.argv.slice(1); | ||
182 | if (url) { | ||
183 | handleDeepLink(window, url.toString()); | ||
184 | } | ||
185 | }); | ||
186 | } | ||
187 | |||
177 | // Emitted when the window is closed. | 188 | // Emitted when the window is closed. |
178 | mainWindow.on('close', (e) => { | 189 | mainWindow.on('close', (e) => { |
179 | // Dereference the window object, usually you would store windows | 190 | // Dereference the window object, usually you would store windows |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index f8030a9ac..b21d48a11 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -144,10 +144,12 @@ export default class AppStore extends Store { | |||
144 | // Handle deep linking (franz://) | 144 | // Handle deep linking (franz://) |
145 | ipcRenderer.on('navigateFromDeepLink', (event, data) => { | 145 | ipcRenderer.on('navigateFromDeepLink', (event, data) => { |
146 | debug('Navigate from deep link', data); | 146 | debug('Navigate from deep link', data); |
147 | const { url } = data; | 147 | let { url } = data; |
148 | if (!url) return; | 148 | if (!url) return; |
149 | 149 | ||
150 | this.stores.router.push(data.url); | 150 | url = url.replace(/\/$/, ''); |
151 | |||
152 | this.stores.router.push(url); | ||
151 | }); | 153 | }); |
152 | 154 | ||
153 | // Set active the next service | 155 | // Set active the next service |
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index ad714a62d..77d84afe1 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -278,7 +278,7 @@ export default class UserStore extends Store { | |||
278 | // Give this some time to sink | 278 | // Give this some time to sink |
279 | setTimeout(() => { | 279 | setTimeout(() => { |
280 | this._tokenLogin(token); | 280 | this._tokenLogin(token); |
281 | }, 100); | 281 | }, 1000); |
282 | } | 282 | } |
283 | } else if (!this.isLoggedIn | 283 | } else if (!this.isLoggedIn |
284 | && !currentRoute.includes(this.BASE_ROUTE)) { | 284 | && !currentRoute.includes(this.BASE_ROUTE)) { |