android: what the phone says when things go wrong
Fifty-nine places put a raw Rust string into a field a person reads, and the red toast drew it verbatim — a phone in a lift showed "could not reach server: io: failed to lookup address information" under the password box. One translator, src/mobile/trouble.js, called where an error is DRAWN rather than where it is caught: the stores keep what Rust said and only the sentence on screen is ours, so every sink is fixed at once. Five screens that drew a failed read as an empty answer stop lying — Tracks no longer reports a broken database as an empty library, a playlist that could not be read is not an empty playlist, the lyrics face says a lookup failed instead of "no lyrics" and finally carries the ⋯ that reaches Paste lyrics, Gaps says why it could not reach the catalogue, and Search signed out says so where it used to render nothing at all. The room list, which is fire-and-forget over the wire, gets a twelve-second end and a Try again. rescan_library ran prune_missing() first, which deletes every track row whose file does not exist — so one tap on You → Rescan library with the folder unreachable emptied the whole index and returned Ok(()). It now makes the root if it is merely not there yet and refuses if it cannot be read, and You draws the path with what to do about it. The mock grew a weather system so the walk can drive all of this: fail, answer, offline and clear, checked before dispatch so a plugin command arms like any other. Nine mock steps and one on the phone — the first steps in thirty rounds that ever made a command reject or saw the client signed out — and the last of them puts the weather away and leaves the app as it found it.
This commit is contained in:
1 parent
44eda8dff5
commit
052e15302b
22 files changed
+537
-35
No files matched your search
@@ -423,12 +423,21 @@ fn downloads_dir(app: &tauri::AppHandle) -> PathBuf {
|
||||
/// until the next app launch.
|
||||
#[tauri::command]
|
||||
pub async fn rescan_library(app: tauri::AppHandle) -> Result<(), String> {
|
||||
// The prune below deletes every track row whose file does not exist, and
|
||||
// then every album left with none — so a root that has gone away (an
|
||||
// unmounted card, a revoked SAF grant, a drive letter that moved) used to
|
||||
// empty the WHOLE index on one tap and return Ok(()). Make the folder if
|
||||
// it is merely not there yet, so a fresh install still works, and refuse
|
||||
// if it cannot be made or read. Same idiom as connect_and_login's.
|
||||
let root = downloads_dir(&app);
|
||||
if std::fs::create_dir_all(&root).is_err() || !root.is_dir() {
|
||||
return Err(format!("library-folder-missing: {}", root.display()));
|
||||
}
|
||||
let state = app.state::<LibraryState>();
|
||||
let lib = state.library.clone();
|
||||
let _ = tauri::async_runtime::spawn_blocking(move || lib.prune_missing())
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
let root = downloads_dir(&app);
|
||||
sweep_stale_partials(&root);
|
||||
sweep_stale_auditions(&root);
|
||||
sweep_empty_dirs(&root, 0);
|
||||
|
||||
Reference in new issue
Block a user