mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +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:
@@ -25,14 +25,15 @@ enum MediaPickerScreenSource {
|
||||
enum MediaPickerScreenCoordinatorAction {
|
||||
case selectMediaAtURL(URL)
|
||||
case cancel
|
||||
case error(Error?)
|
||||
}
|
||||
|
||||
class MediaPickerScreenCoordinator: CoordinatorProtocol {
|
||||
private weak var userIndicatorController: UserIndicatorControllerProtocol?
|
||||
private let source: MediaPickerScreenSource
|
||||
private let callback: ((MediaPickerScreenCoordinatorAction) -> Void)?
|
||||
|
||||
init(source: MediaPickerScreenSource, callback: @escaping (MediaPickerScreenCoordinatorAction) -> Void) {
|
||||
init(userIndicatorController: UserIndicatorControllerProtocol, source: MediaPickerScreenSource, callback: @escaping (MediaPickerScreenCoordinatorAction) -> Void) {
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.source = source
|
||||
self.callback = callback
|
||||
}
|
||||
@@ -52,7 +53,8 @@ class MediaPickerScreenCoordinator: CoordinatorProtocol {
|
||||
case .cancel:
|
||||
self?.callback?(.cancel)
|
||||
case .error(let error):
|
||||
self?.callback?(.error(error))
|
||||
MXLog.error("Failed selecting media from the photo library with error: \(error)")
|
||||
self?.showError()
|
||||
case .selectFile(let url):
|
||||
self?.callback?(.selectMediaAtURL(url))
|
||||
}
|
||||
@@ -65,7 +67,8 @@ class MediaPickerScreenCoordinator: CoordinatorProtocol {
|
||||
case .cancel:
|
||||
self.callback?(.cancel)
|
||||
case .error(let error):
|
||||
self.callback?(.error(error))
|
||||
MXLog.error("Failed selecting media from the document picker with error: \(error)")
|
||||
self.showError()
|
||||
case .selectFile(let url):
|
||||
self.callback?(.selectMediaAtURL(url))
|
||||
}
|
||||
@@ -79,11 +82,16 @@ class MediaPickerScreenCoordinator: CoordinatorProtocol {
|
||||
case .cancel:
|
||||
self?.callback?(.cancel)
|
||||
case .error(let error):
|
||||
self?.callback?(.error(error))
|
||||
MXLog.error("Failed selecting media from the camera picker with error: \(error)")
|
||||
self?.showError()
|
||||
case .selectFile(let url):
|
||||
self?.callback?(.selectMediaAtURL(url))
|
||||
}
|
||||
}
|
||||
.background(.black, ignoresSafeAreaEdges: .bottom)
|
||||
}
|
||||
|
||||
private func showError() {
|
||||
userIndicatorController?.submitIndicator(UserIndicator(title: L10n.screenMediaPickerErrorFailedSelection))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user