From d85350bf8f62077e704c773ea146bf431489751f Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 10 Dec 2018 10:11:53 -0700 Subject: [PATCH] remain in "multiselect" mode after switching PhotoCollection --- .../PhotoLibrary/ImagePickerController.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift b/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift index 60c5b38dc..46c555f2e 100644 --- a/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift +++ b/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift @@ -360,12 +360,15 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat func endSelectMode() { isInBatchSelectMode = false + deselectAnySelected() + } + + func deselectAnySelected() { guard let collectionView = self.collectionView else { owsFailDebug("collectionView was unexpectedly nil") return } - // deselect any selected collectionView.indexPathsForSelectedItems?.forEach { collectionView.deselectItem(at: $0, animated: false)} } @@ -447,9 +450,8 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat return } - // Iff we switched albums, discard any selection and make sure the "Select" button shows, - // not the "Done" button - endSelectMode() + // Any selections are invalid as they refer to indices in a different collection + deselectAnySelected() photoCollection = collection photoCollectionContents = photoCollection.contents()