Skip to content

Commit 139f157

Browse files
committed
fix: default to true
1 parent bf4a107 commit 139f157

File tree

6 files changed

+158
-6
lines changed

6 files changed

+158
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
2424
</intent-filter>
2525
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
26-
<intent-filter >
26+
<intent-filter android:autoVerify="true" >
2727
<action android:name="android.intent.action.VIEW" />
2828
<category android:name="android.intent.category.DEFAULT" />
2929
<category android:name="android.intent.category.BROWSABLE" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.tauri.deep_link_example
2+
3+
import android.os.Bundle
4+
import androidx.activity.enableEdgeToEdge
5+
6+
class MainActivity : TauriActivity() {
7+
override fun onCreate(savedInstanceState: Bundle?) {
8+
enableEdgeToEdge()
9+
super.onCreate(savedInstanceState)
10+
}
11+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import java.io.File
2+
import org.apache.tools.ant.taskdefs.condition.Os
3+
import org.gradle.api.DefaultTask
4+
import org.gradle.api.GradleException
5+
import org.gradle.api.logging.LogLevel
6+
import org.gradle.api.tasks.Input
7+
import org.gradle.api.tasks.TaskAction
8+
9+
open class BuildTask : DefaultTask() {
10+
@Input
11+
var rootDirRel: String? = null
12+
@Input
13+
var target: String? = null
14+
@Input
15+
var release: Boolean? = null
16+
17+
@TaskAction
18+
fun assemble() {
19+
val executable = """pnpm""";
20+
try {
21+
runTauriCli(executable)
22+
} catch (e: Exception) {
23+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
24+
runTauriCli("$executable.cmd")
25+
} else {
26+
throw e;
27+
}
28+
}
29+
}
30+
31+
fun runTauriCli(executable: String) {
32+
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
33+
val target = target ?: throw GradleException("target cannot be null")
34+
val release = release ?: throw GradleException("release cannot be null")
35+
val args = listOf("tauri", "android", "android-studio-script");
36+
37+
project.exec {
38+
workingDir(File(project.projectDir, rootDirRel))
39+
executable(executable)
40+
args(args)
41+
if (project.logger.isEnabled(LogLevel.DEBUG)) {
42+
args("-vv")
43+
} else if (project.logger.isEnabled(LogLevel.INFO)) {
44+
args("-v")
45+
}
46+
if (release) {
47+
args("--release")
48+
}
49+
args(listOf("--target", target))
50+
}.assertNormalExitValue()
51+
}
52+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import com.android.build.api.dsl.ApplicationExtension
2+
import org.gradle.api.DefaultTask
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.kotlin.dsl.configure
6+
import org.gradle.kotlin.dsl.get
7+
8+
const val TASK_GROUP = "rust"
9+
10+
open class Config {
11+
lateinit var rootDirRel: String
12+
}
13+
14+
open class RustPlugin : Plugin<Project> {
15+
private lateinit var config: Config
16+
17+
override fun apply(project: Project) = with(project) {
18+
config = extensions.create("rust", Config::class.java)
19+
20+
val defaultAbiList = listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64");
21+
val abiList = (findProperty("abiList") as? String)?.split(',') ?: defaultAbiList
22+
23+
val defaultArchList = listOf("arm64", "arm", "x86", "x86_64");
24+
val archList = (findProperty("archList") as? String)?.split(',') ?: defaultArchList
25+
26+
val targetsList = (findProperty("targetList") as? String)?.split(',') ?: listOf("aarch64", "armv7", "i686", "x86_64")
27+
28+
extensions.configure<ApplicationExtension> {
29+
@Suppress("UnstableApiUsage")
30+
flavorDimensions.add("abi")
31+
productFlavors {
32+
create("universal") {
33+
dimension = "abi"
34+
ndk {
35+
abiFilters += abiList
36+
}
37+
}
38+
defaultArchList.forEachIndexed { index, arch ->
39+
create(arch) {
40+
dimension = "abi"
41+
ndk {
42+
abiFilters.add(defaultAbiList[index])
43+
}
44+
}
45+
}
46+
}
47+
}
48+
49+
afterEvaluate {
50+
for (profile in listOf("debug", "release")) {
51+
val profileCapitalized = profile.replaceFirstChar { it.uppercase() }
52+
val buildTask = tasks.maybeCreate(
53+
"rustBuildUniversal$profileCapitalized",
54+
DefaultTask::class.java
55+
).apply {
56+
group = TASK_GROUP
57+
description = "Build dynamic library in $profile mode for all targets"
58+
}
59+
60+
tasks["mergeUniversal${profileCapitalized}JniLibFolders"].dependsOn(buildTask)
61+
62+
for (targetPair in targetsList.withIndex()) {
63+
val targetName = targetPair.value
64+
val targetArch = archList[targetPair.index]
65+
val targetArchCapitalized = targetArch.replaceFirstChar { it.uppercase() }
66+
val targetBuildTask = project.tasks.maybeCreate(
67+
"rustBuild$targetArchCapitalized$profileCapitalized",
68+
BuildTask::class.java
69+
).apply {
70+
group = TASK_GROUP
71+
description = "Build dynamic library in $profile mode for $targetArch"
72+
rootDirRel = config.rootDirRel
73+
target = targetName
74+
release = profile == "release"
75+
}
76+
77+
buildTask.dependsOn(targetBuildTask)
78+
tasks["merge$targetArchCapitalized${profileCapitalized}JniLibFolders"].dependsOn(
79+
targetBuildTask
80+
)
81+
}
82+
}
83+
}
84+
}
85+
}

plugins/deep-link/examples/app/src-tauri/tauri.conf.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
"pathPrefix": ["/intent"]
3535
},
3636
{
37-
"host": "tauri.app",
38-
"appLink": true
37+
"host": "tauri.app"
3938
},
4039
{
41-
"scheme": ["taurideeplink"]
40+
"scheme": ["taurideeplink"],
41+
"appLink": false
4242
}
4343
],
4444
"desktop": {

plugins/deep-link/src/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
use serde::{Deserialize, Deserializer};
88
use tauri_utils::config::DeepLinkProtocol;
99

10+
fn default_true() -> bool {
11+
true
12+
}
13+
1014
#[derive(Deserialize, Clone)]
1115
pub struct AssociatedDomain {
1216
#[serde(default = "default_schemes")]
@@ -19,9 +23,9 @@ pub struct AssociatedDomain {
1923
pub path_pattern: Vec<String>,
2024
#[serde(default, alias = "path-prefix", rename = "pathPrefix")]
2125
pub path_prefix: Vec<String>,
22-
#[serde(default, alias = "path-suffix", rename = "pathSuffix")]
26+
#[serde(default, alias = "pa₹th-suffix", rename = "pathSuffix")]
2327
pub path_suffix: Vec<String>,
24-
#[serde(default, alias = "app-link", rename = "appLink")]
28+
#[serde(default="default_true", alias = "app-link", rename = "appLink")]
2529
pub app_link: bool,
2630
}
2731

0 commit comments

Comments
 (0)