From e4cb868ff6d651651f4e80621341852969cd591d Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 24 Jan 2022 08:37:58 +0800 Subject: [PATCH] Removes unused unread count code --- .../MasterFeedTableViewSectionHeader.swift | 33 +------------------ iOS/MasterFeed/MasterFeedViewController.swift | 14 ++------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index d0d899cb5..a2aff10d4 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -19,12 +19,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { override var accessibilityLabel: String? { set {} get { - if unreadCount > 0 { - let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity") - return "\(name) \(unreadCount) \(unreadLabel) \(expandedStateMessage) " - } else { - return "\(name) \(expandedStateMessage) " - } + return "\(name) \(expandedStateMessage)" } } @@ -38,19 +33,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { } } - var unreadCount: Int { - get { - return unreadCountView.unreadCount - } - set { - if unreadCountView.unreadCount != newValue { - unreadCountView.unreadCount = newValue - updateUnreadCountView() - setNeedsLayout() - } - } - } - var name: String { get { return titleView.text ?? "" @@ -66,7 +48,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { var disclosureExpanded = false { didSet { updateExpandedState(animate: true) - updateUnreadCountView() } } @@ -168,18 +149,6 @@ private extension MasterFeedTableViewSectionHeader { } }) } - - func updateUnreadCountView() { - if !disclosureExpanded && unreadCount > 0 { - UIView.animate(withDuration: 0.3) { - self.unreadCountView.alpha = 1 - } - } else { - UIView.animate(withDuration: 0.3) { - self.unreadCountView.alpha = 0 - } - } - } func addSubviewAtInit(_ view: UIView) { contentView.addSubview(view) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 1526b98ff..ea5893150 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -99,13 +99,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { return } - if let account = unreadCountProvider as? Account { - if let node = coordinator.rootNode.childNodeRepresentingObject(account) { - let sectionIndex = coordinator.rootNode.indexOfChild(node)! - if let headerView = tableView.headerView(forSection: sectionIndex) as? MasterFeedTableViewSectionHeader { - headerView.unreadCount = account.unreadCount - } - } + if let _ = unreadCountProvider as? Account { return } @@ -203,11 +197,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { return headerView } - if let account = sectionNode.representedObject as? Account { - headerView.unreadCount = account.unreadCount - } else { - headerView.unreadCount = 0 - } + headerView.tag = section headerView.disclosureExpanded = coordinator.isExpanded(sectionNode)