Flush are rebuild web view queue when suspending and restoring the app. Issue #1563

This commit is contained in:
Maurice Parker
2020-02-04 16:00:26 -08:00
parent 8ed9958631
commit dfd6be5fa6
6 changed files with 114 additions and 41 deletions

View File

@@ -75,6 +75,7 @@ class ArticleViewController: UIViewController {
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
let fullScreenTapZone = UIView()
@@ -190,6 +191,15 @@ class ArticleViewController: UIViewController {
}
}
@objc func contentSizeCategoryDidChange(_ note: Notification) {
coordinator.webViewProvider.flushQueue()
coordinator.webViewProvider.replenishQueueIfNeeded()
if let controller = currentWebViewController {
controller.fullReload()
self.pageViewController.setViewControllers([controller], direction: .forward, animated: false, completion: nil)
}
}
@objc func willEnterForeground(_ note: Notification) {
// The toolbar will come back on you if you don't hide it again
if AppDefaults.articleFullscreenEnabled {