mirror of
https://github.com/yattee/yattee.git
synced 2025-04-27 23:40:35 +05:30
Simplify channels view
This commit is contained in:
parent
c6cff4dee4
commit
be2e4acedd
@ -4,7 +4,7 @@ import Siesta
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct ChannelVideosView: View {
|
struct ChannelVideosView: View {
|
||||||
var channel: Channel?
|
var channel: Channel
|
||||||
var showCloseButton = false
|
var showCloseButton = false
|
||||||
var inNavigationView = true
|
var inNavigationView = true
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ struct ChannelVideosView: View {
|
|||||||
@Default(.expandChannelDescription) private var expandChannelDescription
|
@Default(.expandChannelDescription) private var expandChannelDescription
|
||||||
|
|
||||||
var presentedChannel: Channel? {
|
var presentedChannel: Channel? {
|
||||||
store.item?.channel ?? channel ?? recents.presentedChannel
|
store.item?.channel ?? channel
|
||||||
}
|
}
|
||||||
|
|
||||||
var contentItems: [ContentItem] {
|
var contentItems: [ContentItem] {
|
||||||
@ -165,10 +165,7 @@ struct ChannelVideosView: View {
|
|||||||
.onAppear {
|
.onAppear {
|
||||||
descriptionExpanded = expandChannelDescription
|
descriptionExpanded = expandChannelDescription
|
||||||
|
|
||||||
if let channel,
|
if let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey), store.item.isNil {
|
||||||
let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey),
|
|
||||||
store.item.isNil
|
|
||||||
{
|
|
||||||
store.replace(cache)
|
store.replace(cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,9 +176,9 @@ struct AppTabNavigation: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder private var channelView: some View {
|
@ViewBuilder private var channelView: some View {
|
||||||
if navigation.presentingChannel {
|
if navigation.presentingChannel, let channel = recents.presentedChannel {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
ChannelVideosView(showCloseButton: true)
|
ChannelVideosView(channel: channel, showCloseButton: true)
|
||||||
}
|
}
|
||||||
.environment(\.managedObjectContext, persistenceController.container.viewContext)
|
.environment(\.managedObjectContext, persistenceController.container.viewContext)
|
||||||
.environment(\.inChannelView, true)
|
.environment(\.inChannelView, true)
|
||||||
|
@ -78,7 +78,7 @@ struct ChannelsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.background(
|
.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 {
|
.onAppear {
|
||||||
subscriptions.load()
|
subscriptions.load()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user