mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
per design: "back" is retake for first photo
This commit is contained in:
parent
26ef36dc55
commit
db410becb7
1 changed files with 26 additions and 0 deletions
|
@ -259,6 +259,13 @@ extension SendMediaNavigationController: UINavigationControllerDelegate {
|
|||
owsFailDebug("unexpected navigationBar: \(navigationBar)")
|
||||
}
|
||||
}
|
||||
|
||||
if viewController is PhotoCaptureViewController && !isInBatchSelectMode {
|
||||
// We're either showing the captureView for the first time or the user is navigating "back"
|
||||
// indicating they want to "retake". We should discard any current image.
|
||||
discardCameraDraft()
|
||||
}
|
||||
|
||||
self.updateButtons(topViewController: viewController)
|
||||
}
|
||||
|
||||
|
@ -305,6 +312,14 @@ extension SendMediaNavigationController: PhotoCaptureViewControllerDelegate {
|
|||
let dontAbandonText = NSLocalizedString("SEND_MEDIA_RETURN_TO_CAMERA", comment: "alert action when the user decides not to cancel the media flow after all.")
|
||||
didRequestExit(dontAbandonText: dontAbandonText)
|
||||
}
|
||||
|
||||
func discardCameraDraft() {
|
||||
assert(attachmentDraftCollection.cameraAttachments.count <= 1)
|
||||
if let lastCameraAttachment = attachmentDraftCollection.cameraAttachments.last {
|
||||
attachmentDraftCollection.remove(attachment: lastCameraAttachment)
|
||||
}
|
||||
assert(attachmentDraftCollection.cameraAttachments.count == 0)
|
||||
}
|
||||
}
|
||||
|
||||
extension SendMediaNavigationController: ImagePickerGridControllerDelegate {
|
||||
|
@ -457,6 +472,17 @@ private struct AttachmentDraftCollection {
|
|||
}
|
||||
}
|
||||
|
||||
var cameraAttachments: [SignalAttachment] {
|
||||
return attachmentDrafts.compactMap { attachmentDraft in
|
||||
switch attachmentDraft.source {
|
||||
case .picker:
|
||||
return nil
|
||||
case .camera(let cameraAttachment):
|
||||
return cameraAttachment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutating func append(_ element: AttachmentDraft) {
|
||||
attachmentDrafts.append(element)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue