The drag payload was an untyped Vec<u64>, so dropping a LOCAL album row
onto a local playlist stored its library row id as a qobuz_track_id - the
D11 resolver could not resolve the fake id and hid the row (the
empty-playlist report). New DragTrack {Qobuz|LocalRow|Plex} typed per
originating view; the drop arm stores source-aware refs (qobuz_download
rows keep their real Qobuz ref, plex rows their key, local rows their
path) for both local and Qobuz playlist targets.
Add-to-playlist had collapsed to play-track in LocalAlbumView (entry
rendered, action ignored) and was an unhandled arm in the Tracks tab; both
now route to the source-aware picker, Plex rows gain the entry everywhere
(gate was excluding them), folder-detail rows route through the shared
track-action arm, and bulk arms stop skipping Plex.
D11 nuance: a local-path row missing from the library index but present on
disk renders with a filename fallback instead of hiding; only genuinely
missing files stay hidden (logged distinctly). main.rs also carries the
recovery handler hunks for the sign-in flow fix (Login screen first,
browser OAuth after, no unlocked-empty shell).
cc
45 lines
1.5 KiB
Rust
45 lines
1.5 KiB
Rust
//! Track drag-and-drop state — the tracks currently being dragged onto a
|
|
//! sidebar playlist. The UI (DragState global) drives the ghost +
|
|
//! drop highlight; the actual track refs live here (the global only
|
|
//! carries a count + ghost text).
|
|
//!
|
|
//! The payload is SOURCE-TYPED: a row dragged from a Qobuz surface carries
|
|
//! its catalog id, a LocalLibrary file row its `local_tracks` row id, a
|
|
//! Plex row its rating key. The drop arm maps each variant to the right
|
|
//! playlist ref (`qobuz_track_id` / `local_path` / `plex_key`) — storing a
|
|
//! library row id as a Qobuz id is what made dropped local rows resolve
|
|
//! as unavailable (hidden, D11).
|
|
|
|
use std::sync::{LazyLock, Mutex};
|
|
|
|
/// One dragged track, typed by its source namespace.
|
|
#[derive(Debug, Clone)]
|
|
pub enum DragTrack {
|
|
/// Qobuz catalog track id (also offline-cached rows — those ARE
|
|
/// catalog ids with a local copy).
|
|
Qobuz(u64),
|
|
/// LocalLibrary `local_tracks` row id (resolved source-aware at
|
|
/// insert: offline copies -> Qobuz ref, user files -> local_path).
|
|
LocalRow(i64),
|
|
/// Plex track — the rating key.
|
|
Plex(String),
|
|
}
|
|
|
|
static DRAGGED: LazyLock<Mutex<Vec<DragTrack>>> = LazyLock::new(|| Mutex::new(Vec::new()));
|
|
|
|
pub fn set_dragged(tracks: Vec<DragTrack>) {
|
|
if let Ok(mut d) = DRAGGED.lock() {
|
|
*d = tracks;
|
|
}
|
|
}
|
|
|
|
pub fn dragged() -> Vec<DragTrack> {
|
|
DRAGGED.lock().map(|d| d.clone()).unwrap_or_default()
|
|
}
|
|
|
|
pub fn clear() {
|
|
if let Ok(mut d) = DRAGGED.lock() {
|
|
d.clear();
|
|
}
|
|
}
|