capacitor-community / capacitor-community/electron

Deep linking and appUrlOpen

Open
#103 10 comments 0 reactions 0 assignees View on GitHub
plugin update needed
Dominant language
TypeScript
Stars
398
Forks
63
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Hi @IT-MikeS, first of i want to thank you for all the work you are doing and for your reply in my other issue, I did not get the opportunity to thank you before the issue was closed 😄

The issue this time around has to do with Deep linking again and how it works in v3 (3.0.0-rc6) of the project. Currently I get zero deep-link url:s through to the Capacitor plugin App addUrlListener. In capacitor v2 and @capacitor-community/electron v1.4.x i could (when using electron <12) see the `App.addListener('appUrlListener',data => {})` being triggered. This changed when upgrading Capacitor and @capacitor-community/electron to v3 versions.

So far I can think of two possible issues and I would be very grateful for any answer which could help me understand what is wrong
1. Since electron 12 they changed the contextIsolation to be true by default which seems to cause some issue with plugins (#74), I still don't know if this is causing the same kind of issues for the App plugging of Capacitor. If I try turn off contextIsolation in the options like this
```javscript
mainWindow: {
windowOptions: {
webPreferences: { contextIsolation: false }
}
}
```
i still get nothing through to the appUrlListener. Will deep-links not work with @capacitor-community/electron v3.x?
2. Capacitor V3 App plugin and its appUrlListener are not compatible with @capacitor-community/electron v3.0.0-x deep-linking. Are there any solutions to this?

**To Reproduce**
Steps to reproduce the behavior:

I've created a small repo which only contains a CRA and some react router stuff to run a small application which listens for deep links.

1. Clone the repo git@github.com:vilasp/capacitor.git
2. Run `npm run build`
3. Run `npx cap sync @capacitor-community/electron`
4. Run `cd electron`
5. Run `npm run electron:build-windows`
6. Install the MSI and open the application
7. Open the devtools of the electron application
8. Open the link `electronboogie://signin-oidc` in chrome
9. Verify in devtools that no console message about the url from [8] is logged

**Expected behavior**
When the link `electronboogie://signin-oidc` is entered from Chrome the application should gain focus and the appUrlListener which is registered should fire

**Screenshots**
No need i think

**Desktop (please complete the following information):**

- OS: Win 10 (20H2)
- Browser, Chromium
- Version: Chromium version of the Electron version used by the electron-builder dependency

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.