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.
This commit is contained in:
Arkadiusz Fal
2026-04-17 04:05:56 +02:00
parent cea8fcfe64
commit f8ca23308d
3 changed files with 22 additions and 4 deletions

View File

@@ -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

View File

@@ -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
}
Picker("manageChannels.sortBy", selection: $sortOrder) {
Text("manageChannels.sortBy.name").tag(SidebarChannelSort.alphabetical)

View File

@@ -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
}
Toggle("viewOptions.hideWatched", isOn: $hideWatched)