-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for how to use deep linking with Electron #36
Comments
In your const myCapacitorApp = createCapacitorElectronApp({
deepLinking: {
useDeeplinking: true,
}
}); Thats all the setup, after you just use the plugin as normal. Do note that you must at least package or build and run the electron app before it will work properly. This way of doing config for the platform will be changed with Capacitor 3+ with the introduction of plugins using the config file ( |
Are their any side effects of using that value in the configuration for mobile and web parts of Capacitor? https://capacitorjs.com/docs/basics/configuring-your-app Will that issue you referenced result in not having to modify the index.ts file in the future? |
Not that I am aware of but it would probably better to have the config live with the other config in the In the future I am thinking of having an |
Addressed in #37 |
It also looks like when applying the original configuration suggested above the Electron app doesn't start. |
Yes however you shouldnt use something like |
@IT-MikeS -- With the latest version of
Modified the
The What am I doing wrong? |
Did you build the electron app then run the built app atleast once? Deeplinking with electron doesnt work if you just run in dev mode ie: I just ran through it here using the URL: |
@IT-MikeS -- I tried running Would you be willing to publish your sample so I can take a look? Also it may be worth noting that the project I'm working with is a React-based Ionic project. |
Here is what I did with an ionic react app. https://github.com/IT-MikeS/test-cap-electron-deeplinking Do note I tested on my windows machine. I can test on my mac later but I'm not near it at the moment |
It seems that it is broken on Mac. If you remove the My suspicion is that the |
I will run some tests tomorrow on my mac and see what i can do, thank your for investigating👍 |
@IT-MikeS -- Thank you. I'd be more than happy to submit a PR to remove that wrapping |
You're welcome to, I just want to make sure that it doesn't break deeplinks on windows or Linux |
That's fair. Let me know! |
This is the new pattern for using deeplinking within electron. import { app } from "electron";
import { createCapacitorElectronApp, createCapacitorElectronDeepinking } from "@capacitor-community/electron-core";
// The MainWindow object can be accessed via myCapacitorApp.getMainWindow()
const myCapacitorApp = createCapacitorElectronApp();
createCapacitorElectronDeepinking(myCapacitorApp, {
customProtocol: 'proto'
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some Electron APIs can only be used after this event occurs.
app.on("ready", () => {
myCapacitorApp.init();
});
// Quit when all windows are closed.
app.on("window-all-closed", function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("activate", function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if(myCapacitorApp.getMainWindow().isDestroyed())
myCapacitorApp.init();
});
// Define any IPC or other custom functionality below here |
@IT-MikeS -- Thank you! When can I expect a version with these changes to be available? |
I will release a new version to npm today |
Sorry for the delay, but I have just push a new version to npm |
Made a quick documentation of the new deeplinking on the docs site. https://capacitor-community-electron-docs-site.vercel.app/usage/deeplinking/ |
Is your feature request related to a problem? Please describe.
Please publish documentation on how to use deep linking with Electron. My expectation is that I'd be able to provide the custom protocol to Electron which would subsequently be registered in a fashion like:
app.setAsDefaultProtocolClient('com.domain.for.my.app')
.Describe the solution you'd like
I'd like to understand how to use deep linking with Electron. My expectation is that I can use the
addListener('appUrlOpen'
model like we can on iOS and AndroidThe text was updated successfully, but these errors were encountered: