From 16e365ce6c662787eddc7ec492d152ae364dbbf2 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 19 Dec 2022 13:45:41 +0100 Subject: [PATCH] Minor improvements --- Model/HistoryModel.swift | 2 -- Model/Player/PlayerModel.swift | 4 ++++ Model/WatchNextViewModel.swift | 2 +- Shared/Modifiers/PlayerOverlayModifier.swift | 20 +++++++++---------- Shared/Navigation/AppSidebarNavigation.swift | 2 +- .../Player/Video Details/VideoDetails.swift | 3 ++- Shared/Player/WatchNextView.swift | 3 ++- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Model/HistoryModel.swift b/Model/HistoryModel.swift index 14653419..4d651767 100644 --- a/Model/HistoryModel.swift +++ b/Model/HistoryModel.swift @@ -91,8 +91,6 @@ extension PlayerModel { watch.watchedAt = Date() try? self.backgroundContext.save() - - FeedModel.shared.calculateUnwatchedFeed() } } diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 38a8f113..8ac65efc 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -664,6 +664,10 @@ final class PlayerModel: ObservableObject { } func handleCurrentItemChange() { + if currentItem == nil { + FeedModel.shared.calculateUnwatchedFeed() + } + #if os(macOS) Windows.player.window?.title = windowTitle #endif diff --git a/Model/WatchNextViewModel.swift b/Model/WatchNextViewModel.swift index 6e9e9171..00c5f6f3 100644 --- a/Model/WatchNextViewModel.swift +++ b/Model/WatchNextViewModel.swift @@ -35,7 +35,7 @@ final class WatchNextViewModel: ObservableObject { static let shared = WatchNextViewModel() @Published var item: PlayerQueueItem? - @Published private(set) var isPresenting = true + @Published private(set) var isPresenting = false @Published var reason: PresentationReason? @Published var page = Page.queue diff --git a/Shared/Modifiers/PlayerOverlayModifier.swift b/Shared/Modifiers/PlayerOverlayModifier.swift index 4932e27c..5bfd794f 100644 --- a/Shared/Modifiers/PlayerOverlayModifier.swift +++ b/Shared/Modifiers/PlayerOverlayModifier.swift @@ -21,19 +21,17 @@ struct PlayerOverlayModifier: ViewModifier { @ViewBuilder var overlay: some View { Group { - if player.videoForDisplay != nil { - ControlsBar(fullScreen: .constant(false), expansionState: $expansionState, playerBar: true) - .offset(x: expansionState == .mini && !controlsWhenMinimized ? 10 : 0, y: 0) - .transition(.opacity) - .frame(maxWidth: maxWidth, alignment: .trailing) - .onAppear { - if playerButtonIsExpanded { - expansionState = .full - } + ControlsBar(fullScreen: .constant(false), expansionState: $expansionState, playerBar: true) + .offset(x: expansionState == .mini && !controlsWhenMinimized ? 10 : 0, y: 0) + .frame(maxWidth: maxWidth, alignment: .trailing) + .onAppear { + if playerButtonIsExpanded { + expansionState = .full } - } + } + .animation(.easeIn, value: player.videoForDisplay) + .opacity(player.videoForDisplay == nil ? 0 : 1) } - .animation(.default, value: player.currentItem) } var maxWidth: Double { diff --git a/Shared/Navigation/AppSidebarNavigation.swift b/Shared/Navigation/AppSidebarNavigation.swift index 30af65c2..70e7e8a8 100644 --- a/Shared/Navigation/AppSidebarNavigation.swift +++ b/Shared/Navigation/AppSidebarNavigation.swift @@ -76,7 +76,7 @@ struct AppSidebarNavigation: View { } } - ToolbarItemGroup { + ToolbarItemGroup(placement: accountsMenuToolbarItemPlacement) { AccountViewButton() } diff --git a/Shared/Player/Video Details/VideoDetails.swift b/Shared/Player/Video Details/VideoDetails.swift index 30facef3..cbeeff04 100644 --- a/Shared/Player/Video Details/VideoDetails.swift +++ b/Shared/Player/Video Details/VideoDetails.swift @@ -120,6 +120,7 @@ struct VideoDetails: View { } .modifier(SettingsPickerModifier()) .offset(x: 15, y: 5) + .opacity(descriptionVisibility ? 1 : 0) #endif } @@ -214,7 +215,7 @@ struct VideoDetails: View { ) ) .zIndex(0) - .frame(maxHeight: 15) + .frame(maxHeight: 25) #endif } } diff --git a/Shared/Player/WatchNextView.swift b/Shared/Player/WatchNextView.swift index b6ae1d85..8276f750 100644 --- a/Shared/Player/WatchNextView.swift +++ b/Shared/Player/WatchNextView.swift @@ -20,6 +20,7 @@ struct WatchNextView: View { } } } + .navigationViewStyle(.stack) #else VStack { HStack { @@ -221,7 +222,7 @@ struct WatchNextView: View { Divider() } - let queueForMoreVideos = player.queue.isEmpty ? [] : player.queue.suffix(from: player.playbackMode == .queue ? 1 : 0) + let queueForMoreVideos = player.queue.isEmpty ? [] : player.queue.suffix(from: player.playbackMode == .queue && model.isAutoplaying && model.canAutoplay ? 1 : 0) if (model.isAutoplaying && model.canAutoplay && !queueForMoreVideos.isEmpty) || (!model.isAutoplaying && !queueForMoreVideos.isEmpty)