All checks were successful
gitleaks / scan (push) Successful in 41s
Wire the new strawcore continuation fetchers through UniFFI and add
load-more-on-scroll to the Channel and Search screens — previously both
loaded only page 1 and stopped.
FFI (rust/strawcore): search() now returns Page{items, continuation};
channelInfo carries videos_continuation; new searchContinuation() and
channelVideosContinuation() suspend funs map the core ContinuationPage.
Channel + Search ViewModels: loadMore() fetches the next page, dedups by
url, advances the token, and stops when the token runs out or a page
yields zero net-new items (guards a looping continuation). Result-set
swaps (channel switch / new submit / cache preview) cancel the in-flight
page, and a token fence inside the state update prevents a stale page
being spliced into a replaced list. Screens add a near-end LazyColumn
trigger (rememberLazyListState + derivedStateOf) and a footer spinner.
56 lines
1.9 KiB
Rust
56 lines
1.9 KiB
Rust
// strawcore (wrapper) — UniFFI surface for the Straw Android app.
|
|
//
|
|
// Thin layer over the new Sulkta-Coop/strawcore-core crate. All extractor
|
|
// logic (InnerTube, JS deobf, stream parsing, search, channel, playlist)
|
|
// lives in core. This file:
|
|
// * re-exports the DTOs Kotlin expects under their familiar names
|
|
// * exposes #[uniffi::export] async fns that bridge Kotlin suspend funs
|
|
// to the core's blocking calls via tokio::task::spawn_blocking
|
|
// * owns init_logging() — also initializes the core Downloader
|
|
|
|
use std::sync::Once;
|
|
|
|
mod channel;
|
|
mod error;
|
|
mod feed;
|
|
mod runtime;
|
|
mod search;
|
|
mod stream;
|
|
|
|
// 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::{Page, SearchItem};
|
|
pub use stream::{AudioStreamItem, StreamInfo, VideoStreamItem};
|
|
|
|
/// Initialize Android logging + the strawcore-core HTTP downloader.
|
|
/// Kotlin calls this from StrawApp.onCreate(). Idempotent.
|
|
#[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");
|
|
});
|
|
runtime::ensure_initialized();
|
|
}
|
|
|
|
/// Smoke-test entry point — round-trip a string through JNI.
|
|
/// Used during the initial UniFFI bring-up; kept for future smoke
|
|
/// debugging. Logs shape only — the `name` value never hits logcat
|
|
/// because a future caller might pass a real user-supplied string.
|
|
#[uniffi::export]
|
|
pub fn hello_from_rust(name: String) -> String {
|
|
log::info!("hello_from_rust called name_len={}", name.len());
|
|
format!(
|
|
"hello {} from rust 🦀 (strawcore v{})",
|
|
name,
|
|
env!("CARGO_PKG_VERSION")
|
|
)
|
|
}
|
|
|
|
uniffi::setup_scaffolding!();
|