Fix add saved hashtag search results selection not being cleared

This commit is contained in:
Shadowfacts 2024-09-09 23:53:37 -04:00
parent 522e7830e5
commit 93e72e1cb6
2 changed files with 9 additions and 3 deletions

View File

@ -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<Section, Item>!
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<Section, Item>()

View File

@ -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)