Skip to content

Commit

Permalink
fix share view dismiss on macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chien <stdrc@outlook.com>
  • Loading branch information
stdrc committed Jul 6, 2024
1 parent 0219d03 commit 11bd418
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion excerpts/Views/ShareView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Richard on 2023/9/13.
//

import Foundation
import LinkPresentation
import SwiftUI

Expand All @@ -28,6 +29,7 @@ struct ShareView: View {
@State private var isStyleMenuOpen = false
@State private var isShareMenuOpen = false

/// Only valid on iOS devices, because on macOS the menu will dismiss regardless of `.menuActionDismissBehavior(.disabled)`.
private var isMenuOpen: Bool {
self.isStyleMenuOpen || self.isShareMenuOpen
}
Expand Down Expand Up @@ -198,7 +200,7 @@ struct ShareView: View {
}
}
.overlay {
if self.isMenuOpen {
if self.isMenuOpen && !ProcessInfo.processInfo.isiOSAppOnMac {
// mask all the controls except menu
Color.gray.opacity(0.001)
.ignoresSafeArea()
Expand Down

0 comments on commit 11bd418

Please sign in to comment.