From 41547663b9ea1cfe1d187968c5a8ac49b510581b Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Fri, 8 Mar 2019 11:35:37 -0800 Subject: [PATCH] add hidden pref for show/hide dock unread count --- NetNewsWire/AppDefaults.swift | 5 +++++ NetNewsWire/AppDelegate.swift | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NetNewsWire/AppDefaults.swift b/NetNewsWire/AppDefaults.swift index a1788c90a..89762e1b4 100644 --- a/NetNewsWire/AppDefaults.swift +++ b/NetNewsWire/AppDefaults.swift @@ -58,6 +58,7 @@ struct AppDefaults { // Hidden prefs static let showTitleOnMainWindow = "KafasisTitleMode" + static let hideDockUnreadCount = "Issue246HideDockUnreadCount" } private static let smallestFontSizeRawValue = FontSize.small.rawValue @@ -111,6 +112,10 @@ struct AppDefaults { return bool(for: Key.showTitleOnMainWindow) } + static var hideDockUnreadCount: Bool { + return bool(for: Key.hideDockUnreadCount) + } + static var timelineSortDirection: ComparisonResult { get { return sortDirection(for: Key.timelineSortDirection) diff --git a/NetNewsWire/AppDelegate.swift b/NetNewsWire/AppDelegate.swift index 50b3b3c2c..8b5afc61c 100644 --- a/NetNewsWire/AppDelegate.swift +++ b/NetNewsWire/AppDelegate.swift @@ -347,7 +347,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, // MARK: - Dock Badge @objc func updateDockBadge() { - let label = unreadCount > 0 ? "\(unreadCount)" : "" + let label = unreadCount > 0 && !AppDefaults.hideDockUnreadCount ? "\(unreadCount)" : "" NSApplication.shared.dockTile.badgeLabel = label }