fix an issue there attachment error modal won't show up

pull/1023/head
Ryan ZHAO 1 year ago
parent fc47cf3961
commit 6d27ef0dfa

@ -358,8 +358,8 @@ extension ConversationVC:
let modal: ConfirmationModal = ConfirmationModal( let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view, targetView: self?.view,
info: ConfirmationModal.Info( info: ConfirmationModal.Info(
title: "attachmentsErrorNotSupported".localized(), title: "attachmentsErrorLoad".localized(),
body: .text("attachmentsErrorSize".localized()), body: .text("attachmentsErrorNotSupported".localized()),
cancelTitle: "okay".localized(), cancelTitle: "okay".localized(),
cancelStyle: .alert_text cancelStyle: .alert_text
) )
@ -2564,16 +2564,18 @@ extension ConversationVC:
// MARK: - Convenience // MARK: - Convenience
func showErrorAlert(for attachment: SignalAttachment) { func showErrorAlert(for attachment: SignalAttachment) {
let modal: ConfirmationModal = ConfirmationModal( DispatchQueue.main.async { [weak self] in
targetView: self.view, let modal: ConfirmationModal = ConfirmationModal(
info: ConfirmationModal.Info( targetView: self?.view,
title: "attachmentsErrorSending".localized(), info: ConfirmationModal.Info(
body: .text(attachment.localizedErrorDescription ?? SignalAttachment.missingDataErrorMessage), title: "attachmentsErrorSending".localized(),
cancelTitle: "okay".localized(), body: .text(attachment.localizedErrorDescription ?? SignalAttachment.missingDataErrorMessage),
cancelStyle: .alert_text cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)
) )
) self?.present(modal, animated: true)
self.present(modal, animated: true) }
} }
} }

@ -293,8 +293,8 @@ extension SendMediaNavigationController: PhotoCaptureViewControllerDelegate {
if !pushApprovalViewController() { if !pushApprovalViewController() {
let modal: ConfirmationModal = ConfirmationModal( let modal: ConfirmationModal = ConfirmationModal(
info: ConfirmationModal.Info( info: ConfirmationModal.Info(
title: "IMAGE_PICKER_FAILED_TO_PROCESS_ATTACHMENTS".localized(), title: "attachmentsErrorMediaSelection".localized(),
cancelTitle: "BUTTON_OK".localized(), cancelTitle: "okay".localized(),
cancelStyle: .alert_text cancelStyle: .alert_text
) )
) )

@ -40,14 +40,14 @@ extension String {
extension SignalAttachmentError: LocalizedError { extension SignalAttachmentError: LocalizedError {
public var errorDescription: String? { public var errorDescription: String? {
switch self { switch self {
case .fileSizeTooLarge: case .fileSizeTooLarge:
return "attachmentsErrorSize".localized() return "attachmentsErrorSize".localized()
case .invalidData, .missingData, .invalidFileFormat: case .invalidData, .missingData, .invalidFileFormat:
return "attachmentsErrorNotSupported".localized() return "attachmentsErrorNotSupported".localized()
case .couldNotConvertToJpeg, .couldNotParseImage, .couldNotConvertToMpeg4, .couldNotResizeImage: case .couldNotConvertToJpeg, .couldNotParseImage, .couldNotConvertToMpeg4, .couldNotResizeImage:
return "attachmentsErrorOpen".localized() return "attachmentsErrorOpen".localized()
case .couldNotRemoveMetadata: case .couldNotRemoveMetadata:
return "attachmentsImageErrorMetadata".localized() return "attachmentsImageErrorMetadata".localized()
} }
} }
} }

Loading…
Cancel
Save