Listing styles

This commit is contained in:
Arkadiusz Fal
2022-12-12 01:18:29 +01:00
parent c2d16774f7
commit 25da312966
19 changed files with 305 additions and 45 deletions

View File

@@ -1,3 +1,4 @@
import Defaults
import SDWebImageSwiftUI
import Siesta
import SwiftUI
@@ -27,6 +28,8 @@ struct ChannelVideosView: View {
@ObservedObject private var subscriptions = SubscribedChannelsModel.shared
@Namespace private var focusNamespace
@Default(.channelPlaylistListingStyle) private var channelPlaylistListingStyle
var presentedChannel: Channel? {
store.item ?? channel ?? recents.presentedChannel
}
@@ -56,11 +59,6 @@ struct ChannelVideosView: View {
viewsLabel
subscriptionToggleButton
if let channel = presentedChannel {
FavoriteButton(item: FavoriteItem(section: .channel(accounts.app.appType.rawValue, channel.id, channel.name)))
.labelStyle(.iconOnly)
}
}
contentTypePicker
.pickerStyle(.automatic)
@@ -72,6 +70,7 @@ struct ChannelVideosView: View {
banner
}
.environment(\.inChannelView, true)
.environment(\.listingStyle, channelPlaylistListingStyle)
#if os(tvOS)
.prefersDefaultFocus(in: focusNamespace)
#endif
@@ -100,6 +99,9 @@ struct ChannelVideosView: View {
ToolbarItem(placement: .navigation) {
thumbnail
}
ToolbarItem {
ListingStyleButtons(listingStyle: $channelPlaylistListingStyle)
}
ToolbarItem {
contentTypePicker
}
@@ -217,6 +219,8 @@ struct ChannelVideosView: View {
subscriptionToggleButton
FavoriteButton(item: FavoriteItem(section: .channel(accounts.app.appType.rawValue, channel.id, channel.name)))
}
ListingStyleButtons(listingStyle: $channelPlaylistListingStyle)
}
} label: {
HStack(spacing: 12) {