Minor improvements

This commit is contained in:
Arkadiusz Fal 2022-12-19 13:45:41 +01:00
parent d80929bd88
commit 16e365ce6c
7 changed files with 19 additions and 17 deletions

View File

@ -91,8 +91,6 @@ extension PlayerModel {
watch.watchedAt = Date() watch.watchedAt = Date()
try? self.backgroundContext.save() try? self.backgroundContext.save()
FeedModel.shared.calculateUnwatchedFeed()
} }
} }

View File

@ -664,6 +664,10 @@ final class PlayerModel: ObservableObject {
} }
func handleCurrentItemChange() { func handleCurrentItemChange() {
if currentItem == nil {
FeedModel.shared.calculateUnwatchedFeed()
}
#if os(macOS) #if os(macOS)
Windows.player.window?.title = windowTitle Windows.player.window?.title = windowTitle
#endif #endif

View File

@ -35,7 +35,7 @@ final class WatchNextViewModel: ObservableObject {
static let shared = WatchNextViewModel() static let shared = WatchNextViewModel()
@Published var item: PlayerQueueItem? @Published var item: PlayerQueueItem?
@Published private(set) var isPresenting = true @Published private(set) var isPresenting = false
@Published var reason: PresentationReason? @Published var reason: PresentationReason?
@Published var page = Page.queue @Published var page = Page.queue

View File

@ -21,20 +21,18 @@ struct PlayerOverlayModifier: ViewModifier {
@ViewBuilder var overlay: some View { @ViewBuilder var overlay: some View {
Group { Group {
if player.videoForDisplay != nil {
ControlsBar(fullScreen: .constant(false), expansionState: $expansionState, playerBar: true) ControlsBar(fullScreen: .constant(false), expansionState: $expansionState, playerBar: true)
.offset(x: expansionState == .mini && !controlsWhenMinimized ? 10 : 0, y: 0) .offset(x: expansionState == .mini && !controlsWhenMinimized ? 10 : 0, y: 0)
.transition(.opacity)
.frame(maxWidth: maxWidth, alignment: .trailing) .frame(maxWidth: maxWidth, alignment: .trailing)
.onAppear { .onAppear {
if playerButtonIsExpanded { if playerButtonIsExpanded {
expansionState = .full expansionState = .full
} }
} }
.animation(.easeIn, value: player.videoForDisplay)
.opacity(player.videoForDisplay == nil ? 0 : 1)
} }
} }
.animation(.default, value: player.currentItem)
}
var maxWidth: Double { var maxWidth: Double {
playerBarMaxWidth == "0" ? .infinity : (Double(playerBarMaxWidth) ?? 600) playerBarMaxWidth == "0" ? .infinity : (Double(playerBarMaxWidth) ?? 600)

View File

@ -76,7 +76,7 @@ struct AppSidebarNavigation: View {
} }
} }
ToolbarItemGroup { ToolbarItemGroup(placement: accountsMenuToolbarItemPlacement) {
AccountViewButton() AccountViewButton()
} }

View File

@ -120,6 +120,7 @@ struct VideoDetails: View {
} }
.modifier(SettingsPickerModifier()) .modifier(SettingsPickerModifier())
.offset(x: 15, y: 5) .offset(x: 15, y: 5)
.opacity(descriptionVisibility ? 1 : 0)
#endif #endif
} }
@ -214,7 +215,7 @@ struct VideoDetails: View {
) )
) )
.zIndex(0) .zIndex(0)
.frame(maxHeight: 15) .frame(maxHeight: 25)
#endif #endif
} }
} }

View File

@ -20,6 +20,7 @@ struct WatchNextView: View {
} }
} }
} }
.navigationViewStyle(.stack)
#else #else
VStack { VStack {
HStack { HStack {
@ -221,7 +222,7 @@ struct WatchNextView: View {
Divider() 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) || if (model.isAutoplaying && model.canAutoplay && !queueForMoreVideos.isEmpty) ||
(!model.isAutoplaying && !queueForMoreVideos.isEmpty) (!model.isAutoplaying && !queueForMoreVideos.isEmpty)