Use an image for feeds that don’t have favicons. Currently using the image at /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns — but this might change.
This commit is contained in:
parent
ab80e91ea7
commit
953a97afd7
|
@ -27,6 +27,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
var feedIconDownloader: FeedIconDownloader!
|
||||
var appName: String!
|
||||
|
||||
lazy var genericFeedImage: NSImage? = {
|
||||
let path = "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns"
|
||||
let image = NSImage(contentsOfFile: path)
|
||||
return image
|
||||
}()
|
||||
|
||||
var unreadCount = 0 {
|
||||
didSet {
|
||||
if unreadCount != oldValue {
|
||||
|
|
|
@ -111,7 +111,10 @@ extension FeedListViewController: NSOutlineViewDelegate {
|
|||
return NSImage(named: NSImage.Name.folder)
|
||||
}
|
||||
else if let feed = node.representedObject as? FeedListFeed {
|
||||
return appDelegate.faviconDownloader.favicon(withHomePageURL: feed.homePageURL)
|
||||
if let image = appDelegate.faviconDownloader.favicon(withHomePageURL: feed.homePageURL) {
|
||||
return image
|
||||
}
|
||||
return appDelegate.genericFeedImage
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -522,7 +522,10 @@ private extension SidebarViewController {
|
|||
extension Feed: SmallIconProvider {
|
||||
|
||||
var smallIcon: NSImage? {
|
||||
return appDelegate.faviconDownloader.favicon(for: self)
|
||||
if let image = appDelegate.faviconDownloader.favicon(for: self) {
|
||||
return image
|
||||
}
|
||||
return appDelegate.genericFeedImage
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue