home: disable context menu on Big Sur

Due to various SwiftUI issues that only occur on Big Sur, we will just
disable the context menu to avoid showing broken UI.

Users should use the toolbar for the same actions.

Resolves #5147
This commit is contained in:
osy 2023-08-01 21:06:23 -07:00
parent c0e470df59
commit c5bbf2e7eb
1 changed files with 28 additions and 0 deletions

View File

@ -24,6 +24,34 @@ struct VMContextMenuModifier: ViewModifier {
@State private var shareItem: VMShareItemModifier.ShareItem?
func body(content: Content) -> some View {
#if os(macOS)
if #unavailable(macOS 12) {
bodyBigSur(content: content)
} else {
bodyFull(content: content)
}
#else
return bodyFull(content: content)
#endif
}
#if os(macOS)
@ViewBuilder func bodyBigSur(content: Content) -> some View {
content.contextMenu {
Button {
NSWorkspace.shared.activateFileViewerSelecting([vm.pathUrl])
} label: {
Label("Show in Finder", systemImage: "folder")
}
}
}
#endif
/// Full context menu for anything other than Big Sur
/// - Parameter content: Content
/// - Returns: View
@available(macOS 12, *)
@ViewBuilder func bodyFull(content: Content) -> some View {
content.contextMenu {
#if os(macOS)
Button {