Prevent refresh errors from keeping the refreshControl visible when error dialogs are displayed.

This commit is contained in:
Maurice Parker 2019-07-18 15:16:54 -05:00
parent 8a5730267b
commit b25e789aef
2 changed files with 11 additions and 3 deletions

View File

@ -596,10 +596,14 @@ extension MasterFeedViewController: MasterFeedTableViewCellDelegate {
private extension MasterFeedViewController {
@objc private func refreshAccounts(_ sender: Any) {
AccountManager.shared.refreshAll(errorHandler: ErrorHandler.present(self))
refreshControl?.endRefreshing()
// This is a hack to make sure that an error dialog doesn't interfere with dismissing the refreshControl.
// If the error dialog appears too closely to the call to endRefreshing, then the refreshControl never disappears.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
AccountManager.shared.refreshAll(errorHandler: ErrorHandler.present(self))
}
}
func updateUI() {
markAllAsReadButton.isEnabled = coordinator.isAnyUnreadAvailable
addNewItemButton.isEnabled = !AccountManager.shared.activeAccounts.isEmpty

View File

@ -339,8 +339,12 @@ class MasterTimelineViewController: ProgressTableViewController, UndoableCommand
private extension MasterTimelineViewController {
@objc private func refreshAccounts(_ sender: Any) {
AccountManager.shared.refreshAll(errorHandler: ErrorHandler.present(self))
refreshControl?.endRefreshing()
// This is a hack to make sure that an error dialog doesn't interfere with dismissing the refreshControl.
// If the error dialog appears too closely to the call to endRefreshing, then the refreshControl never disappears.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
AccountManager.shared.refreshAll(errorHandler: ErrorHandler.present(self))
}
}
func resetUI() {