Add playlists actions to related view

This commit is contained in:
Arkadiusz Fal 2022-06-26 13:31:26 +02:00
parent b6a157eda9
commit 72ec6094bc

View File

@ -10,6 +10,8 @@ struct PlayerQueueView: View {
var watches: FetchedResults<Watch> var watches: FetchedResults<Watch>
@EnvironmentObject<AccountsModel> private var accounts @EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlaylistsModel> private var playlists
@EnvironmentObject<PlayerModel> private var player @EnvironmentObject<PlayerModel> private var player
@Default(.saveHistory) private var saveHistory @Default(.saveHistory) private var saveHistory
@ -105,6 +107,24 @@ struct PlayerQueueView: View {
} label: { } label: {
Label("Play Last", systemImage: "text.append") 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")
}
}
}
}
} }
} }
} }