mirror of
https://github.com/yattee/yattee.git
synced 2025-12-07 16:48:15 +00:00
Fix tvOS build compatibility for Menu with primaryAction
Add availability check for tvOS 17.0+ when using Menu with primaryAction parameter. Falls back to simple Button for tvOS 15.0-16.x to maintain backward compatibility with the deployment target.
This commit is contained in:
@@ -223,21 +223,37 @@ struct FeedView: View {
|
|||||||
var header: some View {
|
var header: some View {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
Menu {
|
if #available(tvOS 17.0, *) {
|
||||||
accountsPicker
|
Menu {
|
||||||
} label: {
|
accountsPicker
|
||||||
Label("Channels", systemImage: "filemenu.and.selection")
|
} label: {
|
||||||
.labelStyle(.iconOnly)
|
Label("Channels", systemImage: "filemenu.and.selection")
|
||||||
.imageScale(.small)
|
.labelStyle(.iconOnly)
|
||||||
.font(.caption)
|
.imageScale(.small)
|
||||||
} primaryAction: {
|
.font(.caption)
|
||||||
withAnimation {
|
} primaryAction: {
|
||||||
self.feedChannelsViewVisible = true
|
withAnimation {
|
||||||
self.focusedChannel = selectedChannel?.id ?? "all"
|
self.feedChannelsViewVisible = true
|
||||||
|
self.focusedChannel = selectedChannel?.id ?? "all"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.opacity(feedChannelsViewVisible ? 0 : 1)
|
||||||
|
.frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil)
|
||||||
|
} else {
|
||||||
|
Button {
|
||||||
|
withAnimation {
|
||||||
|
self.feedChannelsViewVisible = true
|
||||||
|
self.focusedChannel = selectedChannel?.id ?? "all"
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label("Channels", systemImage: "filemenu.and.selection")
|
||||||
|
.labelStyle(.iconOnly)
|
||||||
|
.imageScale(.small)
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
|
.opacity(feedChannelsViewVisible ? 0 : 1)
|
||||||
|
.frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil)
|
||||||
}
|
}
|
||||||
.opacity(feedChannelsViewVisible ? 0 : 1)
|
|
||||||
.frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil)
|
|
||||||
channelHeaderView
|
channelHeaderView
|
||||||
if selectedChannel == nil {
|
if selectedChannel == nil {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|||||||
Reference in New Issue
Block a user