mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 13:50:32 +05:30
Restore last played item into queue only if it's not in there yet
This commit is contained in:
parent
0e1192bb03
commit
d58ec0684c
@ -198,8 +198,17 @@ extension PlayerModel {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
queue = ([Defaults[.lastPlayed]] + Defaults[.queue]).compactMap { $0 }
|
var restoredQueue = [PlayerQueueItem?]()
|
||||||
|
|
||||||
|
if let lastPlayed = Defaults[.lastPlayed],
|
||||||
|
!Defaults[.queue].contains(where: { $0.videoID == lastPlayed.videoID })
|
||||||
|
{
|
||||||
|
restoredQueue.append(lastPlayed)
|
||||||
Defaults[.lastPlayed] = nil
|
Defaults[.lastPlayed] = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
restoredQueue.append(contentsOf: Defaults[.queue])
|
||||||
|
queue = restoredQueue.compactMap { $0 }
|
||||||
|
|
||||||
queue.forEach { item in
|
queue.forEach { item in
|
||||||
accounts.api.loadDetails(item) { newItem in
|
accounts.api.loadDetails(item) { newItem in
|
||||||
|
Loading…
Reference in New Issue
Block a user