CR: Enforce "one time only" with a bool, not a cell ref

Since cell's can be re-used, at a later point, we might not be
referencing the data we intend. Since all we want to do is enforce a
"one time only" check, just use a bool.

// FREEBIE
This commit is contained in:
Michael Kirk 2017-10-20 11:19:52 -07:00
parent 591cba6468
commit 688810c267
1 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
var noResultsView: UILabel?
var searchErrorView: UILabel?
var activityIndicator: UIActivityIndicatorView?
var selectedCell: UICollectionViewCell?
var hasSelectedCell: Bool = false
var imageInfos = [GiphyImageInfo]()
var reachability: Reachability?
@ -312,11 +312,11 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
return
}
guard self.selectedCell == nil else {
guard self.hasSelectedCell == false else {
owsFail("\(TAG) Already selected cell")
return
}
self.selectedCell = cell
self.hasSelectedCell = true
// Fade out all cells except the selected one.
let maskingView = OWSBezierPathView()