Skip to content

Commit

Permalink
fix: parse deeplink url at start (#7610)
Browse files Browse the repository at this point in the history
* fix: Parse deeplink url at start

* clean up

* fix

* simplify

* clean up

* 💀

---------

Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
  • Loading branch information
marc2332 and begonaalvarezd authored Nov 2, 2023
1 parent f5827ec commit 5361ef5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/desktop/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,12 @@ ipcMain.handle('get-machine-id', (_e) => getMachineId())
ipcMain.handle('update-app-settings', (_e, settings) => updateSettings(settings))
ipcMain.handle('update-theme', (_e, theme) => (nativeTheme.themeSource = theme))

const argWithAppProtocol = (arg) => arg.startsWith(`${process.env.APP_PROTOCOL}://`)

/**
* Define deep link state
*/
let deepLinkUrl = null
let deepLinkUrl = process.argv.find(argWithAppProtocol)

/**
* Create a single instance only
Expand All @@ -472,7 +474,7 @@ if (!isFirstInstance) {
app.on('second-instance', (_e, args) => {
if (windows.main) {
if (args.length > 1) {
const params = args.find((arg) => arg.startsWith(`${process.env.APP_PROTOCOL}://`))
const params = args.find(argWithAppProtocol)

if (params) {
windows.main.webContents.send('deep-link-params', params)
Expand Down

0 comments on commit 5361ef5

Please sign in to comment.