From 616886f0d225d96d813a9f405d6dcdc1eb24221a Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 26 Jun 2022 16:46:29 +0200 Subject: [PATCH] Fix updating controls buttons status --- Model/Player/PlayerModel.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index bfc12767..f2261c7d 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -51,7 +51,7 @@ final class PlayerModel: ObservableObject { @Published var availableStreams = [Stream]() { didSet { handleAvailableStreamsChange() } } @Published var streamSelection: Stream? { didSet { rebuildTVMenu() } } - @Published var queue = [PlayerQueueItem]() { didSet { Defaults[.queue] = queue } } + @Published var queue = [PlayerQueueItem]() { didSet { handleQueueChange() } } @Published var currentItem: PlayerQueueItem! { didSet { handleCurrentItemChange() } } @Published var videoBeingOpened: Video? @Published var historyVideos = [Video]() @@ -485,6 +485,12 @@ final class PlayerModel: ObservableObject { backend.closePiP(wasPlaying: wasPlaying) } + func handleQueueChange() { + Defaults[.queue] = queue + + controls.objectWillChange.send() + } + func handleCurrentItemChange() { #if os(macOS) Windows.player.window?.title = windowTitle