mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 18:35:05 +00:00
Add Show Sidebar toggle to tvOS Subscriptions view
Mirrors the existing iOS/macOS option using the shared subscriptionsShowSidebar AppStorage key. When the sidebar is hidden the View Options button moves above the feed so it remains reachable.
This commit is contained in:
@@ -218,19 +218,27 @@ struct SubscriptionsView: View {
|
|||||||
ZStack {
|
ZStack {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
HStack(alignment: .top, spacing: 24) {
|
HStack(alignment: .top, spacing: 24) {
|
||||||
tvOSChannelsSidebar
|
if showSidebar && subscriptionsLoaded && subscriptions.count > 1 {
|
||||||
.frame(width: max(geometry.size.width * 0.28, 360), alignment: .leading)
|
tvOSChannelsSidebar
|
||||||
.focusSection()
|
.frame(width: max(geometry.size.width * 0.28, 360), alignment: .leading)
|
||||||
|
.focusSection()
|
||||||
Group {
|
}
|
||||||
switch layout {
|
|
||||||
case .list:
|
VStack(alignment: .leading, spacing: 16) {
|
||||||
listContent
|
if !showSidebar || subscriptions.count <= 1 {
|
||||||
case .grid:
|
tvOSViewOptionsButton
|
||||||
gridContent
|
}
|
||||||
}
|
|
||||||
|
Group {
|
||||||
|
switch layout {
|
||||||
|
case .list:
|
||||||
|
listContent
|
||||||
|
case .grid:
|
||||||
|
gridContent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
||||||
.focusSection()
|
.focusSection()
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
@@ -324,6 +332,8 @@ struct SubscriptionsView: View {
|
|||||||
if isIPadRegular {
|
if isIPadRegular {
|
||||||
Toggle("viewOptions.showSidebar", isOn: $showSidebar)
|
Toggle("viewOptions.showSidebar", isOn: $showSidebar)
|
||||||
}
|
}
|
||||||
|
#elseif os(tvOS)
|
||||||
|
Toggle("viewOptions.showSidebar", isOn: $showSidebar)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Layout picker (inline menu)
|
// Layout picker (inline menu)
|
||||||
@@ -702,15 +712,19 @@ struct SubscriptionsView: View {
|
|||||||
// MARK: - tvOS Channels Sidebar
|
// MARK: - tvOS Channels Sidebar
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
private var tvOSViewOptionsButton: some View {
|
||||||
|
Button {
|
||||||
|
showViewOptions = true
|
||||||
|
} label: {
|
||||||
|
Label(String(localized: "viewOptions.title"), systemImage: "slider.horizontal.3")
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
}
|
||||||
|
|
||||||
private var tvOSChannelsSidebar: some View {
|
private var tvOSChannelsSidebar: some View {
|
||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(alignment: .leading, spacing: 16) {
|
||||||
Button {
|
tvOSViewOptionsButton
|
||||||
showViewOptions = true
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
} label: {
|
|
||||||
Label(String(localized: "viewOptions.title"), systemImage: "slider.horizontal.3")
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
}
|
|
||||||
.buttonStyle(.bordered)
|
|
||||||
|
|
||||||
ScrollView(.vertical, showsIndicators: false) {
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
LazyVStack(alignment: .leading, spacing: 20) {
|
LazyVStack(alignment: .leading, spacing: 20) {
|
||||||
@@ -901,6 +915,8 @@ struct SubscriptionsView: View {
|
|||||||
return showSidebar && subscriptionsLoaded && subscriptions.count > 1
|
return showSidebar && subscriptionsLoaded && subscriptions.count > 1
|
||||||
#elseif os(iOS)
|
#elseif os(iOS)
|
||||||
return isIPadRegular && showSidebar && subscriptionsLoaded && subscriptions.count > 1
|
return isIPadRegular && showSidebar && subscriptionsLoaded && subscriptions.count > 1
|
||||||
|
#elseif os(tvOS)
|
||||||
|
return showSidebar && subscriptionsLoaded && subscriptions.count > 1
|
||||||
#else
|
#else
|
||||||
return false
|
return false
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user