From 820d5ce962aa91d2bc47ac76a4a8e4ab4e521268 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 26 Jun 2022 13:31:26 +0200 Subject: [PATCH] Add playlists actions to related view --- Shared/Player/PlayerQueueView.swift | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Shared/Player/PlayerQueueView.swift b/Shared/Player/PlayerQueueView.swift index f6d086d1..05e7d284 100644 --- a/Shared/Player/PlayerQueueView.swift +++ b/Shared/Player/PlayerQueueView.swift @@ -10,6 +10,8 @@ struct PlayerQueueView: View { var watches: FetchedResults @EnvironmentObject private var accounts + @EnvironmentObject private var navigation + @EnvironmentObject private var playlists @EnvironmentObject private var player @Default(.saveHistory) private var saveHistory @@ -105,6 +107,24 @@ struct PlayerQueueView: View { } label: { Label("Play Last", systemImage: "text.append") } + + if accounts.app.supportsUserPlaylists && accounts.signedIn { + Section { + Button { + navigation.presentAddToPlaylist(video) + } label: { + Label("Add to playlist...", systemImage: "text.badge.plus") + } + + if let playlist = playlists.lastUsed { + Button { + playlists.addVideo(playlistID: playlist.id, videoID: video.videoID, navigation: navigation) + } label: { + Label("Add to \(playlist.title)", systemImage: "text.badge.star") + } + } + } + } } } }