The same Tauri 2 project builds for Android: mobile.html as a third Vite
entry (src/mobile/, the mockup on real data), tauri.android.conf.json, the
mobile stubs (updater, lyric alignment, vocal separation), rustls reqwest
on Android, the AAudio buffer, and a hand-driven detour build
(src-tauri/android/{env,build,deploy,dev}.sh) while Developer Mode is off.
ANDROID.md is the recipe.
Playback: the media-session plugin crate (lock-screen card, MediaStyle
notification, audio focus, headset buttons, a foreground service that
promotes itself first — Android 14 kills the app otherwise), session
restore across reload and restart, solid chrome after measuring the
backdrop-filter lag.
The catalog: Search is the desktop's top bar (the top-result rule, artist
cards), the artist page and the record page are the desktop's, Home is the
desktop's landing page, Gaps per followed shelf. Playing goes through the
desktop's own source rules, moved verbatim from state.svelte.js into
src/lib/sources.js so both apps share one resolver; the phone readies the
next three tracks and crosses boundaries gapless. Save fetches a record or
a track into the library by the download rules; Transfers shows the
burst. The raw Soulseek search stays, offered on request, a peer's copy
streaming with the lane rising as the bytes arrive. Community is the
Soulseek side (rooms, chat, buddies); the private layer waits.
The opener and storage plugins (social links, the picked library folder,
all-files access), the volume normalization switch, and the harness:
tests/mobile/smoke.mjs walks the mock (a fake network behind
src/lib/events.js) and the real phone over CDP, perf.mjs measures frames.
84 lines
2.3 KiB
Rust
84 lines
2.3 KiB
Rust
//! The updater, on a phone: nothing. The phone gets its builds from a store or
|
|
//! a sideload, `tauri-plugin-updater` is desktop-only, and the desktop module
|
|
//! (updater.rs) leans on it in every function. This file stands in for that
|
|
//! module on mobile (`#[path]` in lib.rs) so the command list, the managed
|
|
//! state and `init` keep the same names and the rest of the app never needs a
|
|
//! `cfg`. Every command answers honestly: there is no update channel here.
|
|
|
|
use serde::Serialize;
|
|
use tauri::{AppHandle, State};
|
|
|
|
#[derive(Default)]
|
|
pub struct UpdaterState;
|
|
|
|
#[derive(Serialize, Clone)]
|
|
pub struct Status {
|
|
pub version: String,
|
|
pub channel: String,
|
|
pub auto_check: bool,
|
|
pub endpoint_stable: String,
|
|
pub endpoint_nightly: String,
|
|
pub default_stable: String,
|
|
pub default_nightly: String,
|
|
pub has_token: bool,
|
|
pub source_kind: String,
|
|
pub available: Option<()>,
|
|
pub checking: bool,
|
|
pub installing: bool,
|
|
pub last_check: Option<i64>,
|
|
pub last_error: Option<String>,
|
|
pub progress: Option<()>,
|
|
pub dev_build: bool,
|
|
}
|
|
|
|
fn status(app: &AppHandle) -> Status {
|
|
Status {
|
|
version: app.package_info().version.to_string(),
|
|
channel: "mobile".into(),
|
|
auto_check: false,
|
|
endpoint_stable: String::new(),
|
|
endpoint_nightly: String::new(),
|
|
default_stable: String::new(),
|
|
default_nightly: String::new(),
|
|
has_token: false,
|
|
source_kind: "none".into(),
|
|
available: None,
|
|
checking: false,
|
|
installing: false,
|
|
last_check: None,
|
|
last_error: None,
|
|
progress: None,
|
|
dev_build: cfg!(debug_assertions),
|
|
}
|
|
}
|
|
|
|
pub fn init(_app: &AppHandle) {}
|
|
|
|
#[tauri::command]
|
|
pub fn updater_status(app: AppHandle) -> Status {
|
|
status(&app)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub async fn updater_check(app: AppHandle) -> Result<Status, String> {
|
|
Ok(status(&app))
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn updater_set(
|
|
app: AppHandle,
|
|
_state: State<'_, UpdaterState>,
|
|
_channel: Option<String>,
|
|
_auto_check: Option<bool>,
|
|
_endpoint_stable: Option<String>,
|
|
_endpoint_nightly: Option<String>,
|
|
_token: Option<String>,
|
|
) -> Status {
|
|
status(&app)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub async fn updater_install(_app: AppHandle) -> Result<(), String> {
|
|
Err("updates are not installed in place on this platform".into())
|
|
}
|