Pay attention to the changed key when handling feed setting change notifications.

This commit is contained in:
Brent Simmons 2019-03-17 13:54:30 -07:00
parent 5f1bdb29ec
commit 70bc4a7b45
3 changed files with 16 additions and 12 deletions

View File

@ -19,14 +19,14 @@ public extension Feed {
public static let FeedSettingUserInfoKey = "feedSetting"
public struct FeedSettingKey {
static let homePageURL = "homePageURL"
static let iconURL = "iconURL"
static let faviconURL = "faviconURL"
static let name = "name"
static let editedName = "editedName"
static let authors = "authors"
static let contentHash = "contentHash"
static let conditionalGetInfo = "conditionalGetInfo"
public static let homePageURL = "homePageURL"
public static let iconURL = "iconURL"
public static let faviconURL = "faviconURL"
public static let name = "name"
public static let editedName = "editedName"
public static let authors = "authors"
public static let contentHash = "contentHash"
public static let conditionalGetInfo = "conditionalGetInfo"
}
}

View File

@ -224,10 +224,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
@objc func feedSettingDidChange(_ note: Notification) {
guard let feed = note.object as? Feed else {
guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else {
return
}
let _ = faviconDownloader.favicon(for: feed)
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
let _ = faviconDownloader.favicon(for: feed)
}
}
@objc func inspectableObjectsDidChange(_ note: Notification) {

View File

@ -129,10 +129,12 @@ protocol SidebarDelegate: class {
@objc func feedSettingDidChange(_ note: Notification) {
guard let feed = note.object as? Feed else {
guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else {
return
}
configureCellsForRepresentedObject(feed)
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
configureCellsForRepresentedObject(feed)
}
}
@objc func displayNameDidChange(_ note: Notification) {