// strawcore — Rust core for the Straw Android app. // // Phase U-1: hello-world smoke test. One exported function, returns a // String so we know JNI + UniFFI marshalling works end-to-end before we // pull in rustypipe. // // Phase U-2+ adds real APIs (search, stream_info, channel_info). use std::sync::Once; mod channel; mod error; mod runtime; mod search; mod stream; #[allow(unused_imports)] use runtime::block_on; // Re-exports so UniFFI sees the types at the crate root for macro discovery. pub use channel::ChannelInfo; pub use error::StrawcoreError; pub use search::SearchItem; pub use stream::{AudioStreamItem, StreamInfo, VideoStreamItem}; /// Initialize Android logging once. The Kotlin side calls this from /// StrawApp.onCreate() so anything emitted via `log::info!()` shows up in /// `adb logcat -s strawcore`. #[uniffi::export] pub fn init_logging() { static ONCE: Once = Once::new(); ONCE.call_once(|| { android_logger::init_once( android_logger::Config::default() .with_max_level(log::LevelFilter::Info) .with_tag("strawcore"), ); log::info!("strawcore initialized"); }); } /// Smoke-test entry point — round-trip a string through JNI so we know /// the bridge is working before pulling in rustypipe. #[uniffi::export] pub fn hello_from_rust(name: String) -> String { log::info!("hello_from_rust called with name={}", name); format!("hello {} from rust 🦀 (strawcore v{})", name, env!("CARGO_PKG_VERSION")) } uniffi::setup_scaffolding!();