diff --git a/Shared/Channels/ChannelVideosView.swift b/Shared/Channels/ChannelVideosView.swift index cbfa1199..8d86b1da 100644 --- a/Shared/Channels/ChannelVideosView.swift +++ b/Shared/Channels/ChannelVideosView.swift @@ -4,7 +4,7 @@ import Siesta import SwiftUI struct ChannelVideosView: View { - var channel: Channel? + var channel: Channel var showCloseButton = false var inNavigationView = true @@ -32,7 +32,7 @@ struct ChannelVideosView: View { @Default(.expandChannelDescription) private var expandChannelDescription var presentedChannel: Channel? { - store.item?.channel ?? channel ?? recents.presentedChannel + store.item?.channel ?? channel } var contentItems: [ContentItem] { @@ -165,10 +165,7 @@ struct ChannelVideosView: View { .onAppear { descriptionExpanded = expandChannelDescription - if let channel, - let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey), - store.item.isNil - { + if let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey), store.item.isNil { store.replace(cache) } diff --git a/Shared/Navigation/AppTabNavigation.swift b/Shared/Navigation/AppTabNavigation.swift index 1c1fb789..12f6adc0 100644 --- a/Shared/Navigation/AppTabNavigation.swift +++ b/Shared/Navigation/AppTabNavigation.swift @@ -176,9 +176,9 @@ struct AppTabNavigation: View { } @ViewBuilder private var channelView: some View { - if navigation.presentingChannel { + if navigation.presentingChannel, let channel = recents.presentedChannel { NavigationView { - ChannelVideosView(showCloseButton: true) + ChannelVideosView(channel: channel, showCloseButton: true) } .environment(\.managedObjectContext, persistenceController.container.viewContext) .environment(\.inChannelView, true) diff --git a/Shared/Subscriptions/ChannelsView.swift b/Shared/Subscriptions/ChannelsView.swift index f3070506..8899ea24 100644 --- a/Shared/Subscriptions/ChannelsView.swift +++ b/Shared/Subscriptions/ChannelsView.swift @@ -78,7 +78,7 @@ struct ChannelsView: View { } } .background( - NavigationLink(destination: ChannelVideosView(channel: channelForLink), isActive: $channelLinkActive, label: EmptyView.init) + NavigationLink(destination: ChannelVideosView(channel: channelForLink ?? Video.fixture.channel), isActive: $channelLinkActive, label: EmptyView.init) ) .onAppear { subscriptions.load()