mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-24 11:01:20 -08:00
Compare commits
3
Commits
v21.1.0
...
tauri-android
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9be83cf108 | ||
|
|
d7436e3972 | ||
|
|
bebc34d035 |
No files matched your search
@@ -36,6 +36,8 @@ build/
|
|||||||
|
|
||||||
# Rust build artifacts
|
# Rust build artifacts
|
||||||
/target
|
/target
|
||||||
|
/.tauri
|
||||||
|
/tauri.settings.gradle
|
||||||
|
|
||||||
# direnv has been claimed for Nix usage
|
# direnv has been claimed for Nix usage
|
||||||
.direnv/
|
.direnv/
|
||||||
@@ -43,6 +45,8 @@ build/
|
|||||||
|
|
||||||
# Ignore Android local properties
|
# Ignore Android local properties
|
||||||
local.properties
|
local.properties
|
||||||
|
keystore.properties
|
||||||
|
/.android
|
||||||
|
|
||||||
# Ignore temporary config
|
# Ignore temporary config
|
||||||
vrconfig.yml.tmp
|
vrconfig.yml.tmp
|
||||||
Generated
-1
@@ -4081,7 +4081,6 @@ name = "slimevr"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cfg_aliases",
|
|
||||||
"clap",
|
"clap",
|
||||||
"clap-verbosity-flag",
|
"clap-verbosity-flag",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
|
|||||||
@@ -1,3 +1,21 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("org.ajoberstar.grgit")
|
id("org.ajoberstar.grgit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("com.android.tools.build:gradle:8.6.1")
|
||||||
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.properties["kotlinVersion"]}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subprojects.filter { it.name.contains("tauri") }.forEach {
|
||||||
|
it.repositories {
|
||||||
|
mavenCentral()
|
||||||
|
google()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePlugin {
|
||||||
|
plugins {
|
||||||
|
create("pluginsForCoolKids") {
|
||||||
|
id = "rust"
|
||||||
|
implementationClass = "RustPlugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly(gradleApi())
|
||||||
|
implementation("com.android.tools.build:gradle:8.6.1")
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import java.io.File
|
||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.GradleException
|
||||||
|
import org.gradle.api.logging.LogLevel
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
|
||||||
|
open class BuildTask : DefaultTask() {
|
||||||
|
@Input
|
||||||
|
var rootDirRel: String? = null
|
||||||
|
@Input
|
||||||
|
var target: String? = null
|
||||||
|
@Input
|
||||||
|
var release: Boolean? = null
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun assemble() {
|
||||||
|
val executable = """pnpm""";
|
||||||
|
try {
|
||||||
|
runTauriCli(executable)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
runTauriCli("$executable.cmd")
|
||||||
|
} else if (Os.isFamily(Os.FAMILY_UNIX)){
|
||||||
|
runTauriCli("/nix/store/r2n3dbbp0djly6wjxx43sbffaq3abjpy-pnpm-10.15.0/bin/pnpm")
|
||||||
|
} else {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun runTauriCli(executable: String) {
|
||||||
|
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
|
||||||
|
val target = target ?: throw GradleException("target cannot be null")
|
||||||
|
val release = release ?: throw GradleException("release cannot be null")
|
||||||
|
val args = listOf("tauri", "android", "android-studio-script")
|
||||||
|
|
||||||
|
project.exec {
|
||||||
|
workingDir(File(project.projectDir, rootDirRel))
|
||||||
|
executable(executable)
|
||||||
|
args(args)
|
||||||
|
if (project.logger.isEnabled(LogLevel.DEBUG)) {
|
||||||
|
args("-vv")
|
||||||
|
} else if (project.logger.isEnabled(LogLevel.INFO)) {
|
||||||
|
args("-v")
|
||||||
|
}
|
||||||
|
if (release) {
|
||||||
|
args("--release")
|
||||||
|
}
|
||||||
|
args(listOf("--target", target))
|
||||||
|
}.assertNormalExitValue()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import com.android.build.api.dsl.ApplicationExtension
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.get
|
||||||
|
|
||||||
|
const val TASK_GROUP = "rust"
|
||||||
|
|
||||||
|
open class Config {
|
||||||
|
lateinit var rootDirRel: String
|
||||||
|
}
|
||||||
|
|
||||||
|
open class RustPlugin : Plugin<Project> {
|
||||||
|
private lateinit var config: Config
|
||||||
|
|
||||||
|
override fun apply(project: Project) = with(project) {
|
||||||
|
config = extensions.create("rust", Config::class.java)
|
||||||
|
|
||||||
|
val defaultAbiList = listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64");
|
||||||
|
val abiList = (findProperty("abiList") as? String)?.split(',') ?: defaultAbiList
|
||||||
|
|
||||||
|
val defaultArchList = listOf("arm64", "arm", "x86", "x86_64");
|
||||||
|
val archList = (findProperty("archList") as? String)?.split(',') ?: defaultArchList
|
||||||
|
|
||||||
|
val targetsList = (findProperty("targetList") as? String)?.split(',') ?: listOf("aarch64", "armv7", "i686", "x86_64")
|
||||||
|
|
||||||
|
extensions.configure<ApplicationExtension> {
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
|
flavorDimensions.add("abi")
|
||||||
|
productFlavors {
|
||||||
|
create("universal") {
|
||||||
|
dimension = "abi"
|
||||||
|
ndk {
|
||||||
|
abiFilters += abiList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defaultArchList.forEachIndexed { index, arch ->
|
||||||
|
create(arch) {
|
||||||
|
dimension = "abi"
|
||||||
|
ndk {
|
||||||
|
abiFilters.add(defaultAbiList[index])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
for (profile in listOf("debug", "release")) {
|
||||||
|
val profileCapitalized = profile.replaceFirstChar { it.uppercase() }
|
||||||
|
val buildTask = tasks.maybeCreate(
|
||||||
|
"rustBuildUniversal$profileCapitalized",
|
||||||
|
DefaultTask::class.java
|
||||||
|
).apply {
|
||||||
|
group = TASK_GROUP
|
||||||
|
description = "Build dynamic library in $profile mode for all targets"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks["mergeUniversal${profileCapitalized}JniLibFolders"].dependsOn(buildTask)
|
||||||
|
|
||||||
|
for (targetPair in targetsList.withIndex()) {
|
||||||
|
val targetName = targetPair.value
|
||||||
|
val targetArch = archList[targetPair.index]
|
||||||
|
val targetArchCapitalized = targetArch.replaceFirstChar { it.uppercase() }
|
||||||
|
val targetBuildTask = project.tasks.maybeCreate(
|
||||||
|
"rustBuild$targetArchCapitalized$profileCapitalized",
|
||||||
|
BuildTask::class.java
|
||||||
|
).apply {
|
||||||
|
group = TASK_GROUP
|
||||||
|
description = "Build dynamic library in $profile mode for $targetArch"
|
||||||
|
rootDirRel = config.rootDirRel
|
||||||
|
target = targetName
|
||||||
|
release = profile == "release"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTask.dependsOn(targetBuildTask)
|
||||||
|
tasks["merge$targetArchCapitalized${profileCapitalized}JniLibFolders"].dependsOn(
|
||||||
|
targetBuildTask
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,11 +57,36 @@
|
|||||||
_module.args.pkgs = import self.inputs.nixpkgs {
|
_module.args.pkgs = import self.inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [nixgl.overlay];
|
overlays = [nixgl.overlay];
|
||||||
|
# Allow android SDK
|
||||||
|
# config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||||
|
# "android-sdk-cmdline-tools"
|
||||||
|
# "android-sdk-platform-tools"
|
||||||
|
# "platform-tools"
|
||||||
|
# "android-sdk-tools"
|
||||||
|
# "android-sdk-emulator"
|
||||||
|
# "android-sdk-system-image-32-google_apis_playstore-arm64-v8a-system-image-32-google_apis_playstore-x86_64"
|
||||||
|
# "system-image-32-google_apis_playstore-arm64-v8a"
|
||||||
|
# "system-image-32-google_apis_playstore-x86_64"
|
||||||
|
# "android-sdk-system-image-34-google_apis_playstore-arm64-v8a-system-image-34-google_apis_playstore-x86_64"
|
||||||
|
# "system-image-34-google_apis_playstore-arm64-v8a"
|
||||||
|
# "system-image-34-google_apis_playstore-x86_64"
|
||||||
|
# "emulator"
|
||||||
|
# "tools"
|
||||||
|
# "android-sdk-build-tools"
|
||||||
|
# "build-tools"
|
||||||
|
# "android-sdk-platforms"
|
||||||
|
# "platforms"
|
||||||
|
# "cmake"
|
||||||
|
# "android-sdk-ndk"
|
||||||
|
# "ndk"
|
||||||
|
# "android-sdk-extras-google-gcm"
|
||||||
|
# "extras-google-gcm"
|
||||||
|
# "cmdline-tools"
|
||||||
|
# ];
|
||||||
};
|
};
|
||||||
|
|
||||||
devenv.shells.default = let
|
devenv.shells.default = let
|
||||||
fenixpkgs = inputs'.fenix.packages;
|
fenixpkgs = inputs'.fenix.packages;
|
||||||
rust_toolchain = lib.importTOML ./rust-toolchain.toml;
|
|
||||||
in {
|
in {
|
||||||
name = "slimevr";
|
name = "slimevr";
|
||||||
|
|
||||||
@@ -76,6 +101,7 @@
|
|||||||
(with pkgs; [
|
(with pkgs; [
|
||||||
pkgs.nixgl.nixGLIntel
|
pkgs.nixgl.nixGLIntel
|
||||||
cacert
|
cacert
|
||||||
|
stow
|
||||||
])
|
])
|
||||||
++ lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
++ lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
||||||
atk
|
atk
|
||||||
@@ -118,6 +144,12 @@
|
|||||||
};
|
};
|
||||||
languages.kotlin.enable = true;
|
languages.kotlin.enable = true;
|
||||||
|
|
||||||
|
# android = {
|
||||||
|
# enable = true;
|
||||||
|
# googleAPIs.enable = false;
|
||||||
|
# googleTVAddOns.enable = false;
|
||||||
|
# };
|
||||||
|
|
||||||
languages.javascript = {
|
languages.javascript = {
|
||||||
enable = true;
|
enable = true;
|
||||||
corepack.enable = true;
|
corepack.enable = true;
|
||||||
@@ -127,11 +159,10 @@
|
|||||||
|
|
||||||
languages.rust = {
|
languages.rust = {
|
||||||
enable = true;
|
enable = true;
|
||||||
toolchain = fenixpkgs.fromToolchainName {
|
toolchainPackage = fenixpkgs.fromToolchainFile {
|
||||||
name = rust_toolchain.toolchain.channel;
|
file = ./rust-toolchain.toml;
|
||||||
sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk=";
|
sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE=";
|
||||||
};
|
};
|
||||||
components = rust_toolchain.toolchain.components;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
|
|||||||
+13
-1
@@ -3,14 +3,26 @@ org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAME
|
|||||||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
|
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
|
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
|
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
|
||||||
|
-Dfile.encoding=UTF-8
|
||||||
|
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
# https://github.com/Kotlin/kotlinx-atomicfu#atomicfu-compiler-plugin
|
# https://github.com/Kotlin/kotlinx-atomicfu#atomicfu-compiler-plugin
|
||||||
kotlinx.atomicfu.enableJvmIrTransformation=true
|
kotlinx.atomicfu.enableJvmIrTransformation=true
|
||||||
|
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app"s APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# 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.nonTransitiveRClass=true
|
||||||
|
android.nonFinalResIds=false
|
||||||
org.gradle.unsafe.configuration-cache=false
|
org.gradle.unsafe.configuration-cache=false
|
||||||
|
|
||||||
kotlinVersion=2.0.20
|
kotlinVersion=2.0.20
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ default-run = "slimevr"
|
|||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
# The `_lib` suffix may seem redundant but it is necessary
|
||||||
|
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||||
|
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||||
|
name = "slimevr_lib"
|
||||||
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||||
@@ -22,7 +29,6 @@ custom-protocol = ["tauri/custom-protocol"]
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.0", features = [] }
|
tauri-build = { version = "2.0", features = [] }
|
||||||
cfg_aliases = "0.2"
|
|
||||||
shadow-rs = "0.35"
|
shadow-rs = "0.35"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -49,7 +55,6 @@ shadow-rs = { version = "0.35", default-features = false }
|
|||||||
const_format = "0.2.30"
|
const_format = "0.2.30"
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
color-eyre = "0.6"
|
color-eyre = "0.6"
|
||||||
rfd = { version = "0.15", features = ["gtk3"], default-features = false }
|
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
discord-sdk = "0.3.6"
|
discord-sdk = "0.3.6"
|
||||||
tokio = { version = "1.37.0", features = ["time"] }
|
tokio = { version = "1.37.0", features = ["time"] }
|
||||||
@@ -62,3 +67,6 @@ winreg = "0.52"
|
|||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
libloading = "0.8"
|
libloading = "0.8"
|
||||||
|
|
||||||
|
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||||
|
rfd = { version = "0.15", features = ["gtk3"], default-features = false }
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
use cfg_aliases::cfg_aliases;
|
|
||||||
|
|
||||||
fn main() -> shadow_rs::SdResult<()> {
|
fn main() -> shadow_rs::SdResult<()> {
|
||||||
// Bypass for Nix script having libudev-zero and Tauri not liking it
|
// Bypass for Nix script having libudev-zero and Tauri not liking it
|
||||||
if let Some(path) = option_env!("SLIMEVR_RUST_LD_LIBRARY_PATH") {
|
if let Some(path) = option_env!("SLIMEVR_RUST_LD_LIBRARY_PATH") {
|
||||||
@@ -7,9 +5,5 @@ fn main() -> shadow_rs::SdResult<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tauri_build::build();
|
tauri_build::build();
|
||||||
cfg_aliases! {
|
|
||||||
mobile: { any(target_os = "ios", target_os = "android") },
|
|
||||||
desktop: { not(any(target_os = "ios", target_os = "android")) }
|
|
||||||
}
|
|
||||||
shadow_rs::new()
|
shadow_rs::new()
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--ignore='^gui$'
|
||||||
|
--ignore='^\..+'
|
||||||
|
--ignore='^node_modules$'
|
||||||
|
--ignore='^build$'
|
||||||
|
--ignore='^(local|keystore).properties$'
|
||||||
|
--ignore='^target$'
|
||||||
|
--ignore='^assets'
|
||||||
|
--ignore='.*\.(toml|yaml|nix|lock|json|md)$'
|
||||||
|
-d ../../../../
|
||||||
|
-t android
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../../../server/android/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/build.gradle.kts
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/buildSrc
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/gradle
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/gradle.properties
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/gradlew
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/gradlew.bat
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/server
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/settings.gradle.kts
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/solarxr-protocol
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../SlimeVR-Server/tauri.settings.gradle
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
pub struct TrayAvailable(pub bool);
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn is_tray_available(tray_available: tauri::State<TrayAvailable>) -> bool {
|
||||||
|
tray_available.0
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
use tauri::Manager;
|
||||||
|
|
||||||
|
mod cross;
|
||||||
|
|
||||||
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
|
pub fn run() {
|
||||||
|
log_panics::init();
|
||||||
|
|
||||||
|
tauri::Builder::default()
|
||||||
|
.plugin(
|
||||||
|
tauri_plugin_log::Builder::new()
|
||||||
|
.target(tauri_plugin_log::Target::new(
|
||||||
|
tauri_plugin_log::TargetKind::LogDir {
|
||||||
|
file_name: Some("slimevr".to_string()),
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.max_file_size(30_000 /* bytes */)
|
||||||
|
.rotation_strategy(tauri_plugin_log::RotationStrategy::KeepSome(3))
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.plugin(tauri_plugin_opener::init())
|
||||||
|
.plugin(tauri_plugin_dialog::init())
|
||||||
|
.plugin(tauri_plugin_fs::init())
|
||||||
|
.plugin(tauri_plugin_os::init())
|
||||||
|
.plugin(tauri_plugin_shell::init())
|
||||||
|
.plugin(tauri_plugin_store::Builder::default().build())
|
||||||
|
.plugin(tauri_plugin_http::init())
|
||||||
|
.invoke_handler(tauri::generate_handler![cross::is_tray_available,])
|
||||||
|
.setup(move |app| {
|
||||||
|
log::info!("SlimeVR started!");
|
||||||
|
|
||||||
|
let _ = tauri::WebviewWindowBuilder::new(
|
||||||
|
app,
|
||||||
|
"main",
|
||||||
|
tauri::WebviewUrl::App("index.html".into()),
|
||||||
|
)
|
||||||
|
.build()?;
|
||||||
|
|
||||||
|
app.manage(cross::TrayAvailable(false));
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.run(tauri::generate_context!())
|
||||||
|
.expect("error while running tauri application");
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ use crate::util::{
|
|||||||
get_launch_path, show_error, valid_java_paths, Cli, JAVA_BIN, MINIMUM_JAVA_VERSION,
|
get_launch_path, show_error, valid_java_paths, Cli, JAVA_BIN, MINIMUM_JAVA_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod cross;
|
||||||
mod presence;
|
mod presence;
|
||||||
mod state;
|
mod state;
|
||||||
mod tray;
|
mod tray;
|
||||||
@@ -106,6 +107,7 @@ fn main() -> Result<()> {
|
|||||||
setup_webview2()?;
|
setup_webview2()?;
|
||||||
|
|
||||||
// Check for environment variables that can affect the server, and if so, warn in log and GUI
|
// Check for environment variables that can affect the server, and if so, warn in log and GUI
|
||||||
|
#[cfg(desktop)]
|
||||||
check_environment_variables();
|
check_environment_variables();
|
||||||
|
|
||||||
// Spawn server process
|
// Spawn server process
|
||||||
@@ -189,6 +191,7 @@ fn setup_webview2() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(desktop)]
|
||||||
fn check_environment_variables() {
|
fn check_environment_variables() {
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
const ENVS_TO_CHECK: &[&str] = &["_JAVA_OPTIONS", "JAVA_TOOL_OPTIONS"];
|
const ENVS_TO_CHECK: &[&str] = &["_JAVA_OPTIONS", "JAVA_TOOL_OPTIONS"];
|
||||||
@@ -264,7 +267,7 @@ fn setup_tauri(
|
|||||||
open_logs_folder,
|
open_logs_folder,
|
||||||
tray::update_translations,
|
tray::update_translations,
|
||||||
tray::update_tray_text,
|
tray::update_tray_text,
|
||||||
tray::is_tray_available,
|
cross::is_tray_available,
|
||||||
presence::discord_client_exists,
|
presence::discord_client_exists,
|
||||||
presence::update_presence,
|
presence::update_presence,
|
||||||
presence::clear_presence,
|
presence::clear_presence,
|
||||||
@@ -299,7 +302,7 @@ fn setup_tauri(
|
|||||||
tray::create_tray(handle)?;
|
tray::create_tray(handle)?;
|
||||||
presence::create_presence(handle)?;
|
presence::create_presence(handle)?;
|
||||||
} else {
|
} else {
|
||||||
app.manage(tray::TrayAvailable(false));
|
app.manage(cross::TrayAvailable(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
app.manage(Mutex::new(window_state));
|
app.manage(Mutex::new(window_state));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use std::{collections::HashMap, sync::Mutex};
|
use std::{collections::HashMap, sync::Mutex};
|
||||||
|
|
||||||
|
use crate::cross::TrayAvailable;
|
||||||
use tauri::{
|
use tauri::{
|
||||||
include_image,
|
include_image,
|
||||||
menu::{Menu, MenuBuilder, MenuItemBuilder, MenuItemKind},
|
menu::{Menu, MenuBuilder, MenuItemBuilder, MenuItemKind},
|
||||||
@@ -8,7 +9,6 @@ use tauri::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub struct TrayMenu<R: Runtime>(Menu<R>);
|
pub struct TrayMenu<R: Runtime>(Menu<R>);
|
||||||
pub struct TrayAvailable(pub bool);
|
|
||||||
|
|
||||||
pub struct TrayTranslations {
|
pub struct TrayTranslations {
|
||||||
store: Mutex<HashMap<String, String>>,
|
store: Mutex<HashMap<String, String>>,
|
||||||
@@ -22,11 +22,6 @@ impl TrayTranslations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn is_tray_available(tray_available: State<TrayAvailable>) -> bool {
|
|
||||||
tray_available.0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn update_translations<R: Runtime>(
|
pub fn update_translations<R: Runtime>(
|
||||||
app: AppHandle<R>,
|
app: AppHandle<R>,
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"beforeDevCommand": "pnpm run start --host"
|
||||||
|
},
|
||||||
|
"identifier": "dev.slimevr.android"
|
||||||
|
}
|
||||||
@@ -2,3 +2,4 @@
|
|||||||
channel = "1.82"
|
channel = "1.82"
|
||||||
profile = "default"
|
profile = "default"
|
||||||
components = ["rustc", "cargo", "clippy", "rustfmt", "rust-analyzer", "rust-src"]
|
components = ["rustc", "cargo", "clippy", "rustfmt", "rust-analyzer", "rust-src"]
|
||||||
|
targets = ["x86_64-linux-android", "aarch64-linux-android", "armv7-linux-androideabi", "i686-linux-android"]
|
||||||
@@ -1,2 +1,9 @@
|
|||||||
/build
|
/build
|
||||||
/src/main/resources/web-gui
|
/src/main/resources/web-gui
|
||||||
|
|
||||||
|
/src/main/java/dev/slimevr/android/generated
|
||||||
|
/src/main/jniLibs/**/*.so
|
||||||
|
/src/main/assets/tauri.conf.json
|
||||||
|
/tauri.build.gradle.kts
|
||||||
|
/proguard-tauri.pro
|
||||||
|
/tauri.properties
|
||||||
@@ -7,14 +7,24 @@
|
|||||||
*/
|
*/
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
kotlin("plugin.serialization")
|
kotlin("plugin.serialization")
|
||||||
id("com.github.gmazzo.buildconfig")
|
id("com.github.gmazzo.buildconfig")
|
||||||
|
|
||||||
id("com.android.application") version "8.6.1"
|
id("com.android.application")
|
||||||
id("org.ajoberstar.grgit")
|
id("org.ajoberstar.grgit")
|
||||||
|
id("rust")
|
||||||
|
}
|
||||||
|
|
||||||
|
val tauriProperties = Properties().apply {
|
||||||
|
val propFile = file("tauri.properties")
|
||||||
|
if (propFile.exists()) {
|
||||||
|
propFile.inputStream().use { load(it) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
@@ -28,17 +38,6 @@ java {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Copy>("copyGuiAssets") {
|
|
||||||
from(rootProject.layout.projectDirectory.dir("gui/dist"))
|
|
||||||
into(layout.projectDirectory.dir("src/main/resources/web-gui"))
|
|
||||||
if (inputs.sourceFiles.isEmpty) {
|
|
||||||
throw GradleException("You need to run \"pnpm run build\" on the gui folder first!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tasks.preBuild {
|
|
||||||
dependsOn(":server:android:copyGuiAssets")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
jvmTarget.set(JvmTarget.JVM_17)
|
jvmTarget.set(JvmTarget.JVM_17)
|
||||||
@@ -61,6 +60,14 @@ repositories {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rust {
|
||||||
|
rootDirRel = if (projectDir.absolutePath.contains("gen/android")) {
|
||||||
|
"../../../../../"
|
||||||
|
} else {
|
||||||
|
"../../gui/src-tauri"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":server:core"))
|
implementation(project(":server:core"))
|
||||||
|
|
||||||
@@ -68,17 +75,15 @@ dependencies {
|
|||||||
implementation("org.apache.commons:commons-lang3:3.15.0")
|
implementation("org.apache.commons:commons-lang3:3.15.0")
|
||||||
|
|
||||||
// Android stuff
|
// Android stuff
|
||||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
implementation("androidx.webkit:webkit:1.14.0")
|
||||||
|
implementation("androidx.appcompat:appcompat:1.7.1")
|
||||||
|
implementation("androidx.activity:activity-ktx:1.10.1")
|
||||||
implementation("androidx.core:core-ktx:1.13.1")
|
implementation("androidx.core:core-ktx:1.13.1")
|
||||||
implementation("com.google.android.material:material:1.12.0")
|
implementation("com.google.android.material:material:1.12.0")
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
||||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||||
// For hosting web GUI
|
|
||||||
implementation("io.ktor:ktor-server-core:2.3.12")
|
|
||||||
implementation("io.ktor:ktor-server-netty:2.3.10")
|
|
||||||
implementation("io.ktor:ktor-server-caching-headers:2.3.12")
|
|
||||||
|
|
||||||
// Serial
|
// Serial
|
||||||
implementation("com.github.mik3y:usb-serial-for-android:3.7.0")
|
implementation("com.github.mik3y:usb-serial-for-android:3.7.0")
|
||||||
@@ -90,34 +95,18 @@ extra.apply {
|
|||||||
set("gitVersionName", grgit.describe(mapOf("tags" to true, "always" to true)))
|
set("gitVersionName", grgit.describe(mapOf("tags" to true, "always" to true)))
|
||||||
}
|
}
|
||||||
android {
|
android {
|
||||||
// The app's namespace. Used primarily to access app resources.
|
|
||||||
|
|
||||||
namespace = "dev.slimevr.android"
|
namespace = "dev.slimevr.android"
|
||||||
|
|
||||||
/* compileSdk specifies the Android API level Gradle should use to
|
|
||||||
compile your app. This means your app can use the API features included in
|
|
||||||
this API level and lower. */
|
|
||||||
|
|
||||||
compileSdk = 35
|
compileSdk = 35
|
||||||
|
|
||||||
/* The defaultConfig block encapsulates default settings and entries for all
|
|
||||||
build variants and can override some attributes in main/AndroidManifest.xml
|
|
||||||
dynamically from the build system. You can configure product flavors to override
|
|
||||||
these values for different versions of your app. */
|
|
||||||
|
|
||||||
packaging {
|
packaging {
|
||||||
resources.excludes.add("META-INF/*")
|
resources.excludes.add("META-INF/*")
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
||||||
// Uniquely identifies the package for publishing.
|
|
||||||
applicationId = "dev.slimevr.server.android"
|
applicationId = "dev.slimevr.server.android"
|
||||||
|
|
||||||
// Defines the minimum API level required to run the app.
|
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
|
|
||||||
// Specifies the API level used to test the app.
|
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
|
|
||||||
// adds an offset of the version code as we might do apk releases in the middle of actual
|
// adds an offset of the version code as we might do apk releases in the middle of actual
|
||||||
@@ -128,8 +117,27 @@ android {
|
|||||||
|
|
||||||
// Defines a user-friendly version name for your app.
|
// Defines a user-friendly version name for your app.
|
||||||
versionName = extra["gitVersionName"] as? String ?: "v0.0.0"
|
versionName = extra["gitVersionName"] as? String ?: "v0.0.0"
|
||||||
|
setProperty("archivesBaseName", "app")
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
ndk {
|
||||||
|
abiFilters += listOf("x86", "x86_64", "arm64-v8a", "armeabi-v7a")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
create("release") {
|
||||||
|
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||||
|
}
|
||||||
|
|
||||||
|
keyAlias = keystoreProperties["keyAlias"] as String?
|
||||||
|
keyPassword = keystoreProperties["password"] as String?
|
||||||
|
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
|
||||||
|
storePassword = keystoreProperties["password"] as String?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The buildTypes block is where you can configure multiple build types.
|
/* The buildTypes block is where you can configure multiple build types.
|
||||||
@@ -139,15 +147,25 @@ android {
|
|||||||
build type applies ProGuard settings and is not signed by default. */
|
build type applies ProGuard settings and is not signed by default. */
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
getByName("debug") {
|
||||||
/* By default, Android Studio configures the release build type to enable code
|
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
||||||
shrinking, using minifyEnabled, and specifies the default ProGuard rules file. */
|
isDebuggable = true
|
||||||
|
isJniDebuggable = true
|
||||||
|
isMinifyEnabled = false
|
||||||
|
packaging {
|
||||||
|
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
||||||
|
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
||||||
|
jniLibs.keepDebugSymbols.add("*/x86/*.so")
|
||||||
|
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
|
||||||
|
}
|
||||||
|
}
|
||||||
getByName("release") {
|
getByName("release") {
|
||||||
isMinifyEnabled = true // Enables code shrinking for the release build type.
|
isMinifyEnabled = true
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android.txt"),
|
*fileTree(".") { include("**/*.pro") }
|
||||||
"proguard-rules.pro",
|
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
||||||
|
.toList().toTypedArray(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,4 +177,13 @@ android {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "17"
|
jvmTarget = "17"
|
||||||
}
|
}
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
apply(from = "tauri.build.gradle.kts")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("Couldn't enable tauri stuff")
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,15 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths" />
|
||||||
|
</provider>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".ForegroundService"
|
android:name=".ForegroundService"
|
||||||
|
|||||||
@@ -9,17 +9,7 @@ import dev.slimevr.Keybinding
|
|||||||
import dev.slimevr.VRServer
|
import dev.slimevr.VRServer
|
||||||
import dev.slimevr.android.serial.AndroidSerialHandler
|
import dev.slimevr.android.serial.AndroidSerialHandler
|
||||||
import io.eiren.util.logging.LogManager
|
import io.eiren.util.logging.LogManager
|
||||||
import io.ktor.http.CacheControl
|
|
||||||
import io.ktor.http.CacheControl.Visibility
|
|
||||||
import io.ktor.server.application.install
|
|
||||||
import io.ktor.server.engine.embeddedServer
|
|
||||||
import io.ktor.server.http.content.CachingOptions
|
|
||||||
import io.ktor.server.http.content.staticResources
|
|
||||||
import io.ktor.server.netty.Netty
|
|
||||||
import io.ktor.server.plugins.cachingheaders.CachingHeaders
|
|
||||||
import io.ktor.server.routing.routing
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.time.ZonedDateTime
|
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
@@ -29,18 +19,6 @@ val vrServerInitialized: Boolean
|
|||||||
get() = ::vrServer.isInitialized
|
get() = ::vrServer.isInitialized
|
||||||
|
|
||||||
fun main(activity: AppCompatActivity) {
|
fun main(activity: AppCompatActivity) {
|
||||||
// Host the web GUI server
|
|
||||||
embeddedServer(Netty, port = 34536) {
|
|
||||||
routing {
|
|
||||||
install(CachingHeaders) {
|
|
||||||
options { _, _ ->
|
|
||||||
CachingOptions(CacheControl.NoStore(Visibility.Public), ZonedDateTime.now())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
staticResources("/", "web-gui", "index.html")
|
|
||||||
}
|
|
||||||
}.start(wait = false)
|
|
||||||
|
|
||||||
thread(start = true, name = "Main VRServer Thread") {
|
thread(start = true, name = "Main VRServer Thread") {
|
||||||
try {
|
try {
|
||||||
LogManager.initialize(activity.filesDir)
|
LogManager.initialize(activity.filesDir)
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package dev.slimevr.android
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.webkit.JavascriptInterface
|
import android.webkit.JavascriptInterface
|
||||||
import android.webkit.WebSettings
|
import androidx.activity.enableEdgeToEdge
|
||||||
import android.webkit.WebView
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import io.eiren.util.logging.LogManager
|
import io.eiren.util.logging.LogManager
|
||||||
|
|
||||||
class AndroidJsObject {
|
class AndroidJsObject {
|
||||||
@@ -13,10 +11,10 @@ class AndroidJsObject {
|
|||||||
fun isThere(): Boolean = true
|
fun isThere(): Boolean = true
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : TauriActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
enableEdgeToEdge()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
|
||||||
|
|
||||||
// Initialize logger (doesn't re-initialize if already run)
|
// Initialize logger (doesn't re-initialize if already run)
|
||||||
try {
|
try {
|
||||||
@@ -33,35 +31,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
LogManager.info("[MainActivity] VRServer is already running, skipping initialization.")
|
LogManager.info("[MainActivity] VRServer is already running, skipping initialization.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the web GUI web page
|
|
||||||
LogManager.info("[MainActivity] Initializing GUI WebView...")
|
|
||||||
val guiWebView = findViewById<WebView>(R.id.guiWebView)
|
|
||||||
|
|
||||||
// ## Configure for web GUI ##
|
|
||||||
// Enable debug mode
|
|
||||||
WebView.setWebContentsDebuggingEnabled(true)
|
|
||||||
|
|
||||||
// Set required features
|
|
||||||
guiWebView.settings.javaScriptEnabled = true
|
|
||||||
guiWebView.settings.domStorageEnabled = true
|
|
||||||
|
|
||||||
// TODO: Let code know it is in android, should be gone when we start using tauri
|
|
||||||
guiWebView.addJavascriptInterface(AndroidJsObject(), "__ANDROID__")
|
|
||||||
|
|
||||||
// Try fixing zoom usability
|
|
||||||
guiWebView.settings.setSupportZoom(true)
|
|
||||||
guiWebView.settings.useWideViewPort = true
|
|
||||||
guiWebView.settings.loadWithOverviewMode = true
|
|
||||||
guiWebView.invokeZoomPicker()
|
|
||||||
|
|
||||||
// Disable cache! This is all local anyway
|
|
||||||
guiWebView.settings.cacheMode = WebSettings.LOAD_NO_CACHE
|
|
||||||
guiWebView.clearCache(true)
|
|
||||||
|
|
||||||
// Load GUI page
|
|
||||||
guiWebView.loadUrl("http://127.0.0.1:34536/")
|
|
||||||
LogManager.info("[MainActivity] GUI WebView has been initialized and loaded.")
|
|
||||||
|
|
||||||
// Start a foreground service to notify the user the SlimeVR Server is running
|
// Start a foreground service to notify the user the SlimeVR Server is running
|
||||||
// This also helps prevent Android from ejecting the process unexpectedly
|
// This also helps prevent Android from ejecting the process unexpectedly
|
||||||
val serviceIntent = Intent(this, ForegroundService::class.java)
|
val serviceIntent = Intent(this, ForegroundService::class.java)
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-path name="my_images" path="." />
|
||||||
|
<cache-path name="my_cache_images" path="." />
|
||||||
|
</paths>
|
||||||
@@ -40,3 +40,8 @@ project(":server").projectDir = File("server")
|
|||||||
include(":server:core")
|
include(":server:core")
|
||||||
include(":server:desktop")
|
include(":server:desktop")
|
||||||
include(":server:android")
|
include(":server:android")
|
||||||
|
try {
|
||||||
|
apply(from = "tauri.settings.gradle")
|
||||||
|
} catch(e: Exception) {
|
||||||
|
println("Couldn't enable tauri stuff")
|
||||||
|
}
|
||||||
Reference in new issue
Block a user