tvOS History improvements

This commit is contained in:
Arkadiusz Fal
2021-10-14 00:05:19 +02:00
parent 70c089e696
commit 2c275d9353
4 changed files with 42 additions and 9 deletions

View File

@@ -127,6 +127,16 @@ extension PlayerModel {
}
}
func playHistory(_ item: PlayerQueueItem) {
let newItem = enqueueVideo(item.video, prepending: true)
advanceToItem(newItem!)
if let historyItemIndex = history.firstIndex(of: item) {
history.remove(at: historyItemIndex)
}
}
@discardableResult func removeHistory(_ item: PlayerQueueItem) -> PlayerQueueItem? {
if let index = history.firstIndex(where: { $0 == item }) {
return history.remove(at: index)