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 static let FeedSettingUserInfoKey = "feedSetting"
public struct FeedSettingKey { public struct FeedSettingKey {
static let homePageURL = "homePageURL" public static let homePageURL = "homePageURL"
static let iconURL = "iconURL" public static let iconURL = "iconURL"
static let faviconURL = "faviconURL" public static let faviconURL = "faviconURL"
static let name = "name" public static let name = "name"
static let editedName = "editedName" public static let editedName = "editedName"
static let authors = "authors" public static let authors = "authors"
static let contentHash = "contentHash" public static let contentHash = "contentHash"
static let conditionalGetInfo = "conditionalGetInfo" public static let conditionalGetInfo = "conditionalGetInfo"
} }
} }

View File

@ -224,11 +224,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
@objc func feedSettingDidChange(_ note: Notification) { @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 return
} }
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
let _ = faviconDownloader.favicon(for: feed) let _ = faviconDownloader.favicon(for: feed)
} }
}
@objc func inspectableObjectsDidChange(_ note: Notification) { @objc func inspectableObjectsDidChange(_ note: Notification) {

View File

@ -129,11 +129,13 @@ protocol SidebarDelegate: class {
@objc func feedSettingDidChange(_ note: Notification) { @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 return
} }
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
configureCellsForRepresentedObject(feed) configureCellsForRepresentedObject(feed)
} }
}
@objc func displayNameDidChange(_ note: Notification) { @objc func displayNameDidChange(_ note: Notification) {