Hide unread account information unless the Account is collapsed. Issue #1159

This commit is contained in:
Maurice Parker 2019-10-23 08:53:09 -05:00
parent f0ecfa6150
commit 17af3f28bf
2 changed files with 10 additions and 2 deletions

View File

@ -29,7 +29,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
set { set {
if unreadCountView.unreadCount != newValue { if unreadCountView.unreadCount != newValue {
unreadCountView.unreadCount = newValue unreadCountView.unreadCount = newValue
unreadCountView.isHidden = (newValue < 1) updateUnreadCountView()
setNeedsLayout() setNeedsLayout()
} }
} }
@ -51,6 +51,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
var disclosureExpanded = false { var disclosureExpanded = false {
didSet { didSet {
updateDisclosureImage() updateDisclosureImage()
updateUnreadCountView()
} }
} }
@ -142,6 +143,14 @@ private extension MasterFeedTableViewSectionHeader {
} }
} }
func updateUnreadCountView() {
if !disclosureExpanded && unreadCount > 0 {
unreadCountView.isHidden = false
} else {
self.unreadCountView.isHidden = true
}
}
func addSubviewAtInit(_ view: UIView) { func addSubviewAtInit(_ view: UIView) {
addSubview(view) addSubview(view)
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false

View File

@ -11,7 +11,6 @@ import Account
import Articles import Articles
import RSCore import RSCore
import RSTree import RSTree
import SwiftUI
class MasterFeedViewController: UITableViewController, UndoableCommandRunner { class MasterFeedViewController: UITableViewController, UndoableCommandRunner {