Enable batch mode when popping to Media Library

pull/2/head
Michael Kirk 6 years ago
parent 41977f7437
commit abf35decde

@ -265,10 +265,20 @@ extension SendMediaNavigationController: UINavigationControllerDelegate {
} }
} }
if viewController is PhotoCaptureViewController && !isInBatchSelectMode { switch viewController {
// We're either showing the captureView for the first time or the user is navigating "back" case is PhotoCaptureViewController:
// indicating they want to "retake". We should discard any current image. if attachmentDraftCollection.count == 1 && !isInBatchSelectMode {
discardCameraDraft() // User is navigating "back" to the previous view, indicating
// they want to discard the previously captured item
discardDraft()
}
case is ImagePickerGridController:
if attachmentDraftCollection.count == 1 && !isInBatchSelectMode {
isInBatchSelectMode = true
self.mediaLibraryViewController.batchSelectModeDidChange()
}
default:
break
} }
self.updateButtons(topViewController: viewController) self.updateButtons(topViewController: viewController)
@ -318,12 +328,12 @@ extension SendMediaNavigationController: PhotoCaptureViewControllerDelegate {
didRequestExit(dontAbandonText: dontAbandonText) didRequestExit(dontAbandonText: dontAbandonText)
} }
func discardCameraDraft() { func discardDraft() {
assert(attachmentDraftCollection.cameraAttachments.count <= 1) assert(attachmentDraftCollection.attachmentDrafts.count <= 1)
if let lastCameraAttachment = attachmentDraftCollection.cameraAttachments.last { if let lastAttachmentDraft = attachmentDraftCollection.attachmentDrafts.last {
attachmentDraftCollection.remove(attachment: lastCameraAttachment) attachmentDraftCollection.remove(attachment: lastAttachmentDraft.attachment)
} }
assert(attachmentDraftCollection.cameraAttachments.count == 0) assert(attachmentDraftCollection.attachmentDrafts.count == 0)
} }
} }

Loading…
Cancel
Save