Skip to content

Commit 72c2ce8

Browse files
authored
chore(deep-link): fix example, update documentation (#1725)
* chore(deep-link): fix example, update documentation * update lock file * fix lint, add header * fmt
1 parent 4654591 commit 72c2ce8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+323
-150
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default tseslint.config(
2121
"**/init.js",
2222
"**/rollup.config.js",
2323
"**/bindings.ts",
24+
"**/.test-server",
2425
".scripts",
2526
"eslint.config.js",
2627
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"applinks": {
3+
"details": [
4+
{
5+
"appIDs": [
6+
"Q93MBH6S2F.com.tauri.deep-link-example"
7+
],
8+
"components": [
9+
{
10+
"/": "/open/*",
11+
"comment": "Matches any URL whose path starts with /open/"
12+
}
13+
]
14+
}
15+
]
16+
}
17+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2+
// SPDX-License-Identifier: Apache-2.0
3+
// SPDX-License-Identifier: MIT
4+
5+
import http from "http";
6+
import fs from "fs";
7+
8+
const hostname = "localhost";
9+
const port = 8080;
10+
11+
const server = http.createServer(function (req, res) {
12+
console.log(req.url);
13+
if (req.url == "/.well-known/apple-app-site-association") {
14+
const association = fs.readFileSync(
15+
".well-known/apple-app-site-association",
16+
);
17+
res.writeHead(200, { "Content-Type": "application/json" });
18+
res.end(association);
19+
} else {
20+
res.writeHead(404);
21+
res.end("404 NOT FOUND");
22+
}
23+
});
24+
25+
server.listen(port, hostname, () => {
26+
console.log("Server started on port", port);
27+
});

plugins/deep-link/README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ For [app links](https://developer.android.com/training/app-links#android-app-lin
6363
]
6464
```
6565

66-
Where `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > tauri > bundle > identifier` with `-` replaced with `_` and `$CERT_FINGERPRINT` is a list of SHA256 fingerprints of your app's signing certificates, see [verify android applinks](https://developer.android.com/training/app-links/verify-android-applinks#web-assoc) for more information.
66+
Where `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > identifier` with `-` replaced with `_` and `$CERT_FINGERPRINT` is a list of SHA256 fingerprints of your app's signing certificates, see [verify android applinks](https://developer.android.com/training/app-links/verify-android-applinks#web-assoc) for more information.
6767

6868
### iOS
6969

@@ -87,7 +87,17 @@ For [universal links](https://developer.apple.com/documentation/xcode/allowing-a
8787
}
8888
```
8989

90-
Where `$DEVELOPMENT_TEAM_ID` is the value defined on `tauri.conf.json > tauri > bundle > iOS > developmentTeam` or the `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable and `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > tauri > bundle > identifier`. See [applinks.details](https://developer.apple.com/documentation/bundleresources/applinks/details) for more information.
90+
Where `$DEVELOPMENT_TEAM_ID` is the value defined on `tauri.conf.json > bundle > iOS > developmentTeam` or the `APPLE_DEVELOPMENT_TEAM` environment variable and `$APP_BUNDLE_ID` is the value defined on `tauri.conf.json > identifier`. See [applinks.details](https://developer.apple.com/documentation/bundleresources/applinks/details) for more information.
91+
92+
To verify if your domain has been properly configured to expose the app associations, you can run the following command:
93+
94+
```sh
95+
curl -v https://app-site-association.cdn-apple.com/a/v1/<host>
96+
```
97+
98+
**The apple-app-site-association file must be served over HTTPS and the response must include the `Content-Type: application/json` header.**
99+
100+
To quickly open an app link on the iOS simulator you can execute `xcrun simctl openurl booted <url>`.
91101

92102
See [supporting associated domains](https://developer.apple.com/documentation/xcode/supporting-associated-domains?language=objc) for more information.
93103

plugins/deep-link/examples/app/src-tauri/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ serde = { workspace = true }
2121
serde_json = { workspace = true }
2222
tauri = { workspace = true, features = ["wry", "compression"] }
2323
tauri-plugin-deep-link = { path = "../../../" }
24+
tauri-plugin-log = { path = "../../../../log" }
25+
log = "0.4"
2426

2527
[features]
2628
# this feature is used for production builds or when `devUrl` points to the filesystem and the built-in dev server is disabled.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "../gen/schemas/desktop-schema.json",
3+
"identifier": "run-app-base",
4+
"description": "Base permissions to run the app",
5+
"windows": ["main"],
6+
"permissions": [
7+
"core:default",
8+
"deep-link:allow-get-current",
9+
"deep-link:default"
10+
]
11+
}

plugins/deep-link/examples/app/src-tauri/gen/android/app/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/src/main/jniLibs/**/*.so
33
/src/main/assets/tauri.conf.json
44
/tauri.build.gradle.kts
5-
/proguard-tauri.pro
5+
/proguard-tauri.pro
6+
/tauri.properties

plugins/deep-link/examples/app/src-tauri/gen/android/app/build.gradle.kts

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1+
import java.util.Properties
2+
13
plugins {
24
id("com.android.application")
35
id("org.jetbrains.kotlin.android")
46
id("rust")
57
}
68

9+
val tauriProperties = Properties().apply {
10+
val propFile = file("tauri.properties")
11+
if (propFile.exists()) {
12+
propFile.inputStream().use { load(it) }
13+
}
14+
}
15+
716
android {
817
compileSdk = 34
918
namespace = "com.tauri.deep_link_example"
1019
defaultConfig {
1120
manifestPlaceholders["usesCleartextTraffic"] = "false"
1221
applicationId = "com.tauri.deep_link_example"
13-
minSdk = 24
14-
versionCode = 1
15-
versionName = "1.0"
22+
minSdk = 24
23+
targetSdk = 34
24+
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
25+
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
1626
}
1727
buildTypes {
1828
getByName("debug") {
@@ -38,6 +48,9 @@ android {
3848
kotlinOptions {
3949
jvmTarget = "1.8"
4050
}
51+
buildFeatures {
52+
buildConfig = true
53+
}
4154
}
4255

4356
rust {
@@ -53,4 +66,4 @@ dependencies {
5366
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
5467
}
5568

56-
apply(from = "tauri.build.gradle.kts")
69+
apply(from = "tauri.build.gradle.kts")

plugins/deep-link/examples/app/src-tauri/gen/android/app/src/main/AndroidManifest.xml

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33
<uses-permission android:name="android.permission.INTERNET" />
4+
5+
<!-- AndroidTV support -->
6+
<uses-feature android:name="android.software.leanback" android:required="false" />
7+
48
<application
59
android:icon="@mipmap/ic_launcher"
610
android:label="@string/app_name"
@@ -15,6 +19,8 @@
1519
<intent-filter>
1620
<action android:name="android.intent.action.MAIN" />
1721
<category android:name="android.intent.category.LAUNCHER" />
22+
<!-- AndroidTV support -->
23+
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
1824
</intent-filter>
1925
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
2026
<intent-filter android:autoVerify="true">
@@ -35,6 +41,15 @@
3541
<data android:host="tauri.app" />
3642

3743
</intent-filter>
44+
<intent-filter android:autoVerify="true">
45+
<action android:name="android.intent.action.VIEW" />
46+
<category android:name="android.intent.category.DEFAULT" />
47+
<category android:name="android.intent.category.BROWSABLE" />
48+
<data android:scheme="http" />
49+
<data android:scheme="https" />
50+
<data android:host="91f4-177-23-156-161.ngrok-free.app" />
51+
<data android:pathPrefix="/open" />
52+
</intent-filter>
3853
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
3954
</activity>
4055

plugins/deep-link/examples/app/src-tauri/gen/android/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath("com.android.tools.build:gradle:8.3.2")
8-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
7+
classpath("com.android.tools.build:gradle:8.5.1")
8+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
99
}
1010
}
1111

plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ repositories {
1818

1919
dependencies {
2020
compileOnly(gradleApi())
21-
implementation("com.android.tools.build:gradle:8.3.2")
21+
implementation("com.android.tools.build:gradle:8.5.1")
2222
}
2323

plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/BuildTask.kt

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2-
// SPDX-License-Identifier: Apache-2.0
3-
// SPDX-License-Identifier: MIT
4-
51
import java.io.File
62
import org.apache.tools.ant.taskdefs.condition.Os
73
import org.gradle.api.DefaultTask

plugins/deep-link/examples/app/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/deep_link_example/kotlin/RustPlugin.kt

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2-
// SPDX-License-Identifier: Apache-2.0
3-
// SPDX-License-Identifier: MIT
4-
51
import com.android.build.api.dsl.ApplicationExtension
62
import org.gradle.api.DefaultTask
73
import org.gradle.api.Plugin

plugins/deep-link/examples/app/src-tauri/gen/android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ kotlin.code.style=official
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
2323
android.nonTransitiveRClass=true
24-
android.defaults.buildfeatures.buildconfig=true
2524
android.nonFinalResIds=false
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Tue May 10 19:22:52 CST 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)