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

@@ -6,6 +6,10 @@ struct FeedView: View {
@ObservedObject private var feed = FeedModel.shared
@ObservedObject private var accounts = AccountsModel.shared
#if os(tvOS)
@Default(.subscriptionsListingStyle) private var subscriptionsListingStyle
#endif
var videos: [ContentItem] {
ContentItem.array(of: feed.videos)
}
@@ -15,6 +19,7 @@ struct FeedView: View {
HStack {
#if os(tvOS)
SubscriptionsPageButton()
ListingStyleButtons(listingStyle: $subscriptionsListingStyle)
#endif
Spacer()

View File

@@ -8,6 +8,7 @@ struct SubscriptionsView: View {
}
@Default(.subscriptionsViewPage) private var subscriptionsViewPage
@Default(.subscriptionsListingStyle) private var subscriptionsListingStyle
var body: some View {
SignInRequiredView(title: "Subscriptions".localized()) {
@@ -21,12 +22,20 @@ struct SubscriptionsView: View {
#endif
}
}
.environment(\.listingStyle, subscriptionsListingStyle)
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
subscriptionsMenu
}
}
#endif
#if os(macOS)
.toolbar {
ToolbarItem(placement: .principal) {
subscriptionsMenu
ToolbarItem {
ListingStyleButtons(listingStyle: $subscriptionsListingStyle)
}
}
#endif
@@ -40,6 +49,10 @@ struct SubscriptionsView: View {
Label("Channels", systemImage: "person.3.fill").tag(Page.channels)
}
if subscriptionsViewPage == .feed {
ListingStyleButtons(listingStyle: $subscriptionsListingStyle)
}
Section {
SettingsButtons()
}
@@ -59,6 +72,7 @@ struct SubscriptionsView: View {
var menuLabel: some View {
HStack {
Image(systemName: subscriptionsViewPage == .channels ? "person.3.fill" : "film")
.imageScale(.small)
Text(subscriptionsViewPage.rawValue.capitalized.localized())
.font(.headline)
}