diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index e9be4a115..6051eba83 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -127,10 +127,30 @@ struct AppAssets { } }() + @available(macOS 10.16, *) + static var readClosedImage: RSImage = { + return NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)! + }() + + @available(macOS 10.16, *) + static var readOpenImage: RSImage = { + return NSImage(systemSymbolName: "circle", accessibilityDescription: nil)! + }() + static var searchFeedImage: IconImage = { return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true) }() + @available(macOS 10.16, *) + static var starClosedImage: RSImage = { + return NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)! + }() + + @available(macOS 10.16, *) + static var starOpenImage: RSImage = { + return NSImage(systemSymbolName: "star", accessibilityDescription: nil)! + }() + static var starredFeedImage: IconImage = { if #available(macOS 10.16, *) { let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)! diff --git a/Mac/Base.lproj/MainWindow.storyboard b/Mac/Base.lproj/MainWindow.storyboard index bc3b820a8..475dda607 100644 --- a/Mac/Base.lproj/MainWindow.storyboard +++ b/Mac/Base.lproj/MainWindow.storyboard @@ -4,6 +4,7 @@ + @@ -269,12 +270,151 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + @@ -289,7 +429,7 @@ - + @@ -663,13 +803,20 @@ + + + + + + + diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 4870d8207..42eac5243 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -62,6 +62,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { sharingServicePickerDelegate = SharingServicePickerDelegate(self.window) if #available(macOS 10.16, *) { + DispatchQueue.main.async { + if self.window?.toolbar?.existingItem(withIdentifier: .TrackingSeparator) == nil { + self.window?.toolbar?.insertItem(withItemIdentifier: .TrackingSeparator, at: 2) + } + } } else { if !AppDefaults.shared.showTitleOnMainWindow { window?.titleVisibility = .hidden @@ -687,12 +692,20 @@ extension MainWindowController : ScriptingMainWindowController { // MARK: - NSToolbarDelegate extension NSToolbarItem.Identifier { + static let TrackingSeparator = NSToolbarItem.Identifier("trackingSeparator") static let Share = NSToolbarItem.Identifier("share") static let Search = NSToolbarItem.Identifier("search") } extension MainWindowController: NSToolbarDelegate { + func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? { + if #available(macOS 10.16, *), itemIdentifier == .TrackingSeparator { + return NSTrackingSeparatorToolbarItem(identifier: .TrackingSeparator, splitView: splitViewController!.splitView, dividerIndex: 1) + } + return nil + } + func toolbarWillAddItem(_ notification: Notification) { guard let item = notification.userInfo?["item"] as? NSToolbarItem else { return @@ -831,6 +844,10 @@ private extension MainWindowController { menuItem.title = commandName } + if #available(macOS 10.16, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton { + button.image = markingRead ? AppAssets.readClosedImage : AppAssets.readOpenImage + } + return result } @@ -908,15 +925,16 @@ private extension MainWindowController { if let toolbarItem = item as? NSToolbarItem { toolbarItem.toolTip = commandName -// if let button = toolbarItem.view as? NSButton { -// button.image = NSImage(named: starring ? .star : .unstar) -// } } if let menuItem = item as? NSMenuItem { menuItem.title = commandName } + if #available(macOS 10.16, *), let toolbarItem = item as? NSToolbarItem, let button = toolbarItem.view as? NSButton { + button.image = starring ? AppAssets.starOpenImage : AppAssets.starClosedImage + } + return result } diff --git a/Mac/Resources/Assets.xcassets/markAllAsRead.imageset/Contents.json b/Mac/Resources/Assets.xcassets/markAllAsRead.imageset/Contents.json new file mode 100644 index 000000000..9937c57c5 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/markAllAsRead.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "filename" : "markAllAsRead.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "template" + } +} diff --git a/Mac/Resources/Assets.xcassets/markAllAsRead.imageset/markAllAsRead.pdf b/Mac/Resources/Assets.xcassets/markAllAsRead.imageset/markAllAsRead.pdf new file mode 100644 index 000000000..90b75e877 Binary files /dev/null and b/Mac/Resources/Assets.xcassets/markAllAsRead.imageset/markAllAsRead.pdf differ