From f8ca23308d03c234d69969148abc828c96ade0b7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 17 Apr 2026 04:05:56 +0200 Subject: [PATCH] Show grid columns option in view options on tvOS Expose the grid columns picker in SubscriptionsView and ManageChannelsView inline sheets, and track viewWidth in ChannelView's tvOS GeometryReaders so the shared ViewOptionsSheet can compute a meaningful column range. --- Yattee/Views/Channel/ChannelView.swift | 6 ++++++ Yattee/Views/Subscriptions/ManageChannelsView.swift | 10 ++++++++-- Yattee/Views/Subscriptions/SubscriptionsView.swift | 10 ++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Yattee/Views/Channel/ChannelView.swift b/Yattee/Views/Channel/ChannelView.swift index b019daa2..5096469b 100644 --- a/Yattee/Views/Channel/ChannelView.swift +++ b/Yattee/Views/Channel/ChannelView.swift @@ -525,6 +525,9 @@ struct ChannelView: View { } .padding(.horizontal, 60) .padding(.vertical, 40) + .onChange(of: geometry.size.width, initial: true) { _, newWidth in + viewWidth = newWidth + } } .confirmationDialog( String(localized: "channel.unsubscribe.confirmation.title"), @@ -732,6 +735,9 @@ struct ChannelView: View { } .padding(.horizontal, 60) .padding(.vertical, 40) + .onChange(of: geometry.size.width, initial: true) { _, newWidth in + viewWidth = newWidth + } } } #endif diff --git a/Yattee/Views/Subscriptions/ManageChannelsView.swift b/Yattee/Views/Subscriptions/ManageChannelsView.swift index 0a9b03bc..390eeb8d 100644 --- a/Yattee/Views/Subscriptions/ManageChannelsView.swift +++ b/Yattee/Views/Subscriptions/ManageChannelsView.swift @@ -143,15 +143,21 @@ struct ManageChannelsView: View { } // Grid-specific options - #if !os(tvOS) if layout == .grid { + #if os(tvOS) + Picker("viewOptions.columns.header", selection: $gridColumns) { + ForEach(1...max(1, gridConfig.maxColumns), id: \.self) { count in + Text("\(count)").tag(count) + } + } + #else Stepper( "viewOptions.columns \(min(max(1, gridColumns), gridConfig.maxColumns))", value: $gridColumns, in: 1...gridConfig.maxColumns ) + #endif } - #endif Picker("manageChannels.sortBy", selection: $sortOrder) { Text("manageChannels.sortBy.name").tag(SidebarChannelSort.alphabetical) diff --git a/Yattee/Views/Subscriptions/SubscriptionsView.swift b/Yattee/Views/Subscriptions/SubscriptionsView.swift index fe1d74a0..ddfe2f91 100644 --- a/Yattee/Views/Subscriptions/SubscriptionsView.swift +++ b/Yattee/Views/Subscriptions/SubscriptionsView.swift @@ -292,15 +292,21 @@ struct SubscriptionsView: View { } // Grid-specific options - #if !os(tvOS) if layout == .grid { + #if os(tvOS) + Picker("viewOptions.columns.header", selection: $gridColumns) { + ForEach(1...max(1, gridConfig.maxColumns), id: \.self) { count in + Text("\(count)").tag(count) + } + } + #else Stepper( "viewOptions.columns \(min(max(1, gridColumns), gridConfig.maxColumns))", value: $gridColumns, in: 1...gridConfig.maxColumns ) + #endif } - #endif Toggle("viewOptions.hideWatched", isOn: $hideWatched)