Move mark as read functionality to the detail view.
This commit is contained in:
parent
05f8dc38c4
commit
5b75add585
|
@ -29,12 +29,19 @@ class DetailViewController: UIViewController {
|
|||
super.viewDidLoad()
|
||||
self.navigationController?.navigationItem.largeTitleDisplayMode = .never
|
||||
webView.navigationDelegate = self
|
||||
markAsRead()
|
||||
reloadUI()
|
||||
reloadHTML()
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(articleSelectionChange(_:)), name: .ArticleSelectionChange, object: navState)
|
||||
}
|
||||
|
||||
func markAsRead() {
|
||||
if let article = navState?.currentArticle {
|
||||
markArticles(Set([article]), statusKey: .read, flag: true)
|
||||
}
|
||||
}
|
||||
|
||||
func reloadUI() {
|
||||
|
||||
guard let article = navState?.currentArticle else {
|
||||
|
@ -86,6 +93,7 @@ class DetailViewController: UIViewController {
|
|||
}
|
||||
|
||||
@objc func articleSelectionChange(_ note: Notification) {
|
||||
markAsRead()
|
||||
reloadUI()
|
||||
reloadHTML()
|
||||
}
|
||||
|
|
|
@ -270,10 +270,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
|
||||
@objc func articleSelectionChange(_ note: Notification) {
|
||||
|
||||
if let indexPath = navState?.currentArticleIndexPath, let article = navState?.articles[indexPath.row] {
|
||||
if !article.status.read {
|
||||
markArticles(Set([article]), statusKey: .read, flag: true)
|
||||
}
|
||||
if let indexPath = navState?.currentArticleIndexPath {
|
||||
// TODO: make this scroll like the desktop version
|
||||
if tableView.indexPathForSelectedRow != indexPath {
|
||||
tableView.selectRow(at: indexPath, animated: true, scrollPosition: .middle)
|
||||
|
|
Loading…
Reference in New Issue