From 67e32f4da1e1209bf3d7c5920f531b41ffdffe1c Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Wed, 14 Dec 2022 18:10:50 +0100 Subject: [PATCH] Fix channel links --- Shared/Channels/ChannelAvatarView.swift | 2 +- Shared/Channels/ChannelLinkView.swift | 3 ++- Shared/Navigation/AppSidebarRecents.swift | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Shared/Channels/ChannelAvatarView.swift b/Shared/Channels/ChannelAvatarView.swift index 61849f4b..9e9ff81f 100644 --- a/Shared/Channels/ChannelAvatarView.swift +++ b/Shared/Channels/ChannelAvatarView.swift @@ -13,7 +13,7 @@ struct ChannelAvatarView: View { ZStack(alignment: .bottomTrailing) { Group { Group { - if let url = channel?.thumbnailURL { + if let url = channel?.thumbnailURLOrCached { ThumbnailView(url: url) } else { ZStack { diff --git a/Shared/Channels/ChannelLinkView.swift b/Shared/Channels/ChannelLinkView.swift index fe171ab1..30f92ae6 100644 --- a/Shared/Channels/ChannelLinkView.swift +++ b/Shared/Channels/ChannelLinkView.swift @@ -6,6 +6,7 @@ struct ChannelLinkView: View { let channelLabel: ChannelLabel @Environment(\.inChannelView) private var inChannelView + @Environment(\.inNavigationView) private var inNavigationView @Environment(\.navigationStyle) private var navigationStyle init( @@ -25,7 +26,7 @@ struct ChannelLinkView: View { #if os(tvOS) channelLabel #else - if navigationStyle == .tab { + if navigationStyle == .tab, inNavigationView { channelNavigationLink } else { channelButton diff --git a/Shared/Navigation/AppSidebarRecents.swift b/Shared/Navigation/AppSidebarRecents.swift index 4b2d7995..79287492 100644 --- a/Shared/Navigation/AppSidebarRecents.swift +++ b/Shared/Navigation/AppSidebarRecents.swift @@ -70,8 +70,18 @@ struct RecentNavigationLink: View { destination } label: { HStack { - Label(recent.title, systemImage: labelSystemImage) - .lineLimit(1) + if recent.type == .channel, + let channel = recent.channel, + channel.thumbnailURLOrCached != nil + { + ChannelAvatarView(channel: channel, subscribedBadge: false) + .frame(width: 20, height: 20) + + Text(channel.name) + } else { + Label(recent.title, systemImage: labelSystemImage) + .lineLimit(1) + } Spacer()