mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Media uploading (#851)
* MediaUploadingPreprocessor - Prevent images without any GPS metadata from being changed * Add support for sending images * Add support for sending video, audio and file attachments * Rename MediaPickerPreview to MediaUploadPreview * Move media uploading to the MediaUploadPreviewScreen, add waiting indicators and error handling * Add support for pasting and drag&dropping in media for upload * Adopt new media picker source UI, remove developer flag * Set minimum heights for timeline loadable images * Fix invalid camera picker file names * Fix flakey MediaUploadingPreprocessor image tests, improve gps metadata stripping * UITests: Update existing screenshots and add new step for the room attachment picker * Switch all github action runners to macos-13 * Cleanup enter key and paste message composer handlers
This commit is contained in:
@@ -20,7 +20,12 @@ import SwiftUI
|
||||
enum PhotoLibraryPickerAction {
|
||||
case selectFile(URL)
|
||||
case cancel
|
||||
case error(Error?)
|
||||
case error(PhotoLibraryPickerError)
|
||||
}
|
||||
|
||||
enum PhotoLibraryPickerError: Error {
|
||||
case failedLoadingFileRepresentation(Error?)
|
||||
case failedCopyingFile
|
||||
}
|
||||
|
||||
struct PhotoLibraryPicker: UIViewControllerRepresentable {
|
||||
@@ -63,7 +68,9 @@ struct PhotoLibraryPicker: UIViewControllerRepresentable {
|
||||
|
||||
provider.loadFileRepresentation(forTypeIdentifier: "public.item") { [weak self] url, error in
|
||||
guard let url else {
|
||||
self?.photoLibraryPicker.callback(.error(error))
|
||||
Task { @MainActor in
|
||||
self?.photoLibraryPicker.callback(.error(.failedLoadingFileRepresentation(error)))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -76,7 +83,9 @@ struct PhotoLibraryPicker: UIViewControllerRepresentable {
|
||||
self?.photoLibraryPicker.callback(.selectFile(newURL))
|
||||
}
|
||||
} catch {
|
||||
self?.photoLibraryPicker.callback(.error(error))
|
||||
Task { @MainActor in
|
||||
self?.photoLibraryPicker.callback(.error(.failedCopyingFile))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user