feat(deep-link): Add deep link support for desktop (#916)

This commit is contained in:
Fabian-Lars
2024-05-09 18:58:15 +02:00
committed by Lucas Nogueira
parent eb1679b997
commit 021d23bef3
21 changed files with 614 additions and 29 deletions
+9 -4
View File
@@ -93,16 +93,19 @@ See [supporting associated domains](https://developer.apple.com/documentation/xc
## Configuration
Under `tauri.conf.json > plugins > deep-link`, configure the domains you want to associate with your application:
Under `tauri.conf.json > plugins > deep-link`, configure the domains (mobile) and schemes (desktop) you want to associate with your application:
```json
{
"plugins": {
"deep-link": {
"domains": [
"mobile": [
{ "host": "your.website.com", "pathPrefix": ["/open"] },
{ "host": "another.site.br" }
]
],
"desktop": {
"schemes": ["something", "my-tauri-app"]
}
}
}
}
@@ -128,10 +131,12 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind
```javascript
import { onOpenUrl } from "@tauri-apps/plugin-deep-link";
await onOpenUrl((urls) => {
console.log('deep link:', urls);
console.log("deep link:", urls);
});
```
Note that the Plugin will only emit events on macOS, iOS and Android. On Windows and Linux the OS will spawn a new instance of your app with the URL as a CLI argument. If you want your app to behave on Windows & Linux similar to the other platforms you can use the [single-instance](../single-instance/) plugin.
## Contributing
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.