android builds #9

Merged
restitux merged 27 commits from android-ci into main 2026-01-19 01:03:46 +00:00
5 changed files with 82 additions and 0 deletions
Showing only changes of commit e37d1723c9 - Show all commits
Generated
+44
View File
@@ -127,6 +127,37 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "android-permissions"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3b4eabf57cddc2cd9934aabb1d17f3c9f1f1cfcac48746944fcff76ed0f62bb"
dependencies = [
"android_logger",
"jni",
"log",
"thiserror 1.0.69",
"walkdir",
]
[[package]]
name = "android_log-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84521a3cf562bc62942e294181d9eef17eb38ceb8c68677bc49f144e4c3d4f8d"
[[package]]
name = "android_logger"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c494134f746c14dc653a35a4ea5aca24ac368529da5370ecf41fe0341c35772f"
dependencies = [
"android_log-sys",
"env_logger",
"log",
"once_cell",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -2244,6 +2275,16 @@ dependencies = [
"syn 2.0.108",
]
[[package]]
name = "env_logger"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
dependencies = [
"log",
"regex",
]
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -4268,6 +4309,7 @@ dependencies = [
name = "mumble-web2-gui"
version = "0.1.0"
dependencies = [
"android-permissions",
"async_cell",
"asynchronous-codec",
"base64",
@@ -4286,6 +4328,7 @@ dependencies = [
"futures-channel",
"gloo-timers",
"html-purifier",
"jni",
"js-sys",
"lol_html 2.7.0",
"markdown",
@@ -4293,6 +4336,7 @@ dependencies = [
"mime_guess",
"mumble-protocol-2x",
"mumble-web2-common",
"ndk-context",
"ogg 0.9.2",
"once_cell",
"opus",
+8
View File
@@ -100,6 +100,14 @@ dioxus-asset-resolver = "0.7.2"
#[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "macos", target_arch = "wasm32"))'.dependencies]
rfd = { git = "https://github.com/PolyMeilex/rfd.git", version = "^0.16.0", default-features = false, optional = true }
[target.'cfg(target_os = "android")'.dependencies]
# Android Permissions for Rust
android-permissions = "0.1.2"
# Rust bindings to the JNI
jni = "0.21.1"
# Handles for accessing Android APIs
ndk-context = "0.1.1"
# Denoising
# =========
deep_filter = { git = "https://github.com/Rikorose/DeepFilterNet.git", rev = "d375b2d8309e0935d165700c91da9de862a99c31", features = [
+2
View File
@@ -723,6 +723,8 @@ pub fn app() -> Element {
}
});
imp::request_permissions();
rsx!(
document::Link{ rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" }
document::Link{ rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" }
+19
View File
@@ -0,0 +1,19 @@
use android_permissions::{PermissionManager, RECORD_AUDIO};
use jni::{objects::JObject, JavaVM};
#[cfg(feature = "mobile")]
pub fn request_permissions() {
request_recording_permission();
}
#[cfg(target_os = "android")]
pub fn request_recording_permission() {
let ctx = ndk_context::android_context();
let vm = unsafe { JavaVM::from_raw(ctx.vm().cast()).unwrap() };
let activity = unsafe { JObject::from_raw(ctx.context().cast()) };
let manager = PermissionManager::create(vm, activity).unwrap();
if !manager.check(&RECORD_AUDIO).unwrap() {
manager.request(&[&RECORD_AUDIO]).unwrap();
}
}
+9
View File
@@ -4,6 +4,15 @@ mod web;
#[cfg(any(feature = "desktop", feature = "mobile"))]
mod desktop;
#[cfg(feature = "mobile")]
mod mobile;
#[cfg(feature = "mobile")]
pub use mobile::request_permissions;
#[cfg(any(feature = "desktop", feature = "web"))]
pub fn request_permissions() {}
#[cfg(all(feature = "web", not(any(feature = "desktop", feature = "mobile"))))]
pub use web::*;