Skip to content
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

chore(deep-link): fix example, update documentation #1725

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"applinks": {
"details": [
{
"appIDs": [
"Q93MBH6S2F.com.tauri.deep-link-example"
],
"components": [
{
"/": "/open/*",
"comment": "Matches any URL whose path starts with /open/"
}
]
}
]
}
}
23 changes: 23 additions & 0 deletions plugins/deep-link/.test-server/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import http from "http";
import fs from "fs";

const hostname = "localhost";
const port = 8080;

const server = http.createServer(function (req, res) {
console.log(req.url);
if (req.url == "/.well-known/apple-app-site-association") {
const association = fs.readFileSync(
".well-known/apple-app-site-association"
);
res.writeHead(200, { "Content-Type": "application/json" });
res.end(association);
} else {
res.writeHead(404);
res.end("404 NOT FOUND");
}
});

server.listen(port, hostname, () => {
console.log("Server started on port", port);
});
14 changes: 12 additions & 2 deletions plugins/deep-link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ For [app links](https://developer.android.com/training/app-links#android-app-lin
]
```

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.
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.

### iOS

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

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.
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.

To verify if your domain has been properly configured to expose the app associations, you can run the following command:

```sh
curl -v https://app-site-association.cdn-apple.com/a/v1/<host>
```

**The apple-app-site-association file must be served over HTTPS and the response must include the `Content-Type: application/json` header.**

To quickly open an app link on the iOS simulator you can execute `xcrun simctl openurl booted <url>`.

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

Expand Down
2 changes: 2 additions & 0 deletions plugins/deep-link/examples/app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ serde = { workspace = true }
serde_json = { workspace = true }
tauri = { workspace = true, features = ["wry", "compression"] }
tauri-plugin-deep-link = { path = "../../../" }
tauri-plugin-log = { path = "../../../../log" }
log = "0.4"

[features]
# this feature is used for production builds or when `devUrl` points to the filesystem and the built-in dev server is disabled.
Expand Down
13 changes: 13 additions & 0 deletions plugins/deep-link/examples/app/src-tauri/capabilities/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "run-app-base",
"description": "Base permissions to run the app",
"windows": [
"main"
],
"permissions": [
"core:default",
"deep-link:allow-get-current",
"deep-link:default"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/src/main/jniLibs/**/*.so
/src/main/assets/tauri.conf.json
/tauri.build.gradle.kts
/proguard-tauri.pro
/proguard-tauri.pro
/tauri.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import java.util.Properties

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("rust")
}

val tauriProperties = Properties().apply {
val propFile = file("tauri.properties")
if (propFile.exists()) {
propFile.inputStream().use { load(it) }
}
}

android {
compileSdk = 34
namespace = "com.tauri.deep_link_example"
defaultConfig {
manifestPlaceholders["usesCleartextTraffic"] = "false"
applicationId = "com.tauri.deep_link_example"
minSdk = 24
versionCode = 1
versionName = "1.0"
minSdk = 24
targetSdk = 34
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
}
buildTypes {
getByName("debug") {
Expand All @@ -38,6 +48,9 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
buildConfig = true
}
}

rust {
Expand All @@ -53,4 +66,4 @@ dependencies {
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
}

apply(from = "tauri.build.gradle.kts")
apply(from = "tauri.build.gradle.kts")
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />

<!-- AndroidTV support -->
<uses-feature android:name="android.software.leanback" android:required="false" />

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand All @@ -15,6 +19,8 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- AndroidTV support -->
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
<intent-filter android:autoVerify="true">
Expand All @@ -35,6 +41,15 @@
<data android:host="tauri.app" />

</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="91f4-177-23-156-161.ngrok-free.app" />
<data android:pathPrefix="/open" />
</intent-filter>
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
</activity>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.3.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
classpath("com.android.tools.build:gradle:8.5.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ repositories {

dependencies {
compileOnly(gradleApi())
implementation("com.android.tools.build:gradle:8.3.2")
implementation("com.android.tools.build:gradle:8.5.1")
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

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

import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue May 10 19:22:52 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading
Loading