From 8c14c9866472b5dbaa78b80090146df7610c3276 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 19 Jan 2025 17:59:54 -0800 Subject: [PATCH] Reload cells when HTMLMetadata is available. --- iOS/MainFeed/MainFeedViewController.swift | 8 ++++++++ iOS/MainTimeline/MainTimelineViewController.swift | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/iOS/MainFeed/MainFeedViewController.swift b/iOS/MainFeed/MainFeedViewController.swift index 04d132f71..db4af7b9e 100644 --- a/iOS/MainFeed/MainFeedViewController.swift +++ b/iOS/MainFeed/MainFeedViewController.swift @@ -11,6 +11,7 @@ import Account import Articles import RSCore import RSTree +import RSWeb import SafariServices class MainFeedViewController: UITableViewController, UndoableCommandRunner { @@ -68,6 +69,13 @@ class MainFeedViewController: UITableViewController, UndoableCommandRunner { NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) + + // TODO: fix this temporary hack, which will probably require refactoring image handling. + // We want to know when to possibly reconfigure our cells with a new image, and we don’t + // always know when an image is available — but watching the .htmlMetadataAvailable Notification + // lets us know that it’s time to request an image. + NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .htmlMetadataAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .feedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index 78b2f2c77..c4d4d8412 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -8,6 +8,7 @@ import UIKit import RSCore +import RSWeb import Account import Articles @@ -55,6 +56,13 @@ class MainTimelineViewController: UITableViewController, UndoableCommandRunner { NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .feedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) + + // TODO: fix this temporary hack, which will probably require refactoring image handling. + // We want to know when to possibly reconfigure our cells with a new image, and we don’t + // always know when an image is available — but watching the .htmlMetadataAvailable Notification + // lets us know that it’s time to request an image. + NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .htmlMetadataAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange), name: .DisplayNameDidChange, object: nil)