refactor dioxus platform support to use feature mobile

This commit is contained in:
2026-01-04 19:31:29 -07:00
parent eda8c4467e
commit 6d5bf80d72
3 changed files with 18 additions and 17 deletions
+13 -2
View File
@@ -97,8 +97,8 @@ dioxus-asset-resolver = "0.7.2"
# Platform Integration # Platform Integration
# ==================== # ====================
# rfd only supports windows, macos, linux, and wasm32. No support for Android or iOS # rfd only supports windows, macos, linux, and wasm32. No support for Android or iOS
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "macos", target_arch = "wasm32"))'.dependencies] #[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 } rfd = { git = "https://github.com/PolyMeilex/rfd.git", version = "^0.16.0", default-features = false, optional = true }
# Denoising # Denoising
# ========= # =========
@@ -126,6 +126,7 @@ web = [
"gloo-timers", "gloo-timers",
"tracing-web", "tracing-web",
"deep_filter/wasm", "deep_filter/wasm",
"rfd",
] ]
desktop = [ desktop = [
"dioxus/desktop", "dioxus/desktop",
@@ -138,3 +139,13 @@ desktop = [
"rfd/xdg-portal", "rfd/xdg-portal",
"etcetera", "etcetera",
] ]
mobile = [
"dioxus/mobile",
"tokio",
"tokio-rustls",
"tracing-subscriber/env-filter",
"opus",
"cpal",
"dasp_ring_buffer",
]
+2 -12
View File
@@ -210,12 +210,7 @@ pub fn Channel(id: ChannelId) -> Element {
) )
} }
#[cfg(any( #[cfg(any(feature = "desktop", feature = "web"))]
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_arch = "wasm32",
))]
pub fn pick_and_send_file(net: &Coroutine<Command>) { pub fn pick_and_send_file(net: &Coroutine<Command>) {
let channels = if let Some(user) = STATE.server.read().this_user() { let channels = if let Some(user) = STATE.server.read().this_user() {
vec![user.channel] vec![user.channel]
@@ -237,12 +232,7 @@ pub fn pick_and_send_file(net: &Coroutine<Command>) {
}); });
}); });
} }
#[cfg(not(any( #[cfg(not(any(feature = "desktop", feature = "web")))]
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_arch = "wasm32",
)))]
pub fn pick_and_send_file(net: &Coroutine<Command>) {} pub fn pick_and_send_file(net: &Coroutine<Command>) {}
#[component] #[component]
+3 -3
View File
@@ -1,11 +1,11 @@
#[cfg(feature = "web")] #[cfg(feature = "web")]
mod web; mod web;
#[cfg(feature = "desktop")] #[cfg(any(feature = "desktop", feature = "android"))]
mod desktop; mod desktop;
#[cfg(all(feature = "web", not(feature = "desktop")))] #[cfg(all(feature = "web", not(any(feature = "desktop", feature = "android"))))]
pub use web::*; pub use web::*;
#[cfg(feature = "desktop")] #[cfg(any(feature = "desktop", feature = "android"))]
pub use desktop::*; pub use desktop::*;