Show error when image request fails

pull/1/head
Michael Kirk 6 years ago
parent 623c2574d0
commit 59e037986a

@ -317,10 +317,16 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
let attachmentPromises: [Promise<SignalAttachment>] = assets.map({ let attachmentPromises: [Promise<SignalAttachment>] = assets.map({
return photoCollectionContents.outgoingAttachment(for: $0) return photoCollectionContents.outgoingAttachment(for: $0)
}) })
when(fulfilled: attachmentPromises)
.map { attachments in firstly {
when(fulfilled: attachmentPromises)
}.map { attachments in
Logger.debug("built all attachments")
self.didComplete(withAttachments: attachments) self.didComplete(withAttachments: attachments)
}.retainUntilComplete() }.catch { error in
Logger.error("failed to prepare attachments. error: \(error)")
OWSAlerts.showAlert(title: NSLocalizedString("IMAGE_PICKER_FAILED_TO_PROCESS_ATTACHMENTS", comment: "alert title"))
}.retainUntilComplete()
} }
private func didComplete(withAttachments attachments: [SignalAttachment]) { private func didComplete(withAttachments attachments: [SignalAttachment]) {

@ -1086,6 +1086,9 @@
/* Label for crop button in image editor. */ /* Label for crop button in image editor. */
"IMAGE_EDITOR_CROP_BUTTON" = "Crop"; "IMAGE_EDITOR_CROP_BUTTON" = "Crop";
/* alert title */
"IMAGE_PICKER_FAILED_TO_PROCESS_ATTACHMENTS" = "Failed to select attachment.";
/* Call setup status label */ /* Call setup status label */
"IN_CALL_CONNECTING" = "Connecting…"; "IN_CALL_CONNECTING" = "Connecting…";
@ -2402,9 +2405,6 @@
/* Title for the alert indicating that user should upgrade iOS. */ /* Title for the alert indicating that user should upgrade iOS. */
"UPGRADE_IOS_ALERT_TITLE" = "Upgrade iOS"; "UPGRADE_IOS_ALERT_TITLE" = "Upgrade iOS";
/* No comment provided by engineer. */
"Upgrading Signal ..." = "Upgrading Signal…";
/* button text for back button on verification view */ /* button text for back button on verification view */
"VERIFICATION_BACK_BUTTON" = "Back"; "VERIFICATION_BACK_BUTTON" = "Back";

Loading…
Cancel
Save