remain in "multiselect" mode after switching PhotoCollection

pull/1/head
Michael Kirk 6 years ago
parent e776a2410c
commit d85350bf8f

@ -360,12 +360,15 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
func endSelectMode() { func endSelectMode() {
isInBatchSelectMode = false isInBatchSelectMode = false
deselectAnySelected()
}
func deselectAnySelected() {
guard let collectionView = self.collectionView else { guard let collectionView = self.collectionView else {
owsFailDebug("collectionView was unexpectedly nil") owsFailDebug("collectionView was unexpectedly nil")
return return
} }
// deselect any selected
collectionView.indexPathsForSelectedItems?.forEach { collectionView.deselectItem(at: $0, animated: false)} collectionView.indexPathsForSelectedItems?.forEach { collectionView.deselectItem(at: $0, animated: false)}
} }
@ -447,9 +450,8 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
return return
} }
// Iff we switched albums, discard any selection and make sure the "Select" button shows, // Any selections are invalid as they refer to indices in a different collection
// not the "Done" button deselectAnySelected()
endSelectMode()
photoCollection = collection photoCollection = collection
photoCollectionContents = photoCollection.contents() photoCollectionContents = photoCollection.contents()

Loading…
Cancel
Save