forked from shadowfacts/Tusker
Fix add saved hashtag search results selection not being cleared
This commit is contained in:
parent
522e7830e5
commit
93e72e1cb6
|
@ -9,14 +9,14 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
|
||||||
class AddSavedHashtagViewController: UIViewController {
|
class AddSavedHashtagViewController: UIViewController, CollectionViewController {
|
||||||
|
|
||||||
weak var mastodonController: MastodonController!
|
weak var mastodonController: MastodonController!
|
||||||
|
|
||||||
var resultsController: SearchResultsViewController!
|
var resultsController: SearchResultsViewController!
|
||||||
var searchController: UISearchController!
|
var searchController: UISearchController!
|
||||||
|
|
||||||
private var collectionView: UICollectionView!
|
private(set) var collectionView: UICollectionView!
|
||||||
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||||
|
|
||||||
init(mastodonController: MastodonController) {
|
init(mastodonController: MastodonController) {
|
||||||
|
@ -91,6 +91,12 @@ class AddSavedHashtagViewController: UIViewController {
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
|
if searchController.isActive {
|
||||||
|
resultsController.clearSelectionOnAppear(animated: animated)
|
||||||
|
}
|
||||||
|
|
||||||
|
clearSelectionOnAppear(animated: animated)
|
||||||
|
|
||||||
let request = Client.getTrendingHashtags(limit: 10)
|
let request = Client.getTrendingHashtags(limit: 10)
|
||||||
mastodonController.run(request) { (response) in
|
mastodonController.run(request) { (response) in
|
||||||
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||||
|
|
|
@ -96,7 +96,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect
|
||||||
// so we manually propagate this down to the results controller
|
// so we manually propagate this down to the results controller
|
||||||
// so that it can deselect on appear
|
// so that it can deselect on appear
|
||||||
if searchController.isActive {
|
if searchController.isActive {
|
||||||
resultsController.viewWillAppear(animated)
|
resultsController.clearSelectionOnAppear(animated: animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelectionOnAppear(animated: animated)
|
clearSelectionOnAppear(animated: animated)
|
||||||
|
|
Loading…
Reference in New Issue