macOS: Fix compilation
This commit is contained in:
parent
83dad76b82
commit
107c4b0d72
|
@ -1329,7 +1329,7 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = Gemini/Gemini.entitlements;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Gemini/Preview Content\"";
|
||||
|
@ -1355,7 +1355,7 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = Gemini/Gemini.entitlements;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Gemini/Preview Content\"";
|
||||
|
|
|
@ -108,8 +108,8 @@ extension BrowserWindowController: NSToolbarDelegate {
|
|||
item.label = "Go Back"
|
||||
item.paletteLabel = "Go Back"
|
||||
item.toolTip = "Go to the previous page"
|
||||
item.target = navigator
|
||||
item.action = #selector(NavigationManager.back)
|
||||
item.target = self
|
||||
item.action = #selector(back)
|
||||
item.isBordered = true
|
||||
if #available(macOS 10.16, *) {
|
||||
item.isNavigational = true
|
||||
|
@ -127,8 +127,8 @@ extension BrowserWindowController: NSToolbarDelegate {
|
|||
item.label = "Go Forward"
|
||||
item.paletteLabel = "Go Forward"
|
||||
item.toolTip = "Go to the next page"
|
||||
item.target = navigator
|
||||
item.action = #selector(NavigationManager.forward)
|
||||
item.target = self
|
||||
item.action = #selector(forward)
|
||||
item.isBordered = true
|
||||
if #available(macOS 10.16, *) {
|
||||
item.isNavigational = true
|
||||
|
@ -136,14 +136,22 @@ extension BrowserWindowController: NSToolbarDelegate {
|
|||
return item
|
||||
}
|
||||
|
||||
@objc private func back() {
|
||||
navigator.back()
|
||||
}
|
||||
|
||||
@objc private func forward() {
|
||||
navigator.forward()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension NavigationManager: NSToolbarItemValidation {
|
||||
extension BrowserWindowController: NSToolbarItemValidation {
|
||||
public func validateToolbarItem(_ item: NSToolbarItem) -> Bool {
|
||||
if item.itemIdentifier == .goBack {
|
||||
return !backStack.isEmpty
|
||||
return !navigator.backStack.isEmpty
|
||||
} else if item.itemIdentifier == .goForward {
|
||||
return !forwardStack.isEmpty
|
||||
return !navigator.forwardStack.isEmpty
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -72,8 +72,7 @@ struct RenderingBlockView: View {
|
|||
self.changeURL?(url)
|
||||
} label: {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 4) {
|
||||
Image(systemName: imageName)
|
||||
.frame(minWidth: 23, alignment: .leading)
|
||||
maybeLinkImage(name: imageName)
|
||||
|
||||
Text(verbatim: text)
|
||||
.font(.documentBody)
|
||||
|
@ -90,6 +89,15 @@ struct RenderingBlockView: View {
|
|||
return button.maybeHelp(url.absoluteString)
|
||||
}
|
||||
|
||||
private func maybeLinkImage(name: String) -> AnyView {
|
||||
// can't use availability check inside view body, since buildLimitedAvailability was introduced in iOS 14 :/
|
||||
if #available(iOS 13.0, macOS 11.0, *) {
|
||||
return AnyView(Image(systemName: name).frame(minWidth: 23, alignment: .leading))
|
||||
} else {
|
||||
return AnyView(EmptyView())
|
||||
}
|
||||
}
|
||||
|
||||
private func preformatted(_ text: String) -> some View {
|
||||
ScrollView(.horizontal) {
|
||||
Text(verbatim: text)
|
||||
|
|
Loading…
Reference in New Issue