diff --git a/Gemini.xcodeproj/project.pbxproj b/Gemini.xcodeproj/project.pbxproj index d1c16aa..f24c0f7 100644 --- a/Gemini.xcodeproj/project.pbxproj +++ b/Gemini.xcodeproj/project.pbxproj @@ -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\""; diff --git a/Gemini/BrowserWindowController.swift b/Gemini/BrowserWindowController.swift index c886bdf..e6f9198 100644 --- a/Gemini/BrowserWindowController.swift +++ b/Gemini/BrowserWindowController.swift @@ -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 } diff --git a/GeminiRenderer/RenderingBlockView.swift b/GeminiRenderer/RenderingBlockView.swift index 3be30ac..e4ef55d 100644 --- a/GeminiRenderer/RenderingBlockView.swift +++ b/GeminiRenderer/RenderingBlockView.swift @@ -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)