From 7af53a04ce23a72fbc87d9134f236a40e6315684 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 2 Sep 2022 15:11:20 +0200 Subject: [PATCH] Fixed controls bar model --- Shared/Views/ControlsBar.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Shared/Views/ControlsBar.swift b/Shared/Views/ControlsBar.swift index bf9e2b63..4955a56f 100644 --- a/Shared/Views/ControlsBar.swift +++ b/Shared/Views/ControlsBar.swift @@ -18,6 +18,8 @@ struct ControlsBar: View { @EnvironmentObject private var recents @EnvironmentObject private var subscriptions + @ObservedObject private var controls = PlayerControlsModel.shared + var presentingControls = true var backgroundEnabled = true var borderTop = true @@ -33,7 +35,7 @@ struct ControlsBar: View { detailsButton if presentingControls { - controls + controlsView .frame(maxWidth: 120) } } @@ -66,7 +68,7 @@ struct ControlsBar: View { } else if detailsToggleFullScreen { Button { controlsOverlayModel.presenting = false - model.controls.presentingControls = false + controls.presentingControls = false withAnimation { fullScreen.toggle() } @@ -82,10 +84,10 @@ struct ControlsBar: View { } } - var controls: some View { + var controlsView: some View { HStack(spacing: 4) { Group { - if model.controls.isPlaying { + if controls.isPlaying { Button(action: { model.pause() }) { @@ -105,7 +107,7 @@ struct ControlsBar: View { } } } - .disabled(model.controls.isLoadingVideo || model.currentItem.isNil) + .disabled(controls.isLoadingVideo || model.currentItem.isNil) Button(action: { model.advanceToNextItem() }) { Label("Next", systemImage: "forward.fill")