mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Allow to add videos only to user created playlists
This commit is contained in:
parent
8c2ffa1b99
commit
d01b0f8275
@ -634,10 +634,12 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
||||
}
|
||||
|
||||
private func extractPlaylist(from content: JSON) -> Playlist {
|
||||
.init(
|
||||
id: content["playlistId"].stringValue,
|
||||
let id = content["playlistId"].stringValue
|
||||
return Playlist(
|
||||
id: id,
|
||||
title: content["title"].stringValue,
|
||||
visibility: content["isListed"].boolValue ? .public : .private,
|
||||
editable: id.starts(with: "IV"),
|
||||
updated: content["updated"].doubleValue,
|
||||
videos: content["videos"].arrayValue.map { extractVideo(from: $0) }
|
||||
)
|
||||
|
@ -17,15 +17,17 @@ struct Playlist: Identifiable, Equatable, Hashable {
|
||||
let id: String
|
||||
var title: String
|
||||
var visibility: Visibility
|
||||
var editable = true
|
||||
|
||||
var updated: TimeInterval?
|
||||
|
||||
var videos = [Video]()
|
||||
|
||||
init(id: String, title: String, visibility: Visibility, updated: TimeInterval? = nil, videos: [Video] = []) {
|
||||
init(id: String, title: String, visibility: Visibility, editable: Bool = true, updated: TimeInterval? = nil, videos: [Video] = []) {
|
||||
self.id = id
|
||||
self.title = title
|
||||
self.visibility = visibility
|
||||
self.editable = editable
|
||||
self.updated = updated
|
||||
self.videos = videos
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ struct AddToPlaylistView: View {
|
||||
selectPlaylistButton
|
||||
#else
|
||||
Picker("Playlist", selection: $selectedPlaylistID) {
|
||||
ForEach(model.all) { playlist in
|
||||
ForEach(model.all.filter(\.editable)) { playlist in
|
||||
Text(playlist.title).tag(playlist.id)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user