diff --git a/Tusker/Screens/Explore/AddSavedHashtagViewController.swift b/Tusker/Screens/Explore/AddSavedHashtagViewController.swift index 1eb7134a0c..a0bcee2f93 100644 --- a/Tusker/Screens/Explore/AddSavedHashtagViewController.swift +++ b/Tusker/Screens/Explore/AddSavedHashtagViewController.swift @@ -9,14 +9,14 @@ import UIKit import Pachyderm -class AddSavedHashtagViewController: UIViewController { +class AddSavedHashtagViewController: UIViewController, CollectionViewController { weak var mastodonController: MastodonController! var resultsController: SearchResultsViewController! var searchController: UISearchController! - private var collectionView: UICollectionView! + private(set) var collectionView: UICollectionView! private var dataSource: UICollectionViewDiffableDataSource! init(mastodonController: MastodonController) { @@ -91,6 +91,12 @@ class AddSavedHashtagViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + if searchController.isActive { + resultsController.clearSelectionOnAppear(animated: animated) + } + + clearSelectionOnAppear(animated: animated) + let request = Client.getTrendingHashtags(limit: 10) mastodonController.run(request) { (response) in var snapshot = NSDiffableDataSourceSnapshot() diff --git a/Tusker/Screens/Explore/ExploreViewController.swift b/Tusker/Screens/Explore/ExploreViewController.swift index b9ee9a092e..44f76d952e 100644 --- a/Tusker/Screens/Explore/ExploreViewController.swift +++ b/Tusker/Screens/Explore/ExploreViewController.swift @@ -96,7 +96,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect // so we manually propagate this down to the results controller // so that it can deselect on appear if searchController.isActive { - resultsController.viewWillAppear(animated) + resultsController.clearSelectionOnAppear(animated: animated) } clearSelectionOnAppear(animated: animated)