fix: pass off env vars to android apps (#3621)

* fix: pass off env vars to android apps

* move to jni_onload

* fix clippy
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-01-21 18:52:56 -08:00
1 parent ce2b223af9
commit 03c2d6711d
7 files changed
+65 -10

No files matched your search

+11 -4
View File
@@ -100,10 +100,8 @@ macro_rules! read_env_config {
/// For reference, the devserver typically lives on `127.0.0.1:8080` and serves the devserver websocket
/// on `127.0.0.1:8080/_dioxus`.
pub fn devserver_raw_addr() -> Option<SocketAddr> {
std::env::var(DEVSERVER_RAW_ADDR_ENV)
.unwrap_or_else(|_| "127.0.0.1:8080".to_string())
.parse()
.ok()
let addr = std::env::var(DEVSERVER_RAW_ADDR_ENV).ok()?;
addr.parse().ok()
}
/// Get the address of the devserver for use over a websocket
@@ -288,5 +286,14 @@ pub fn out_dir() -> Option<PathBuf> {
///
/// This is designed with desktop executables in mind.
pub fn session_cache_dir() -> Option<PathBuf> {
if cfg!(target_os = "android") {
return Some(android_session_cache_dir());
}
std::env::var(SESSION_CACHE_DIR).ok().map(PathBuf::from)
}
/// The session cache directory for android
pub fn android_session_cache_dir() -> PathBuf {
PathBuf::from("/data/local/tmp/dx/")
}