diff --git a/Model/NavigationModel.swift b/Model/NavigationModel.swift index cd4a9ac6..0f1d48b6 100644 --- a/Model/NavigationModel.swift +++ b/Model/NavigationModel.swift @@ -78,7 +78,7 @@ final class NavigationModel: ObservableObject { return } - navigation.presentingPlaylist = false + player.presentingPlayer = false navigation.presentingChannel = false let recent = RecentItem(from: channel) @@ -116,7 +116,6 @@ final class NavigationModel: ObservableObject { navigationStyle: NavigationStyle, delay: Bool = false ) { - navigation.presentingChannel = false navigation.presentingPlaylist = false let recent = RecentItem(from: playlist) diff --git a/Model/Store.swift b/Model/Store.swift index 08e3e7f3..479ad1c7 100644 --- a/Model/Store.swift +++ b/Model/Store.swift @@ -22,4 +22,8 @@ final class Store: ResourceObserver, ObservableObject { func replace(_ items: Data) { all = items } + + func clear() { + all = nil + } } diff --git a/Shared/Navigation/AppTabNavigation.swift b/Shared/Navigation/AppTabNavigation.swift index 1a444f60..26b2cdfb 100644 --- a/Shared/Navigation/AppTabNavigation.swift +++ b/Shared/Navigation/AppTabNavigation.swift @@ -43,8 +43,8 @@ struct AppTabNavigation: View { searchNavigationView } .id(accounts.current?.id ?? "") - .overlay(channelView) .overlay(playlistView) + .overlay(channelView) .environment(\.navigationStyle, .tab) } diff --git a/Shared/Views/ChannelPlaylistView.swift b/Shared/Views/ChannelPlaylistView.swift index 68176da9..8fa26809 100644 --- a/Shared/Views/ChannelPlaylistView.swift +++ b/Shared/Views/ChannelPlaylistView.swift @@ -30,7 +30,7 @@ struct ChannelPlaylistView: View { } private var presentedPlaylist: ChannelPlaylist? { - recents.presentedPlaylist ?? playlist + playlist ?? recents.presentedPlaylist } private var resource: Resource? { @@ -54,6 +54,7 @@ struct ChannelPlaylistView: View { #if os(iOS) .onChange(of: navigation.presentingPlaylist) { newValue in if newValue { + store.clear() viewVerticalOffset = 0 resource?.load() } else { @@ -61,6 +62,7 @@ struct ChannelPlaylistView: View { } } .offset(y: viewVerticalOffset) + .opacity(viewVerticalOffset == Self.hiddenOffset ? 0 : 1) .animation(.easeIn(duration: 0.2), value: viewVerticalOffset) #endif } else { diff --git a/Shared/Views/ChannelVideosView.swift b/Shared/Views/ChannelVideosView.swift index d666323b..1d957244 100644 --- a/Shared/Views/ChannelVideosView.swift +++ b/Shared/Views/ChannelVideosView.swift @@ -33,7 +33,7 @@ struct ChannelVideosView: View { @Namespace private var focusNamespace var presentedChannel: Channel? { - recents.presentedChannel ?? channel + channel ?? recents.presentedChannel } var videos: [ContentItem] { @@ -50,13 +50,15 @@ struct ChannelVideosView: View { #if os(iOS) .onChange(of: navigation.presentingChannel) { newValue in if newValue { - resource?.load() + store.clear() viewVerticalOffset = 0 + resource?.load() } else { viewVerticalOffset = Self.hiddenOffset } } .offset(y: viewVerticalOffset) + .opacity(viewVerticalOffset == Self.hiddenOffset ? 0 : 1) .animation(.easeIn(duration: 0.2), value: viewVerticalOffset) #endif } else {