add microphone grabbing permission
Build android container / android-release-builder-container-build (push) Successful in 7s
Build Mumble Web 2 / linux_build (push) Failing after 50s
Build Mumble Web 2 / windows_build (push) Failing after 1m43s
Build Mumble Web 2 / android_build (push) Failing after 46s
Build android container / android-release-builder-container-build (push) Successful in 7s
Build Mumble Web 2 / linux_build (push) Failing after 50s
Build Mumble Web 2 / windows_build (push) Failing after 1m43s
Build Mumble Web 2 / android_build (push) Failing after 46s
This commit is contained in:
@@ -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 = [
|
||||
|
||||
@@ -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" }
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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::*;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user