mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 13:12:53 +00:00
Read a playlist back before writing over it
Ten review findings in the remote-playlist work, all of them the same shape: something acted on what it remembered instead of what the server says now. - A confirmed-gone playlist is forgotten whole — snapshot, list entry, and both ordering fences — so a refresh that started before the delete can no longer republish it, and a list refetch that fails offline no longer leaves it on screen. - `.accountsDidChange` discards account-scoped content when the account it belonged to is no longer the effective one, as the status notification already did. - A tab that stops being offered no longer stays selected: the browse view moves to the first available one, which reloads by itself. - A Handoff account id is accepted only when that account is on the instance the playlist lives on. - Composite writes moved up into `AccountService`, over a transport whose every method is exactly one request: create-with-privacy, rename, and set-description. The credential is rechecked between each pair, so a sign-out between the two halves of a create or an edit can no longer send the second half under the previous user's secret. - Editing a playlist no longer forces it private. Invidious serialises visibility as `isListed` — `privacy.public?`, so unlisted and private are indistinguishable — which the snapshot now carries; the picker starts there, and sends nothing at all unless it was moved. Invidious keeps the stored visibility when the PATCH omits it (measured), so an untouched picker leaves it exactly as it was. - Tapping Edit on a server-side playlist awaits an authenticated refetch first and populates the form from it; a failed refetch shows an error and no sheet. - Playlist rows are keyed by row rather than by video id, which two rows of the same video share. - The add-to-playlist sheet offers only accounts whose instance is enabled and that hold a credential, alongside the write capability.
This commit is contained in:
@@ -87,9 +87,19 @@ struct RemotePlaylistSnapshot: Hashable, Sendable {
|
||||
/// The rows that can be addressed for removal, in playlist order.
|
||||
let entries: [RemotePlaylistEntry]
|
||||
|
||||
init(playlist: Playlist, entries: [RemotePlaylistEntry]) {
|
||||
/// Whether the server lists this playlist publicly, where it says so.
|
||||
///
|
||||
/// Deliberately not a ``PlaylistPrivacy``, because it is not one: Invidious
|
||||
/// serialises visibility as `isListed`, which is literally `privacy.public?`
|
||||
/// — `true` is public, and `false` is unlisted *or* private with no way to
|
||||
/// tell the two apart over the API. `nil` where the backend has no
|
||||
/// visibility concept at all, or did not answer with one.
|
||||
let isListed: Bool?
|
||||
|
||||
init(playlist: Playlist, entries: [RemotePlaylistEntry], isListed: Bool? = nil) {
|
||||
self.playlist = playlist
|
||||
self.entries = entries
|
||||
self.isListed = isListed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user