Fix subtitle for scenario where multiple are selected.
This commit is contained in:
parent
a0d2ee472d
commit
7c7b128380
|
@ -1199,30 +1199,45 @@ private extension MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateWindowTitle() {
|
func updateWindowTitle() {
|
||||||
|
func setSubtitle(_ count: Int) {
|
||||||
var displayName: String? = nil
|
let localizedLabel = NSLocalizedString("%d unread", comment: "Unread")
|
||||||
var unreadCount: Int? = nil
|
let formattedLabel = NSString.localizedStringWithFormat(localizedLabel as NSString, count)
|
||||||
|
|
||||||
if let displayNameProvider = currentFeedOrFolder as? DisplayNameProvider {
|
|
||||||
displayName = displayNameProvider.nameForDisplay
|
|
||||||
}
|
|
||||||
|
|
||||||
if let unreadCountProvider = currentFeedOrFolder as? UnreadCountProvider {
|
|
||||||
unreadCount = unreadCountProvider.unreadCount
|
|
||||||
}
|
|
||||||
|
|
||||||
if displayName != nil {
|
|
||||||
window?.title = displayName!
|
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
window?.subtitle = "\(unreadCount ?? 0) unread"
|
window?.subtitle = formattedLabel as String
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
guard let selectedObjects = selectedObjectsInSidebar(), selectedObjects.count > 0 else {
|
||||||
window?.title = appDelegate.appName!
|
window?.title = appDelegate.appName!
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
window?.subtitle = "\(appDelegate.unreadCount) unread"
|
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)
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func startArticleExtractorForCurrentLink() {
|
func startArticleExtractorForCurrentLink() {
|
||||||
|
|
Loading…
Reference in New Issue