From 5cc2605add34498aa54f885a89ee2f2ff18f1481 Mon Sep 17 00:00:00 2001 From: Andrew Mackarous Date: Sun, 7 Jun 2020 17:46:48 -0400 Subject: [PATCH] Fix issue #2132 --- iOS/MasterFeed/MasterFeedViewController.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index d868a967c..e2d8f5ef8 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -640,12 +640,23 @@ private extension MasterFeedViewController { func queueApply(snapshot: NSDiffableDataSourceSnapshot, animatingDifferences: Bool = true, completion: (() -> Void)? = nil) { let operation = MasterFeedDataSourceOperation(dataSource: dataSource, snapshot: snapshot, animating: animatingDifferences) - operation.completionBlock = { _ in + operation.completionBlock = { [weak self] _ in + self?.enableTableViewSelection() completion?() } + disableTableViewSelectionIfNecessary() operationQueue.add(operation) } + private func disableTableViewSelectionIfNecessary() { + // We only need to disable tableView selection if the feeds are filtered by unread + guard coordinator.isReadFeedsFiltered else { return } + tableView.allowsSelection = false + } + + private func enableTableViewSelection() { + tableView.allowsSelection = true + } func makeDataSource() -> MasterFeedDataSource { let dataSource = MasterFeedDataSource(tableView: tableView, cellProvider: { [weak self] tableView, indexPath, node in