mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Video details changes and channel sheet
This commit is contained in:
@@ -84,6 +84,9 @@ final class NavigationModel: ObservableObject {
|
||||
@Published var presentingAccounts = false
|
||||
@Published var presentingWelcomeScreen = false
|
||||
|
||||
@Published var presentingChannelSheet = false
|
||||
@Published var channelPresentedInSheet: Channel!
|
||||
|
||||
@Published var presentingShareSheet = false
|
||||
@Published var shareURL: URL?
|
||||
|
||||
@@ -103,7 +106,6 @@ final class NavigationModel: ObservableObject {
|
||||
|
||||
hideKeyboard()
|
||||
let presentingPlayer = player.presentingPlayer
|
||||
player.hide()
|
||||
presentingChannel = false
|
||||
|
||||
#if os(macOS)
|
||||
@@ -113,20 +115,30 @@ final class NavigationModel: ObservableObject {
|
||||
let recent = RecentItem(from: channel)
|
||||
recents.add(RecentItem(from: channel))
|
||||
|
||||
if navigationStyle == .sidebar {
|
||||
sidebarSectionChanged.toggle()
|
||||
tabSelection = .recentlyOpened(recent.tag)
|
||||
} else {
|
||||
var delay = 0.0
|
||||
let navigateToChannel = {
|
||||
#if os(iOS)
|
||||
if presentingPlayer { delay = 1.0 }
|
||||
self.player.hide()
|
||||
#endif
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
|
||||
|
||||
if navigationStyle == .sidebar {
|
||||
self.sidebarSectionChanged.toggle()
|
||||
self.tabSelection = .recentlyOpened(recent.tag)
|
||||
} else {
|
||||
withAnimation(Constants.overlayAnimation) {
|
||||
self.presentingChannel = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
if presentingPlayer {
|
||||
presentChannelInSheet(channel)
|
||||
} else {
|
||||
navigateToChannel()
|
||||
}
|
||||
#else
|
||||
navigateToChannel()
|
||||
#endif
|
||||
}
|
||||
|
||||
func openChannelPlaylist(_ playlist: ChannelPlaylist, navigationStyle: NavigationStyle) {
|
||||
@@ -273,6 +285,11 @@ final class NavigationModel: ObservableObject {
|
||||
shareURL = url
|
||||
presentingShareSheet = true
|
||||
}
|
||||
|
||||
func presentChannelInSheet(_ channel: Channel) {
|
||||
channelPresentedInSheet = channel
|
||||
presentingChannelSheet = true
|
||||
}
|
||||
}
|
||||
|
||||
typealias TabSelection = NavigationModel.TabSelection
|
||||
|
@@ -108,6 +108,7 @@ struct OpenVideosModel {
|
||||
)
|
||||
|
||||
WatchNextViewModel.shared.hide()
|
||||
NavigationModel.shared.presentingChannelSheet = false
|
||||
|
||||
if playbackMode == .playNow || playbackMode == .shuffleAll {
|
||||
#if os(iOS)
|
||||
|
@@ -335,6 +335,7 @@ final class PlayerModel: ObservableObject {
|
||||
videoBeingOpened = video
|
||||
|
||||
WatchNextViewModel.shared.hide()
|
||||
navigation.presentingChannelSheet = false
|
||||
|
||||
var changeBackendHandler: (() -> Void)?
|
||||
|
||||
|
@@ -15,6 +15,8 @@ extension PlayerModel {
|
||||
|
||||
func play(_ videos: [Video], shuffling: Bool = false) {
|
||||
WatchNextViewModel.shared.hide()
|
||||
navigation.presentingChannelSheet = false
|
||||
|
||||
playbackMode = shuffling ? .shuffle : .queue
|
||||
|
||||
videos.forEach { enqueueVideo($0, loadDetails: false) }
|
||||
@@ -33,6 +35,8 @@ extension PlayerModel {
|
||||
}
|
||||
|
||||
func playNow(_ video: Video, at time: CMTime? = nil) {
|
||||
navigation.presentingChannelSheet = false
|
||||
|
||||
if playingInPictureInPicture, closePiPOnNavigation {
|
||||
closePiP()
|
||||
}
|
||||
@@ -56,6 +60,7 @@ extension PlayerModel {
|
||||
comments.reset()
|
||||
stream = nil
|
||||
WatchNextViewModel.shared.hide()
|
||||
navigation.presentingChannelSheet = false
|
||||
|
||||
withAnimation {
|
||||
aspectRatio = VideoPlayerView.defaultAspectRatio
|
||||
@@ -176,6 +181,7 @@ extension PlayerModel {
|
||||
remove(newItem)
|
||||
|
||||
WatchNextViewModel.shared.hide()
|
||||
navigation.presentingChannelSheet = false
|
||||
currentItem = newItem
|
||||
currentItem.playbackTime = time
|
||||
|
||||
@@ -219,9 +225,12 @@ extension PlayerModel {
|
||||
let item = PlayerQueueItem(video, playbackTime: atTime)
|
||||
|
||||
if play {
|
||||
navigation.presentingChannelSheet = false
|
||||
|
||||
withAnimation {
|
||||
aspectRatio = VideoPlayerView.defaultAspectRatio
|
||||
WatchNextViewModel.shared.hide()
|
||||
navigation.presentingChannelSheet = false
|
||||
currentItem = item
|
||||
}
|
||||
videoBeingOpened = video
|
||||
|
Reference in New Issue
Block a user