From d3e71cea7422b70c16ea3dba64d2643e3a902cf6 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 31 Mar 2023 14:52:39 +0200 Subject: [PATCH] Fix screenshots sharing on iOS 16.4 --- .../Components/StatusEditorUTTypeSupported.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorUTTypeSupported.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorUTTypeSupported.swift index 389cfcdd..ff469c05 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorUTTypeSupported.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorUTTypeSupported.swift @@ -65,14 +65,14 @@ enum StatusEditorUTTypeSupported: String, CaseIterable { return transferable } else if isGif, let transferable = await getGifTransferable(item: item) { return transferable - } else if let transferable = await getImageTansferable(item: item) { - return transferable } let compressor = StatusEditorCompressor() let result = try await item.loadItem(forTypeIdentifier: rawValue) if self == .jpeg || self == .png || self == .tiff || self == .image || self == .uiimage || self == .adobeRawImage { - if let image = result as? UIImage { - return image + if let image = result as? UIImage, + let compressedData = try? await compressor.compressImageForUpload(image), + let compressedImage = UIImage(data: compressedData) { + return compressedImage } else if let imageURL = result as? URL, let compressedData = await compressor.compressImageFrom(url: imageURL), let image = UIImage(data: compressedData) @@ -84,6 +84,9 @@ enum StatusEditorUTTypeSupported: String, CaseIterable { return image } } + if let transferable = await getImageTansferable(item: item) { + return transferable + } if let url = result as? URL { return url.absoluteString } else if let text = result as? String {