From 59e037986a3b1c5840ffda9005630fe9c52f247f Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 14 Jan 2019 12:15:13 -0700 Subject: [PATCH] Show error when image request fails --- .../PhotoLibrary/ImagePickerController.swift | 12 +++++++++--- Signal/translations/en.lproj/Localizable.strings | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift b/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift index 57c406c2f..3e99aab4a 100644 --- a/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift +++ b/Signal/src/ViewControllers/PhotoLibrary/ImagePickerController.swift @@ -317,10 +317,16 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat let attachmentPromises: [Promise] = assets.map({ 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) - }.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]) { diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 0f5fe12e5..fc1c1050b 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1086,6 +1086,9 @@ /* Label for crop button in image editor. */ "IMAGE_EDITOR_CROP_BUTTON" = "Crop"; +/* alert title */ +"IMAGE_PICKER_FAILED_TO_PROCESS_ATTACHMENTS" = "Failed to select attachment."; + /* Call setup status label */ "IN_CALL_CONNECTING" = "Connecting…"; @@ -2402,9 +2405,6 @@ /* Title for the alert indicating that user should 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 */ "VERIFICATION_BACK_BUTTON" = "Back";