mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
if #available mac
Removes if #available for anything less than macOS 11
This commit is contained in:
@@ -100,19 +100,11 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var filterActive: RSImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
return NSImage(systemSymbolName: "line.horizontal.3.decrease.circle.fill", accessibilityDescription: nil)!
|
||||
} else {
|
||||
return RSImage(named: "filterActive")!
|
||||
}
|
||||
return NSImage(systemSymbolName: "line.horizontal.3.decrease.circle.fill", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var filterInactive: RSImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
return NSImage(systemSymbolName: "line.horizontal.3.decrease.circle", accessibilityDescription: nil)!
|
||||
} else {
|
||||
return RSImage(named: "filterInactive")!
|
||||
}
|
||||
return NSImage(systemSymbolName: "line.horizontal.3.decrease.circle", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var iconLightBackgroundColor: NSColor = {
|
||||
@@ -156,14 +148,10 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var masterFolderImage: IconImage {
|
||||
if #available(macOS 11.0, *) {
|
||||
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
} else {
|
||||
return IconImage(RSImage(named: NSImage.folderName)!)
|
||||
}
|
||||
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}
|
||||
|
||||
static var markAllAsReadImage: RSImage = {
|
||||
@@ -181,35 +169,19 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var preferencesToolbarAccountsImage: RSImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
return NSImage(systemSymbolName: "at", accessibilityDescription: nil)!
|
||||
} else {
|
||||
return NSImage(named: NSImage.userAccountsName)!
|
||||
}
|
||||
return NSImage(systemSymbolName: "at", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var preferencesToolbarExtensionsImage: RSImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
return RSImage(named: "preferencesToolbarExtensions")!
|
||||
} else {
|
||||
return NSImage(contentsOfFile: "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns")!
|
||||
}
|
||||
return RSImage(named: "preferencesToolbarExtensions")!
|
||||
}()
|
||||
|
||||
static var preferencesToolbarGeneralImage: RSImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
return NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)!
|
||||
} else {
|
||||
return NSImage(named: NSImage.preferencesGeneralName)!
|
||||
}
|
||||
return NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
static var preferencesToolbarAdvancedImage: RSImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
return NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: nil)!
|
||||
} else {
|
||||
return NSImage(named: NSImage.advancedName)!
|
||||
}
|
||||
return NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: nil)!
|
||||
}()
|
||||
|
||||
@available(macOS 11.0, *)
|
||||
@@ -252,14 +224,10 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var starredFeedImage: IconImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "StarColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
} else {
|
||||
return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!, isBackgroundSupressed: true)
|
||||
}
|
||||
let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "StarColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static var timelineSeparatorColor: NSColor = {
|
||||
@@ -275,63 +243,37 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var todayFeedImage: IconImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor.orange
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
} else {
|
||||
return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!, isBackgroundSupressed: true)
|
||||
}
|
||||
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor.orange
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static var unreadFeedImage: IconImage = {
|
||||
if #available(macOS 11.0, *) {
|
||||
let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
} else {
|
||||
return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!, isBackgroundSupressed: true)
|
||||
}
|
||||
let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!
|
||||
let preferredColor = NSColor(named: "AccentColor")!
|
||||
let coloredImage = image.tinted(with: preferredColor)
|
||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||
}()
|
||||
|
||||
static var swipeMarkReadImage: RSImage = {
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
// TODO: remove swipeMarkRead asset when dropping support for macOS 10.15
|
||||
return RSImage(named: "swipeMarkRead")!
|
||||
}
|
||||
return RSImage(systemSymbolName: "circle", accessibilityDescription: "Mark Read")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
}()
|
||||
|
||||
static var swipeMarkUnreadImage: RSImage = {
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
// TODO: remove swipeMarkUnread asset when dropping support for macOS 10.15
|
||||
return RSImage(named: "swipeMarkUnread")!
|
||||
}
|
||||
return RSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: "Mark Unread")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
}()
|
||||
|
||||
static var swipeMarkStarredImage: RSImage = {
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
return RSImage(named: "swipeMarkStarred")!
|
||||
}
|
||||
return RSImage(systemSymbolName: "star.fill", accessibilityDescription: "Star")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
}()
|
||||
|
||||
static var swipeMarkUnstarredImage: RSImage = {
|
||||
if #available(OSX 11.0, *) {
|
||||
return RSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
} else {
|
||||
return RSImage(named: "swipeMarkUnstarred")!
|
||||
}
|
||||
return RSImage(systemSymbolName: "star", accessibilityDescription: "Unstar")!
|
||||
.withSymbolConfiguration(.init(scale: .large))!
|
||||
}()
|
||||
|
||||
static var starColor: NSColor = {
|
||||
|
||||
@@ -396,11 +396,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
||||
|
||||
func createMainWindowController() -> MainWindowController {
|
||||
let controller: MainWindowController
|
||||
if #available(macOS 11.0, *) {
|
||||
controller = windowControllerWithName("UnifiedWindow") as! MainWindowController
|
||||
} else {
|
||||
controller = windowControllerWithName("MainWindow") as! MainWindowController
|
||||
}
|
||||
controller = windowControllerWithName("UnifiedWindow") as! MainWindowController
|
||||
|
||||
if !(mainWindowController?.isOpen ?? false) {
|
||||
mainWindowControllers.removeAll()
|
||||
@@ -828,30 +824,20 @@ internal extension AppDelegate {
|
||||
attrs[.font] = NSFont.systemFont(ofSize: NSFont.smallSystemFontSize)
|
||||
attrs[.foregroundColor] = NSColor.textColor
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
let titleParagraphStyle = NSMutableParagraphStyle()
|
||||
titleParagraphStyle.alignment = .center
|
||||
attrs[.paragraphStyle] = titleParagraphStyle
|
||||
}
|
||||
let titleParagraphStyle = NSMutableParagraphStyle()
|
||||
titleParagraphStyle.alignment = .center
|
||||
attrs[.paragraphStyle] = titleParagraphStyle
|
||||
|
||||
let websiteText = NSMutableAttributedString()
|
||||
websiteText.append(NSAttributedString(string: NSLocalizedString("Author's Website", comment: "Author's Website"), attributes: attrs))
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
websiteText.append(NSAttributedString(string: "\n"))
|
||||
} else {
|
||||
websiteText.append(NSAttributedString(string: " "))
|
||||
}
|
||||
websiteText.append(NSAttributedString(string: "\n"))
|
||||
|
||||
attrs[.link] = theme.creatorHomePage
|
||||
websiteText.append(NSAttributedString(string: theme.creatorHomePage, attributes: attrs))
|
||||
|
||||
let textViewWidth: CGFloat
|
||||
if #available(macOS 11.0, *) {
|
||||
textViewWidth = 200
|
||||
} else {
|
||||
textViewWidth = 400
|
||||
}
|
||||
textViewWidth = 200
|
||||
|
||||
let textView = NSTextView(frame: CGRect(x: 0, y: 0, width: textViewWidth, height: 15))
|
||||
textView.isEditable = false
|
||||
|
||||
@@ -64,8 +64,6 @@ private extension BuiltinSmartFeedInspectorViewController {
|
||||
func updateUI() {
|
||||
nameTextField?.stringValue = smartFeed?.nameForDisplay ?? ""
|
||||
windowTitle = smartFeed?.nameForDisplay ?? NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
|
||||
if #available(macOS 11.0, *) {
|
||||
smartFeedImageView?.image = smartFeed?.smallIcon?.image
|
||||
}
|
||||
smartFeedImageView?.image = smartFeed?.smallIcon?.image
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,9 @@ final class FolderInspectorViewController: NSViewController, Inspector {
|
||||
override func viewDidLoad() {
|
||||
updateUI()
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
||||
folderImageView.image = image
|
||||
folderImageView.contentTintColor = NSColor.controlAccentColor
|
||||
}
|
||||
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
||||
folderImageView.image = image
|
||||
folderImageView.contentTintColor = NSColor.controlAccentColor
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
|
||||
}
|
||||
|
||||
@@ -74,26 +74,24 @@ final class DetailWebView: WKWebView {
|
||||
This code adjusts the height of the window by -1pt/+1pt,
|
||||
which puts the webview back in the correct place.
|
||||
*/
|
||||
if #available(macOS 11, *) {
|
||||
guard var frame = window?.frame else {
|
||||
return
|
||||
}
|
||||
|
||||
guard !inBigSurOffsetFix else {
|
||||
return
|
||||
}
|
||||
|
||||
inBigSurOffsetFix = true
|
||||
|
||||
defer {
|
||||
inBigSurOffsetFix = false
|
||||
}
|
||||
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
guard var frame = window?.frame else {
|
||||
return
|
||||
}
|
||||
|
||||
guard !inBigSurOffsetFix else {
|
||||
return
|
||||
}
|
||||
|
||||
inBigSurOffsetFix = true
|
||||
|
||||
defer {
|
||||
inBigSurOffsetFix = false
|
||||
}
|
||||
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1)
|
||||
window!.setFrame(frame, display: false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,20 +108,6 @@ final class DetailWebViewController: NSViewController {
|
||||
|
||||
view = webView
|
||||
|
||||
// Use the safe area layout guides if they are available.
|
||||
if #available(OSX 11.0, *) {
|
||||
// These constraints have been removed as they were unsatisfiable after removing NSBox.
|
||||
} else {
|
||||
let constraints = [
|
||||
webView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
]
|
||||
NSLayoutConstraint.activate(constraints)
|
||||
}
|
||||
|
||||
|
||||
// Hide the web view until the first reload (navigation) is complete (plus some delay) to avoid the awful white flash that happens on the initial display in dark mode.
|
||||
// See bug #901.
|
||||
webView.isHidden = true
|
||||
@@ -333,10 +319,7 @@ private extension DetailWebViewController {
|
||||
}
|
||||
|
||||
func fetchScrollInfo(_ completion: @escaping (ScrollInfo?) -> Void) {
|
||||
var javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x"
|
||||
if #available(macOS 10.15, *) {
|
||||
javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
}
|
||||
let javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
|
||||
webView.evaluateJavaScript(javascriptString) { (info, error) in
|
||||
guard let info = info as? [String: Any] else {
|
||||
|
||||
@@ -67,18 +67,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
|
||||
updateArticleThemeMenu()
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
let toolbar = NSToolbar(identifier: "MainWindowToolbar")
|
||||
toolbar.allowsUserCustomization = true
|
||||
toolbar.autosavesConfiguration = true
|
||||
toolbar.displayMode = .iconOnly
|
||||
toolbar.delegate = self
|
||||
self.window?.toolbar = toolbar
|
||||
} else {
|
||||
if !AppDefaults.shared.showTitleOnMainWindow {
|
||||
window?.titleVisibility = .hidden
|
||||
}
|
||||
}
|
||||
let toolbar = NSToolbar(identifier: "MainWindowToolbar")
|
||||
toolbar.allowsUserCustomization = true
|
||||
toolbar.autosavesConfiguration = true
|
||||
toolbar.displayMode = .iconOnly
|
||||
toolbar.delegate = self
|
||||
self.window?.toolbar = toolbar
|
||||
|
||||
if let window = window {
|
||||
let point = NSPoint(x: 128, y: 64)
|
||||
@@ -776,173 +770,130 @@ extension NSToolbarItem.Identifier {
|
||||
extension MainWindowController: NSToolbarDelegate {
|
||||
|
||||
func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? {
|
||||
if #available(macOS 11.0, *) {
|
||||
switch itemIdentifier {
|
||||
|
||||
switch itemIdentifier {
|
||||
case .sidebarToggle:
|
||||
let title = NSLocalizedString("Toggle Sidebar", comment: "Toggle Sidebar")
|
||||
return buildToolbarButton(.toggleSidebar, title, AppAssets.sidebarToggleImage, "toggleTheSidebar:")
|
||||
|
||||
case .sidebarToggle:
|
||||
let title = NSLocalizedString("Toggle Sidebar", comment: "Toggle Sidebar")
|
||||
return buildToolbarButton(.toggleSidebar, title, AppAssets.sidebarToggleImage, "toggleTheSidebar:")
|
||||
|
||||
case .refresh:
|
||||
let title = NSLocalizedString("Refresh", comment: "Refresh")
|
||||
return buildToolbarButton(.refresh, title, AppAssets.refreshImage, "refreshAll:")
|
||||
|
||||
case .newSidebarItemMenu:
|
||||
let toolbarItem = NSMenuToolbarItem(itemIdentifier: .newSidebarItemMenu)
|
||||
toolbarItem.image = AppAssets.addNewSidebarItemImage
|
||||
let description = NSLocalizedString("Add Item", comment: "Add Item")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
toolbarItem.menu = buildNewSidebarItemMenu()
|
||||
return toolbarItem
|
||||
|
||||
case .markAllAsRead:
|
||||
let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
|
||||
return buildToolbarButton(.markAllAsRead, title, AppAssets.markAllAsReadImage, "markAllAsRead:")
|
||||
|
||||
case .toggleReadArticlesFilter:
|
||||
let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter")
|
||||
return buildToolbarButton(.toggleReadArticlesFilter, title, AppAssets.filterInactive, "toggleReadArticlesFilter:")
|
||||
|
||||
case .timelineTrackingSeparator:
|
||||
return NSTrackingSeparatorToolbarItem(identifier: .timelineTrackingSeparator, splitView: splitViewController!.splitView, dividerIndex: 1)
|
||||
|
||||
case .markRead:
|
||||
let title = NSLocalizedString("Mark Read", comment: "Mark Read")
|
||||
return buildToolbarButton(.markRead, title, AppAssets.readClosedImage, "toggleRead:")
|
||||
|
||||
case .markStar:
|
||||
let title = NSLocalizedString("Star", comment: "Star")
|
||||
return buildToolbarButton(.markStar, title, AppAssets.starOpenImage, "toggleStarred:")
|
||||
|
||||
case .nextUnread:
|
||||
let title = NSLocalizedString("Next Unread", comment: "Next Unread")
|
||||
return buildToolbarButton(.nextUnread, title, AppAssets.nextUnreadImage, "nextUnread:")
|
||||
|
||||
case .readerView:
|
||||
let toolbarItem = RSToolbarItem(itemIdentifier: .readerView)
|
||||
toolbarItem.autovalidates = true
|
||||
let description = NSLocalizedString("Reader View", comment: "Reader View")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
let button = ArticleExtractorButton()
|
||||
button.action = #selector(toggleArticleExtractor(_:))
|
||||
toolbarItem.view = button
|
||||
return toolbarItem
|
||||
|
||||
case .share:
|
||||
let title = NSLocalizedString("Share", comment: "Share")
|
||||
return buildToolbarButton(.share, title, AppAssets.shareImage, "toolbarShowShareMenu:")
|
||||
|
||||
case .openInBrowser:
|
||||
let title = NSLocalizedString("Open in Browser", comment: "Open in Browser")
|
||||
return buildToolbarButton(.openInBrowser, title, AppAssets.openInBrowserImage, "openArticleInBrowser:")
|
||||
|
||||
case .articleThemeMenu:
|
||||
articleThemeMenuToolbarItem.image = AppAssets.articleTheme
|
||||
let description = NSLocalizedString("Article Theme", comment: "Article Theme")
|
||||
articleThemeMenuToolbarItem.toolTip = description
|
||||
articleThemeMenuToolbarItem.label = description
|
||||
return articleThemeMenuToolbarItem
|
||||
|
||||
case .search:
|
||||
let toolbarItem = NSSearchToolbarItem(itemIdentifier: .search)
|
||||
let description = NSLocalizedString("Search", comment: "Search")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
return toolbarItem
|
||||
|
||||
case .cleanUp:
|
||||
let title = NSLocalizedString("Clean Up", comment: "Clean Up")
|
||||
return buildToolbarButton(.cleanUp, title, AppAssets.cleanUpImage, "cleanUp:")
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
case .refresh:
|
||||
let title = NSLocalizedString("Refresh", comment: "Refresh")
|
||||
return buildToolbarButton(.refresh, title, AppAssets.refreshImage, "refreshAll:")
|
||||
|
||||
return nil
|
||||
case .newSidebarItemMenu:
|
||||
let toolbarItem = NSMenuToolbarItem(itemIdentifier: .newSidebarItemMenu)
|
||||
toolbarItem.image = AppAssets.addNewSidebarItemImage
|
||||
let description = NSLocalizedString("Add Item", comment: "Add Item")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
toolbarItem.menu = buildNewSidebarItemMenu()
|
||||
return toolbarItem
|
||||
|
||||
case .markAllAsRead:
|
||||
let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
|
||||
return buildToolbarButton(.markAllAsRead, title, AppAssets.markAllAsReadImage, "markAllAsRead:")
|
||||
|
||||
case .toggleReadArticlesFilter:
|
||||
let title = NSLocalizedString("Read Articles Filter", comment: "Read Articles Filter")
|
||||
return buildToolbarButton(.toggleReadArticlesFilter, title, AppAssets.filterInactive, "toggleReadArticlesFilter:")
|
||||
|
||||
case .timelineTrackingSeparator:
|
||||
return NSTrackingSeparatorToolbarItem(identifier: .timelineTrackingSeparator, splitView: splitViewController!.splitView, dividerIndex: 1)
|
||||
|
||||
case .markRead:
|
||||
let title = NSLocalizedString("Mark Read", comment: "Mark Read")
|
||||
return buildToolbarButton(.markRead, title, AppAssets.readClosedImage, "toggleRead:")
|
||||
|
||||
case .markStar:
|
||||
let title = NSLocalizedString("Star", comment: "Star")
|
||||
return buildToolbarButton(.markStar, title, AppAssets.starOpenImage, "toggleStarred:")
|
||||
|
||||
case .nextUnread:
|
||||
let title = NSLocalizedString("Next Unread", comment: "Next Unread")
|
||||
return buildToolbarButton(.nextUnread, title, AppAssets.nextUnreadImage, "nextUnread:")
|
||||
|
||||
case .readerView:
|
||||
let toolbarItem = RSToolbarItem(itemIdentifier: .readerView)
|
||||
toolbarItem.autovalidates = true
|
||||
let description = NSLocalizedString("Reader View", comment: "Reader View")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
let button = ArticleExtractorButton()
|
||||
button.action = #selector(toggleArticleExtractor(_:))
|
||||
toolbarItem.view = button
|
||||
return toolbarItem
|
||||
|
||||
case .share:
|
||||
let title = NSLocalizedString("Share", comment: "Share")
|
||||
return buildToolbarButton(.share, title, AppAssets.shareImage, "toolbarShowShareMenu:")
|
||||
|
||||
case .openInBrowser:
|
||||
let title = NSLocalizedString("Open in Browser", comment: "Open in Browser")
|
||||
return buildToolbarButton(.openInBrowser, title, AppAssets.openInBrowserImage, "openArticleInBrowser:")
|
||||
|
||||
case .articleThemeMenu:
|
||||
articleThemeMenuToolbarItem.image = AppAssets.articleTheme
|
||||
let description = NSLocalizedString("Article Theme", comment: "Article Theme")
|
||||
articleThemeMenuToolbarItem.toolTip = description
|
||||
articleThemeMenuToolbarItem.label = description
|
||||
return articleThemeMenuToolbarItem
|
||||
|
||||
case .search:
|
||||
let toolbarItem = NSSearchToolbarItem(itemIdentifier: .search)
|
||||
let description = NSLocalizedString("Search", comment: "Search")
|
||||
toolbarItem.toolTip = description
|
||||
toolbarItem.label = description
|
||||
return toolbarItem
|
||||
|
||||
case .cleanUp:
|
||||
let title = NSLocalizedString("Clean Up", comment: "Clean Up")
|
||||
return buildToolbarButton(.cleanUp, title, AppAssets.cleanUpImage, "cleanUp:")
|
||||
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
|
||||
if #available(macOS 11.0, *) {
|
||||
return [
|
||||
.sidebarToggle,
|
||||
.refresh,
|
||||
.newSidebarItemMenu,
|
||||
.sidebarTrackingSeparator,
|
||||
.markAllAsRead,
|
||||
.toggleReadArticlesFilter,
|
||||
.timelineTrackingSeparator,
|
||||
.flexibleSpace,
|
||||
.nextUnread,
|
||||
.markRead,
|
||||
.markStar,
|
||||
.readerView,
|
||||
.openInBrowser,
|
||||
.share,
|
||||
.articleThemeMenu,
|
||||
.search,
|
||||
.cleanUp
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
.newFeed,
|
||||
.newFolder,
|
||||
.refresh,
|
||||
.flexibleSpace,
|
||||
.markAllAsRead,
|
||||
.search,
|
||||
.flexibleSpace,
|
||||
.nextUnread,
|
||||
.markStar,
|
||||
.markRead,
|
||||
.readerView,
|
||||
.openInBrowser,
|
||||
.share,
|
||||
.cleanUp
|
||||
]
|
||||
}
|
||||
return [
|
||||
.sidebarToggle,
|
||||
.refresh,
|
||||
.newSidebarItemMenu,
|
||||
.sidebarTrackingSeparator,
|
||||
.markAllAsRead,
|
||||
.toggleReadArticlesFilter,
|
||||
.timelineTrackingSeparator,
|
||||
.flexibleSpace,
|
||||
.nextUnread,
|
||||
.markRead,
|
||||
.markStar,
|
||||
.readerView,
|
||||
.openInBrowser,
|
||||
.share,
|
||||
.articleThemeMenu,
|
||||
.search,
|
||||
.cleanUp
|
||||
]
|
||||
}
|
||||
|
||||
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
|
||||
if #available(macOS 11.0, *) {
|
||||
return [
|
||||
.flexibleSpace,
|
||||
.refresh,
|
||||
.newSidebarItemMenu,
|
||||
.sidebarTrackingSeparator,
|
||||
.markAllAsRead,
|
||||
.toggleReadArticlesFilter,
|
||||
.timelineTrackingSeparator,
|
||||
.markRead,
|
||||
.markStar,
|
||||
.nextUnread,
|
||||
.readerView,
|
||||
.share,
|
||||
.openInBrowser,
|
||||
.flexibleSpace,
|
||||
.search
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
.newFeed,
|
||||
.newFolder,
|
||||
.refresh,
|
||||
.flexibleSpace,
|
||||
.markAllAsRead,
|
||||
.search,
|
||||
.flexibleSpace,
|
||||
.nextUnread,
|
||||
.markStar,
|
||||
.markRead,
|
||||
.readerView,
|
||||
.openInBrowser,
|
||||
.share
|
||||
]
|
||||
}
|
||||
return [
|
||||
.flexibleSpace,
|
||||
.refresh,
|
||||
.newSidebarItemMenu,
|
||||
.sidebarTrackingSeparator,
|
||||
.markAllAsRead,
|
||||
.toggleReadArticlesFilter,
|
||||
.timelineTrackingSeparator,
|
||||
.markRead,
|
||||
.markStar,
|
||||
.nextUnread,
|
||||
.readerView,
|
||||
.share,
|
||||
.openInBrowser,
|
||||
.flexibleSpace,
|
||||
.search
|
||||
]
|
||||
}
|
||||
|
||||
func toolbarWillAddItem(_ notification: Notification) {
|
||||
@@ -955,20 +906,11 @@ extension MainWindowController: NSToolbarDelegate {
|
||||
button.sendAction(on: .leftMouseDown)
|
||||
}
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
if item.itemIdentifier == .search, let searchItem = item as? NSSearchToolbarItem {
|
||||
searchItem.searchField.delegate = self
|
||||
searchItem.searchField.target = self
|
||||
searchItem.searchField.action = #selector(runSearch(_:))
|
||||
currentSearchField = searchItem.searchField
|
||||
}
|
||||
} else {
|
||||
if item.itemIdentifier == .search, let searchField = item.view as? NSSearchField {
|
||||
searchField.delegate = self
|
||||
searchField.target = self
|
||||
searchField.action = #selector(runSearch(_:))
|
||||
currentSearchField = searchField
|
||||
}
|
||||
if item.itemIdentifier == .search, let searchItem = item as? NSSearchToolbarItem {
|
||||
searchItem.searchField.delegate = self
|
||||
searchItem.searchField.target = self
|
||||
searchItem.searchField.action = #selector(runSearch(_:))
|
||||
currentSearchField = searchItem.searchField
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,20 +919,11 @@ extension MainWindowController: NSToolbarDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
if item.itemIdentifier == .search, let searchItem = item as? NSSearchToolbarItem {
|
||||
searchItem.searchField.delegate = nil
|
||||
searchItem.searchField.target = nil
|
||||
searchItem.searchField.action = nil
|
||||
currentSearchField = nil
|
||||
}
|
||||
} else {
|
||||
if item.itemIdentifier == .search, let searchField = item.view as? NSSearchField {
|
||||
searchField.delegate = nil
|
||||
searchField.target = nil
|
||||
searchField.action = nil
|
||||
currentSearchField = nil
|
||||
}
|
||||
if item.itemIdentifier == .search, let searchItem = item as? NSSearchToolbarItem {
|
||||
searchItem.searchField.delegate = nil
|
||||
searchItem.searchField.target = nil
|
||||
searchItem.searchField.action = nil
|
||||
currentSearchField = nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,7 +1055,7 @@ private extension MainWindowController {
|
||||
menuItem.title = commandName
|
||||
}
|
||||
|
||||
if #available(macOS 11.0, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
button.image = markingRead ? AppAssets.readClosedImage : AppAssets.readOpenImage
|
||||
}
|
||||
|
||||
@@ -1135,77 +1068,34 @@ private extension MainWindowController {
|
||||
}
|
||||
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
guard let toolbarItem = item as? NSToolbarItem, let toolbarButton = toolbarItem.view as? ArticleExtractorButton else {
|
||||
if let menuItem = item as? NSMenuItem {
|
||||
menuItem.state = isShowingExtractedArticle ? .on : .off
|
||||
}
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
if let webfeed = currentTimelineViewController?.selectedArticles.first?.webFeed {
|
||||
if webfeed.isFeedProvider {
|
||||
toolbarButton.isEnabled = false
|
||||
return false
|
||||
} else {
|
||||
toolbarButton.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
guard let toolbarItem = item as? NSToolbarItem, let toolbarButton = toolbarItem.view as? ArticleExtractorButton else {
|
||||
if let menuItem = item as? NSMenuItem {
|
||||
menuItem.state = isShowingExtractedArticle ? .on : .off
|
||||
}
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
if let webfeed = currentTimelineViewController?.selectedArticles.first?.webFeed {
|
||||
if webfeed.isFeedProvider {
|
||||
toolbarButton.isEnabled = false
|
||||
return false
|
||||
} else {
|
||||
toolbarButton.isEnabled = true
|
||||
}
|
||||
}
|
||||
guard let state = articleExtractor?.state else {
|
||||
toolbarButton.buttonState = .off
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
guard let state = articleExtractor?.state else {
|
||||
toolbarButton.buttonState = .off
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
switch state {
|
||||
case .processing:
|
||||
toolbarButton.buttonState = .animated
|
||||
case .failedToParse:
|
||||
toolbarButton.buttonState = .error
|
||||
case .ready, .cancelled, .complete:
|
||||
toolbarButton.buttonState = isShowingExtractedArticle ? .on : .off
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
guard let toolbarItem = item as? NSToolbarItem, let toolbarButton = toolbarItem.view as? LegacyArticleExtractorButton else {
|
||||
if let menuItem = item as? NSMenuItem {
|
||||
menuItem.state = isShowingExtractedArticle ? .on : .off
|
||||
}
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
if let webfeed = currentTimelineViewController?.selectedArticles.first?.webFeed {
|
||||
if webfeed.isFeedProvider {
|
||||
toolbarButton.isEnabled = false
|
||||
return false
|
||||
} else {
|
||||
toolbarButton.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
toolbarButton.state = isShowingExtractedArticle ? .on : .off
|
||||
|
||||
guard let state = articleExtractor?.state else {
|
||||
toolbarButton.isError = false
|
||||
toolbarButton.isInProgress = false
|
||||
toolbarButton.state = .off
|
||||
return currentLink != nil
|
||||
}
|
||||
|
||||
switch state {
|
||||
case .processing:
|
||||
toolbarButton.isError = false
|
||||
toolbarButton.isInProgress = true
|
||||
case .failedToParse:
|
||||
toolbarButton.isError = true
|
||||
toolbarButton.isInProgress = false
|
||||
case .ready, .cancelled, .complete:
|
||||
toolbarButton.isError = false
|
||||
toolbarButton.isInProgress = false
|
||||
}
|
||||
|
||||
switch state {
|
||||
case .processing:
|
||||
toolbarButton.buttonState = .animated
|
||||
case .failedToParse:
|
||||
toolbarButton.buttonState = .error
|
||||
case .ready, .cancelled, .complete:
|
||||
toolbarButton.buttonState = isShowingExtractedArticle ? .on : .off
|
||||
}
|
||||
|
||||
return true
|
||||
@@ -1255,7 +1145,7 @@ private extension MainWindowController {
|
||||
menuItem.title = commandName
|
||||
}
|
||||
|
||||
if #available(macOS 11.0, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
button.image = starring ? AppAssets.starOpenImage : AppAssets.starClosedImage
|
||||
}
|
||||
|
||||
@@ -1281,7 +1171,7 @@ private extension MainWindowController {
|
||||
|
||||
guard let isReadFiltered = timelineContainerViewController?.isReadFiltered else {
|
||||
(item as? NSMenuItem)?.title = hideCommand
|
||||
if #available(macOS 11.0, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
toolbarItem.toolTip = hideCommand
|
||||
button.image = AppAssets.filterInactive
|
||||
}
|
||||
@@ -1290,13 +1180,13 @@ private extension MainWindowController {
|
||||
|
||||
if isReadFiltered {
|
||||
(item as? NSMenuItem)?.title = showCommand
|
||||
if #available(macOS 11.0, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
toolbarItem.toolTip = showCommand
|
||||
button.image = AppAssets.filterActive
|
||||
}
|
||||
} else {
|
||||
(item as? NSMenuItem)?.title = hideCommand
|
||||
if #available(macOS 11.0, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
if let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton {
|
||||
toolbarItem.toolTip = hideCommand
|
||||
button.image = AppAssets.filterInactive
|
||||
}
|
||||
@@ -1331,49 +1221,39 @@ private extension MainWindowController {
|
||||
guard timelineSourceMode != .search else {
|
||||
let localizedLabel = NSLocalizedString("Search: %@", comment: "Search")
|
||||
window?.title = NSString.localizedStringWithFormat(localizedLabel as NSString, searchString ?? "") as String
|
||||
if #available(macOS 11.0, *) {
|
||||
window?.subtitle = ""
|
||||
}
|
||||
window?.subtitle = ""
|
||||
return
|
||||
}
|
||||
|
||||
func setSubtitle(_ count: Int) {
|
||||
let localizedLabel = NSLocalizedString("%d unread", comment: "Unread")
|
||||
let formattedLabel = NSString.localizedStringWithFormat(localizedLabel as NSString, count)
|
||||
if #available(macOS 11.0, *) {
|
||||
window?.subtitle = formattedLabel as String
|
||||
}
|
||||
window?.subtitle = formattedLabel as String
|
||||
}
|
||||
|
||||
guard let selectedObjects = selectedObjectsInSidebar(), selectedObjects.count > 0 else {
|
||||
window?.title = appDelegate.appName!
|
||||
if #available(macOS 11.0, *) {
|
||||
setSubtitle(appDelegate.unreadCount)
|
||||
}
|
||||
setSubtitle(appDelegate.unreadCount)
|
||||
return
|
||||
}
|
||||
|
||||
guard selectedObjects.count == 1 else {
|
||||
window?.title = NSLocalizedString("Multiple", comment: "Multiple")
|
||||
if #available(macOS 11.0, *) {
|
||||
let unreadCount = selectedObjects.reduce(0, { result, selectedObject in
|
||||
if let unreadCountProvider = selectedObject as? UnreadCountProvider {
|
||||
return result + unreadCountProvider.unreadCount
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
})
|
||||
setSubtitle(unreadCount)
|
||||
}
|
||||
let unreadCount = selectedObjects.reduce(0, { result, selectedObject in
|
||||
if let unreadCountProvider = selectedObject as? UnreadCountProvider {
|
||||
return result + unreadCountProvider.unreadCount
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
})
|
||||
setSubtitle(unreadCount)
|
||||
return
|
||||
}
|
||||
|
||||
if let displayNameProvider = currentFeedOrFolder as? DisplayNameProvider {
|
||||
window?.title = displayNameProvider.nameForDisplay
|
||||
if #available(macOS 11.0, *) {
|
||||
if let unreadCountProvider = currentFeedOrFolder as? UnreadCountProvider {
|
||||
setSubtitle(unreadCountProvider.unreadCount)
|
||||
}
|
||||
if let unreadCountProvider = currentFeedOrFolder as? UnreadCountProvider {
|
||||
setSubtitle(unreadCountProvider.unreadCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,7 @@ struct SidebarCellAppearance: Equatable {
|
||||
textFieldFontSize = 11
|
||||
case .large:
|
||||
imageSize = CGSize(width: 22, height: 22)
|
||||
if #available(macOS 11.0, *) {
|
||||
textFieldFontSize = 15
|
||||
} else {
|
||||
textFieldFontSize = 13
|
||||
}
|
||||
textFieldFontSize = 15
|
||||
default:
|
||||
imageSize = CGSize(width: 19, height: 19)
|
||||
textFieldFontSize = 13
|
||||
|
||||
@@ -56,11 +56,7 @@ struct TimelineCellAppearance: Equatable {
|
||||
|
||||
self.showIcon = showIcon
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
|
||||
} else {
|
||||
cellPadding = NSEdgeInsets(top: 8.0, left: 18.0, bottom: 10.0, right: 18.0)
|
||||
}
|
||||
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
|
||||
|
||||
let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight
|
||||
self.boxLeftMargin = margin
|
||||
|
||||
@@ -59,21 +59,12 @@ class TimelineTableRowView : NSTableRowView {
|
||||
separator!.wantsLayer = true
|
||||
separator!.layer?.backgroundColor = AppAssets.timelineSeparatorColor.cgColor
|
||||
addSubview(separator!)
|
||||
if #available(macOS 11.0, *) {
|
||||
NSLayoutConstraint.activate([
|
||||
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 20),
|
||||
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -4),
|
||||
separator!.heightAnchor.constraint(equalToConstant: 1),
|
||||
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
|
||||
])
|
||||
} else {
|
||||
NSLayoutConstraint.activate([
|
||||
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 34),
|
||||
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -28),
|
||||
separator!.heightAnchor.constraint(equalToConstant: 1),
|
||||
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
|
||||
])
|
||||
}
|
||||
NSLayoutConstraint.activate([
|
||||
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 20),
|
||||
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -4),
|
||||
separator!.heightAnchor.constraint(equalToConstant: 1),
|
||||
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
|
||||
])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -207,10 +207,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
tableView.doubleAction = #selector(openArticleInBrowser(_:))
|
||||
tableView.setDraggingSourceOperationMask(.copy, forLocal: false)
|
||||
tableView.keyboardDelegate = keyboardDelegate
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
tableView.style = .inset
|
||||
}
|
||||
tableView.style = .inset
|
||||
|
||||
if !didRegisterForNotifications {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
|
||||
|
||||
@@ -128,10 +128,8 @@ class AccountsFeedWranglerWindowController: NSWindowController {
|
||||
|
||||
// MARK: Autofill
|
||||
func enableAutofill() {
|
||||
if #available(macOS 11, *) {
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -133,10 +133,8 @@ class AccountsFeedbinWindowController: NSWindowController {
|
||||
|
||||
// MARK: Autofill
|
||||
func enableAutofill() {
|
||||
if #available(macOS 11, *) {
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -129,10 +129,8 @@ class AccountsNewsBlurWindowController: NSWindowController {
|
||||
|
||||
// MARK: Autofill
|
||||
func enableAutofill() {
|
||||
if #available(macOS 11, *) {
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -197,10 +197,8 @@ class AccountsReaderAPIWindowController: NSWindowController {
|
||||
|
||||
// MARK: Autofill
|
||||
func enableAutofill() {
|
||||
if #available(macOS 11, *) {
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
usernameTextField.contentType = .username
|
||||
passwordTextField.contentType = .password
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,45 +102,25 @@ struct AddAccountsView: View {
|
||||
|
||||
HStack(spacing: 12) {
|
||||
Spacer()
|
||||
if #available(OSX 11.0, *) {
|
||||
Button(action: {
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
.frame(width: 76)
|
||||
})
|
||||
.help("Cancel")
|
||||
.keyboardShortcut(.cancelAction)
|
||||
|
||||
} else {
|
||||
Button(action: {
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
.frame(width: 76)
|
||||
})
|
||||
.accessibility(label: Text("Add Account"))
|
||||
}
|
||||
if #available(OSX 11.0, *) {
|
||||
Button(action: {
|
||||
addAccountDelegate?.presentSheetForAccount(selectedAccount)
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
.frame(width: 76)
|
||||
})
|
||||
.help("Add Account")
|
||||
.keyboardShortcut(.defaultAction)
|
||||
|
||||
} else {
|
||||
Button(action: {
|
||||
addAccountDelegate?.presentSheetForAccount(selectedAccount)
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
.frame(width: 76)
|
||||
})
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
.frame(width: 76)
|
||||
})
|
||||
.help("Cancel")
|
||||
.keyboardShortcut(.cancelAction)
|
||||
|
||||
Button(action: {
|
||||
addAccountDelegate?.presentSheetForAccount(selectedAccount)
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
.frame(width: 76)
|
||||
})
|
||||
.help("Add Account")
|
||||
.keyboardShortcut(.defaultAction)
|
||||
}
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 4)
|
||||
|
||||
@@ -34,46 +34,25 @@ struct EnableExtensionPointView: View {
|
||||
|
||||
HStack(spacing: 12) {
|
||||
Spacer()
|
||||
if #available(OSX 11.0, *) {
|
||||
Button(action: {
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
.frame(width: 80)
|
||||
})
|
||||
.help("Cancel")
|
||||
.keyboardShortcut(.cancelAction)
|
||||
|
||||
} else {
|
||||
Button(action: {
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
.frame(width: 80)
|
||||
})
|
||||
.accessibility(label: Text("Add Extension"))
|
||||
}
|
||||
if #available(OSX 11.0, *) {
|
||||
Button(action: {
|
||||
enabler?.enable(typeFromName(extensionPointTypeName))
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
.frame(width: 80)
|
||||
})
|
||||
.help("Add Extension")
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.disabled(disableContinue())
|
||||
} else {
|
||||
Button(action: {
|
||||
enabler?.enable(typeFromName(extensionPointTypeName))
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
.frame(width: 80)
|
||||
})
|
||||
.disabled(disableContinue())
|
||||
}
|
||||
Button(action: {
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
.frame(width: 80)
|
||||
})
|
||||
.help("Cancel")
|
||||
.keyboardShortcut(.cancelAction)
|
||||
|
||||
Button(action: {
|
||||
enabler?.enable(typeFromName(extensionPointTypeName))
|
||||
parent?.dismiss(nil)
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
.frame(width: 80)
|
||||
})
|
||||
.help("Add Extension")
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.disabled(disableContinue())
|
||||
}
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 4)
|
||||
|
||||
Reference in New Issue
Block a user