From 2e583ae7b28ec9810182af0c4d962af212aff656 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 17 Jan 2020 14:33:06 -0700 Subject: [PATCH] Force the progress view label to update with content size changes. Issue #1645 --- iOS/MasterFeed/RefreshProgressView.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iOS/MasterFeed/RefreshProgressView.swift b/iOS/MasterFeed/RefreshProgressView.swift index 9214d3b4c..09b9f6574 100644 --- a/iOS/MasterFeed/RefreshProgressView.swift +++ b/iOS/MasterFeed/RefreshProgressView.swift @@ -17,7 +17,8 @@ class RefreshProgressView: UIView { override func awakeFromNib() { NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil) - + NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) + if !AccountManager.shared.combinedRefreshProgress.isComplete { progressChanged() } else { @@ -53,6 +54,12 @@ class RefreshProgressView: UIView { progressChanged() } + @objc func contentSizeCategoryDidChange(_ note: Notification) { + // This hack is probably necessary because custom views in the toolbar don't get + // notifications that the content size changed. + label.font = UIFont.preferredFont(forTextStyle: .footnote) + } + deinit { NotificationCenter.default.removeObserver(self) }