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:
Stefan Ceriu
2023-05-04 16:09:29 +03:00
committed by GitHub
parent e9c07c9f8f
commit 93e3a1a80b
100 changed files with 809 additions and 393 deletions
@@ -595,6 +595,69 @@ class RoomProxyMock: RoomProxyProtocol {
return sendImageUrlThumbnailURLImageInfoReturnValue
}
}
//MARK: - sendVideo
var sendVideoUrlThumbnailURLVideoInfoCallsCount = 0
var sendVideoUrlThumbnailURLVideoInfoCalled: Bool {
return sendVideoUrlThumbnailURLVideoInfoCallsCount > 0
}
var sendVideoUrlThumbnailURLVideoInfoReceivedArguments: (url: URL, thumbnailURL: URL, videoInfo: VideoInfo)?
var sendVideoUrlThumbnailURLVideoInfoReceivedInvocations: [(url: URL, thumbnailURL: URL, videoInfo: VideoInfo)] = []
var sendVideoUrlThumbnailURLVideoInfoReturnValue: Result<Void, RoomProxyError>!
var sendVideoUrlThumbnailURLVideoInfoClosure: ((URL, URL, VideoInfo) async -> Result<Void, RoomProxyError>)?
func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo) async -> Result<Void, RoomProxyError> {
sendVideoUrlThumbnailURLVideoInfoCallsCount += 1
sendVideoUrlThumbnailURLVideoInfoReceivedArguments = (url: url, thumbnailURL: thumbnailURL, videoInfo: videoInfo)
sendVideoUrlThumbnailURLVideoInfoReceivedInvocations.append((url: url, thumbnailURL: thumbnailURL, videoInfo: videoInfo))
if let sendVideoUrlThumbnailURLVideoInfoClosure = sendVideoUrlThumbnailURLVideoInfoClosure {
return await sendVideoUrlThumbnailURLVideoInfoClosure(url, thumbnailURL, videoInfo)
} else {
return sendVideoUrlThumbnailURLVideoInfoReturnValue
}
}
//MARK: - sendAudio
var sendAudioUrlAudioInfoCallsCount = 0
var sendAudioUrlAudioInfoCalled: Bool {
return sendAudioUrlAudioInfoCallsCount > 0
}
var sendAudioUrlAudioInfoReceivedArguments: (url: URL, audioInfo: AudioInfo)?
var sendAudioUrlAudioInfoReceivedInvocations: [(url: URL, audioInfo: AudioInfo)] = []
var sendAudioUrlAudioInfoReturnValue: Result<Void, RoomProxyError>!
var sendAudioUrlAudioInfoClosure: ((URL, AudioInfo) async -> Result<Void, RoomProxyError>)?
func sendAudio(url: URL, audioInfo: AudioInfo) async -> Result<Void, RoomProxyError> {
sendAudioUrlAudioInfoCallsCount += 1
sendAudioUrlAudioInfoReceivedArguments = (url: url, audioInfo: audioInfo)
sendAudioUrlAudioInfoReceivedInvocations.append((url: url, audioInfo: audioInfo))
if let sendAudioUrlAudioInfoClosure = sendAudioUrlAudioInfoClosure {
return await sendAudioUrlAudioInfoClosure(url, audioInfo)
} else {
return sendAudioUrlAudioInfoReturnValue
}
}
//MARK: - sendFile
var sendFileUrlFileInfoCallsCount = 0
var sendFileUrlFileInfoCalled: Bool {
return sendFileUrlFileInfoCallsCount > 0
}
var sendFileUrlFileInfoReceivedArguments: (url: URL, fileInfo: FileInfo)?
var sendFileUrlFileInfoReceivedInvocations: [(url: URL, fileInfo: FileInfo)] = []
var sendFileUrlFileInfoReturnValue: Result<Void, RoomProxyError>!
var sendFileUrlFileInfoClosure: ((URL, FileInfo) async -> Result<Void, RoomProxyError>)?
func sendFile(url: URL, fileInfo: FileInfo) async -> Result<Void, RoomProxyError> {
sendFileUrlFileInfoCallsCount += 1
sendFileUrlFileInfoReceivedArguments = (url: url, fileInfo: fileInfo)
sendFileUrlFileInfoReceivedInvocations.append((url: url, fileInfo: fileInfo))
if let sendFileUrlFileInfoClosure = sendFileUrlFileInfoClosure {
return await sendFileUrlFileInfoClosure(url, fileInfo)
} else {
return sendFileUrlFileInfoReturnValue
}
}
//MARK: - editMessage
var editMessageOriginalCallsCount = 0