Add pull to refresh to the timeline.
This commit is contained in:
parent
04dab356eb
commit
c9cf35ed1f
|
@ -76,10 +76,6 @@ class MasterViewController: UITableViewController, UndoableCommandRunner {
|
|||
|
||||
// MARK: Notifications
|
||||
|
||||
@objc private func refreshAccounts(_ sender: Any) {
|
||||
AccountManager.shared.refreshAll()
|
||||
}
|
||||
|
||||
@objc dynamic func progressDidChange(_ notification: Notification) {
|
||||
if AccountManager.shared.combinedRefreshProgress.isComplete {
|
||||
refreshControl?.endRefreshing()
|
||||
|
@ -537,6 +533,10 @@ extension MasterViewController: MasterTableViewCellDelegate {
|
|||
|
||||
private extension MasterViewController {
|
||||
|
||||
@objc private func refreshAccounts(_ sender: Any) {
|
||||
AccountManager.shared.refreshAll()
|
||||
}
|
||||
|
||||
func rebuildBackingStoresAndReloadDataIfNeeded() {
|
||||
if !animatingChanges && !BatchUpdate.shared.isPerforming {
|
||||
treeController.rebuild()
|
||||
|
|
|
@ -111,7 +111,11 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
NotificationCenter.default.addObserver(self, selector: #selector(imageDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountDidDownloadArticles(_:)), name: .AccountDidDownloadArticles, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
|
||||
|
||||
refreshControl = UIRefreshControl()
|
||||
refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
|
||||
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
@ -238,6 +242,14 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
|
||||
// MARK: Notifications
|
||||
|
||||
@objc dynamic func progressDidChange(_ notification: Notification) {
|
||||
if AccountManager.shared.combinedRefreshProgress.isComplete {
|
||||
refreshControl?.endRefreshing()
|
||||
} else {
|
||||
refreshControl?.beginRefreshing()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func statusesDidChange(_ note: Notification) {
|
||||
|
||||
guard let articles = note.userInfo?[Account.UserInfoKey.articles] as? Set<Article> else {
|
||||
|
@ -399,6 +411,10 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
|
||||
private extension MasterTimelineViewController {
|
||||
|
||||
@objc private func refreshAccounts(_ sender: Any) {
|
||||
AccountManager.shared.refreshAll()
|
||||
}
|
||||
|
||||
func configureTimelineCell(_ cell: MasterTimelineTableViewCell, article: Article) {
|
||||
|
||||
var avatar = avatarFor(article)
|
||||
|
|
Loading…
Reference in New Issue