Skip to content

Commit

Permalink
Bug fix: crash when trying to ungroup/group collectibles while search…
Browse files Browse the repository at this point in the history
…ing. Now cancels search and reloads
  • Loading branch information
simonmcl committed Jun 5, 2024
1 parent 15c2c6c commit ff20e87
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CollectiblesCollectionsViewController: UIViewController, UICollectionViewD
private var movingToDetails = false
private var textFieldDone = false
private var lastSearchedTerm: String? = nil
private var ignoreNextTextFieldDidEnd = true

public weak var delegate: UIViewController? = nil

Expand Down Expand Up @@ -92,6 +93,12 @@ class CollectiblesCollectionsViewController: UIViewController, UICollectionViewD
}

func needsRefreshFromParent() {
if viewModel.isSearching {
self.clearSearchTextField()
viewModel.isSearching = false
ignoreNextTextFieldDidEnd = true
}

refreshingFromParent = true
viewModel.refresh(animate: true)
}
Expand Down Expand Up @@ -174,11 +181,12 @@ extension CollectiblesCollectionsViewController: ValidatorTextFieldDelegate {
}

public func textFieldDidEndEditing(_ textField: UITextField) {
if !movingToDetails && !textFieldDone {
if !movingToDetails && !textFieldDone && !ignoreNextTextFieldDidEnd {
self.hideSearchingUI()
}

textFieldDone = false
ignoreNextTextFieldDidEnd = false
}

func textFieldShouldClear(_ textField: UITextField) -> Bool {
Expand Down

0 comments on commit ff20e87

Please sign in to comment.