diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 9a081ca4..46b7d157 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -467,9 +467,19 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro return } let currentItems = snapshot.itemIdentifiers(inSection: .statuses) - if case .status(id: let firstID, _, _) = currentItems.first, - // if there's no overlap between presentItems and the existing items in the data source, prompt the user - !presentItems.contains(firstID) { + func currentItemsContains(id: String) -> Bool { + return currentItems.contains { item in + switch item { + case .status(id: id, collapseState: _, filterState: _): + return true + default: + return false + } + } + } + // if there's no overlap between presentItems and the existing items in the data source, prompt the user + // we can't be clever here by just checking the first id in currentItems against presentItems, since that may belong to a since-unfollowed user + if !presentItems.contains(where: { currentItemsContains(id: $0) }) { let applySnapshotBeforeScrolling: Bool // remove any existing gap, if there is one