Enable local echoes for media uploads for all builds. (#3579)

* Enable local echoes for media uploads for all builds.

* Update a string.
This commit is contained in:
Doug 2024-12-03 11:28:21 +00:00 committed by GitHub
parent 4372048c61
commit 4187155159
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 139 additions and 175 deletions

View File

@ -352,7 +352,7 @@
"rich_text_editor_unindent" = "Unindent"; "rich_text_editor_unindent" = "Unindent";
"rich_text_editor_url_placeholder" = "Link"; "rich_text_editor_url_placeholder" = "Link";
"rich_text_editor_a11y_add_attachment" = "Add attachment"; "rich_text_editor_a11y_add_attachment" = "Add attachment";
"rich_text_editor_composer_caption_placeholder" = "Optional caption…"; "rich_text_editor_composer_caption_placeholder" = "Add a caption";
"screen_advanced_settings_element_call_base_url" = "Custom Element Call base URL"; "screen_advanced_settings_element_call_base_url" = "Custom Element Call base URL";
"screen_advanced_settings_element_call_base_url_description" = "Set a custom base URL for Element Call."; "screen_advanced_settings_element_call_base_url_description" = "Set a custom base URL for Element Call.";
"screen_advanced_settings_element_call_base_url_validation_error" = "Invalid URL, please make sure you include the protocol (http/https) and the correct address."; "screen_advanced_settings_element_call_base_url_validation_error" = "Invalid URL, please make sure you include the protocol (http/https) and the correct address.";

View File

@ -796,7 +796,7 @@ internal enum L10n {
internal static var richTextEditorCloseFormattingOptions: String { return L10n.tr("Localizable", "rich_text_editor_close_formatting_options") } internal static var richTextEditorCloseFormattingOptions: String { return L10n.tr("Localizable", "rich_text_editor_close_formatting_options") }
/// Toggle code block /// Toggle code block
internal static var richTextEditorCodeBlock: String { return L10n.tr("Localizable", "rich_text_editor_code_block") } internal static var richTextEditorCodeBlock: String { return L10n.tr("Localizable", "rich_text_editor_code_block") }
/// Optional caption /// Add a caption
internal static var richTextEditorComposerCaptionPlaceholder: String { return L10n.tr("Localizable", "rich_text_editor_composer_caption_placeholder") } internal static var richTextEditorComposerCaptionPlaceholder: String { return L10n.tr("Localizable", "rich_text_editor_composer_caption_placeholder") }
/// Message /// Message
internal static var richTextEditorComposerPlaceholder: String { return L10n.tr("Localizable", "rich_text_editor_composer_placeholder") } internal static var richTextEditorComposerPlaceholder: String { return L10n.tr("Localizable", "rich_text_editor_composer_placeholder") }

View File

@ -14114,15 +14114,15 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
//MARK: - sendAudio //MARK: - sendAudio
var sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = 0 var sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount = 0
var sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleCallsCount: Int { var sendAudioUrlAudioInfoCaptionRequestHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount return sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount returnValue = sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -14130,27 +14130,27 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleCalled: Bool { var sendAudioUrlAudioInfoCaptionRequestHandleCalled: Bool {
return sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleCallsCount > 0 return sendAudioUrlAudioInfoCaptionRequestHandleCallsCount > 0
} }
var sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>! var sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleReturnValue: Result<Void, TimelineProxyError>! { var sendAudioUrlAudioInfoCaptionRequestHandleReturnValue: Result<Void, TimelineProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue return sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, TimelineProxyError>? = nil var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue returnValue = sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -14158,35 +14158,35 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleClosure: ((URL, AudioInfo, String?, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)? var sendAudioUrlAudioInfoCaptionRequestHandleClosure: ((URL, AudioInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)?
func sendAudio(url: URL, audioInfo: AudioInfo, caption: String?, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { func sendAudio(url: URL, audioInfo: AudioInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleCallsCount += 1 sendAudioUrlAudioInfoCaptionRequestHandleCallsCount += 1
if let sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleClosure = sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleClosure { if let sendAudioUrlAudioInfoCaptionRequestHandleClosure = sendAudioUrlAudioInfoCaptionRequestHandleClosure {
return await sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleClosure(url, audioInfo, caption, progressSubject, requestHandle) return await sendAudioUrlAudioInfoCaptionRequestHandleClosure(url, audioInfo, caption, requestHandle)
} else { } else {
return sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleReturnValue return sendAudioUrlAudioInfoCaptionRequestHandleReturnValue
} }
} }
//MARK: - sendFile //MARK: - sendFile
var sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = 0 var sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount = 0
var sendFileUrlFileInfoCaptionProgressSubjectRequestHandleCallsCount: Int { var sendFileUrlFileInfoCaptionRequestHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount return sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount returnValue = sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -14194,27 +14194,27 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var sendFileUrlFileInfoCaptionProgressSubjectRequestHandleCalled: Bool { var sendFileUrlFileInfoCaptionRequestHandleCalled: Bool {
return sendFileUrlFileInfoCaptionProgressSubjectRequestHandleCallsCount > 0 return sendFileUrlFileInfoCaptionRequestHandleCallsCount > 0
} }
var sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>! var sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var sendFileUrlFileInfoCaptionProgressSubjectRequestHandleReturnValue: Result<Void, TimelineProxyError>! { var sendFileUrlFileInfoCaptionRequestHandleReturnValue: Result<Void, TimelineProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue return sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, TimelineProxyError>? = nil var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue returnValue = sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -14222,35 +14222,35 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendFileUrlFileInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var sendFileUrlFileInfoCaptionProgressSubjectRequestHandleClosure: ((URL, FileInfo, String?, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)? var sendFileUrlFileInfoCaptionRequestHandleClosure: ((URL, FileInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)?
func sendFile(url: URL, fileInfo: FileInfo, caption: String?, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { func sendFile(url: URL, fileInfo: FileInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
sendFileUrlFileInfoCaptionProgressSubjectRequestHandleCallsCount += 1 sendFileUrlFileInfoCaptionRequestHandleCallsCount += 1
if let sendFileUrlFileInfoCaptionProgressSubjectRequestHandleClosure = sendFileUrlFileInfoCaptionProgressSubjectRequestHandleClosure { if let sendFileUrlFileInfoCaptionRequestHandleClosure = sendFileUrlFileInfoCaptionRequestHandleClosure {
return await sendFileUrlFileInfoCaptionProgressSubjectRequestHandleClosure(url, fileInfo, caption, progressSubject, requestHandle) return await sendFileUrlFileInfoCaptionRequestHandleClosure(url, fileInfo, caption, requestHandle)
} else { } else {
return sendFileUrlFileInfoCaptionProgressSubjectRequestHandleReturnValue return sendFileUrlFileInfoCaptionRequestHandleReturnValue
} }
} }
//MARK: - sendImage //MARK: - sendImage
var sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = 0 var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount = 0
var sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleCallsCount: Int { var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount returnValue = sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -14258,27 +14258,27 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleCalled: Bool { var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCalled: Bool {
return sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleCallsCount > 0 return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount > 0
} }
var sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>! var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleReturnValue: Result<Void, TimelineProxyError>! { var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleReturnValue: Result<Void, TimelineProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, TimelineProxyError>? = nil var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue returnValue = sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -14286,22 +14286,22 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleClosure: ((URL, URL, ImageInfo, String?, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)? var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure: ((URL, URL, ImageInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)?
func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, caption: String?, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleCallsCount += 1 sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount += 1
if let sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleClosure = sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleClosure { if let sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure = sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure {
return await sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleClosure(url, thumbnailURL, imageInfo, caption, progressSubject, requestHandle) return await sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure(url, thumbnailURL, imageInfo, caption, requestHandle)
} else { } else {
return sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleReturnValue return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleReturnValue
} }
} }
//MARK: - sendLocation //MARK: - sendLocation
@ -14376,15 +14376,15 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
//MARK: - sendVideo //MARK: - sendVideo
var sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = 0 var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount = 0
var sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleCallsCount: Int { var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -14392,27 +14392,27 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleCalled: Bool { var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCalled: Bool {
return sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleCallsCount > 0 return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCallsCount > 0
} }
var sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>! var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleReturnValue: Result<Void, TimelineProxyError>! { var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleReturnValue: Result<Void, TimelineProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, TimelineProxyError>? = nil var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -14420,35 +14420,35 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleClosure: ((URL, URL, VideoInfo, String?, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)? var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure: ((URL, URL, VideoInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)?
func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, caption: String?, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleCallsCount += 1 sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCallsCount += 1
if let sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleClosure = sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleClosure { if let sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure = sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure {
return await sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleClosure(url, thumbnailURL, videoInfo, caption, progressSubject, requestHandle) return await sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure(url, thumbnailURL, videoInfo, caption, requestHandle)
} else { } else {
return sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleReturnValue return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleReturnValue
} }
} }
//MARK: - sendVoiceMessage //MARK: - sendVoiceMessage
var sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingCallsCount = 0 var sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount = 0
var sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleCallsCount: Int { var sendVoiceMessageUrlAudioInfoWaveformRequestHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingCallsCount return sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingCallsCount returnValue = sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -14456,27 +14456,27 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingCallsCount = newValue sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleCalled: Bool { var sendVoiceMessageUrlAudioInfoWaveformRequestHandleCalled: Bool {
return sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleCallsCount > 0 return sendVoiceMessageUrlAudioInfoWaveformRequestHandleCallsCount > 0
} }
var sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>! var sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue: Result<Void, TimelineProxyError>! { var sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue: Result<Void, TimelineProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingReturnValue return sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, TimelineProxyError>? = nil var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingReturnValue returnValue = sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -14484,22 +14484,22 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleUnderlyingReturnValue = newValue sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleClosure: ((URL, AudioInfo, [UInt16], CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)? var sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure: ((URL, AudioInfo, [UInt16], @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>)?
func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16], progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16], requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleCallsCount += 1 sendVoiceMessageUrlAudioInfoWaveformRequestHandleCallsCount += 1
if let sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleClosure = sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleClosure { if let sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure = sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure {
return await sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleClosure(url, audioInfo, waveform, progressSubject, requestHandle) return await sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure(url, audioInfo, waveform, requestHandle)
} else { } else {
return sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue return sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue
} }
} }
//MARK: - sendReadReceipt //MARK: - sendReadReceipt

View File

@ -49,13 +49,11 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
switch viewAction { switch viewAction {
case .send: case .send:
Task { Task {
let progressSubject = AppSettings.isDevelopmentBuild ? nil : CurrentValueSubject<Double, Never>(0.0) startLoading()
startLoading(progressPublisher: progressSubject?.asCurrentValuePublisher())
switch await mediaUploadingPreprocessor.processMedia(at: url) { switch await mediaUploadingPreprocessor.processMedia(at: url) {
case .success(let mediaInfo): case .success(let mediaInfo):
switch await sendAttachment(mediaInfo: mediaInfo, caption: caption, progressSubject: progressSubject) { switch await sendAttachment(mediaInfo: mediaInfo, caption: caption) {
case .success: case .success:
actionsSubject.send(.dismiss) actionsSubject.send(.dismiss)
case .failure(let error): case .failure(let error):
@ -79,7 +77,7 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
// MARK: - Private // MARK: - Private
private func sendAttachment(mediaInfo: MediaInfo, caption: String?, progressSubject: CurrentValueSubject<Double, Never>?) async -> Result<Void, TimelineProxyError> { private func sendAttachment(mediaInfo: MediaInfo, caption: String?) async -> Result<Void, TimelineProxyError> {
let requestHandle: ((SendAttachmentJoinHandleProtocol) -> Void) = { [weak self] handle in let requestHandle: ((SendAttachmentJoinHandleProtocol) -> Void) = { [weak self] handle in
self?.requestHandle = handle self?.requestHandle = handle
} }
@ -90,42 +88,32 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
thumbnailURL: thumbnailURL, thumbnailURL: thumbnailURL,
imageInfo: imageInfo, imageInfo: imageInfo,
caption: caption, caption: caption,
progressSubject: progressSubject,
requestHandle: requestHandle) requestHandle: requestHandle)
case let .video(videoURL, thumbnailURL, videoInfo): case let .video(videoURL, thumbnailURL, videoInfo):
return await roomProxy.timeline.sendVideo(url: videoURL, return await roomProxy.timeline.sendVideo(url: videoURL,
thumbnailURL: thumbnailURL, thumbnailURL: thumbnailURL,
videoInfo: videoInfo, videoInfo: videoInfo,
caption: caption, caption: caption,
progressSubject: progressSubject,
requestHandle: requestHandle) requestHandle: requestHandle)
case let .audio(audioURL, audioInfo): case let .audio(audioURL, audioInfo):
return await roomProxy.timeline.sendAudio(url: audioURL, return await roomProxy.timeline.sendAudio(url: audioURL,
audioInfo: audioInfo, audioInfo: audioInfo,
caption: caption, caption: caption,
progressSubject: progressSubject,
requestHandle: requestHandle) requestHandle: requestHandle)
case let .file(fileURL, fileInfo): case let .file(fileURL, fileInfo):
return await roomProxy.timeline.sendFile(url: fileURL, return await roomProxy.timeline.sendFile(url: fileURL,
fileInfo: fileInfo, fileInfo: fileInfo,
caption: caption, caption: caption,
progressSubject: progressSubject,
requestHandle: requestHandle) requestHandle: requestHandle)
} }
} }
private static let loadingIndicatorIdentifier = "\(MediaUploadPreviewScreenViewModel.self)-Loading" private static let loadingIndicatorIdentifier = "\(MediaUploadPreviewScreenViewModel.self)-Loading"
private func startLoading(progressPublisher: CurrentValuePublisher<Double, Never>?) { private func startLoading() {
let progress: UserIndicator.Progress = if let progressPublisher {
.published(progressPublisher)
} else {
.indeterminate
}
userIndicatorController.submitIndicator( userIndicatorController.submitIndicator(
UserIndicator(id: Self.loadingIndicatorIdentifier, UserIndicator(id: Self.loadingIndicatorIdentifier,
type: .modal(progress: progress, interactiveDismissDisabled: false, allowsInteraction: true), type: .modal(progress: .indeterminate, interactiveDismissDisabled: false, allowsInteraction: true),
title: L10n.commonSending, title: L10n.commonSending,
persistent: true) persistent: true)
) )

View File

@ -224,18 +224,15 @@ final class TimelineProxy: TimelineProxyProtocol {
func sendAudio(url: URL, func sendAudio(url: URL,
audioInfo: AudioInfo, audioInfo: AudioInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
MXLog.info("Sending audio") MXLog.info("Sending audio")
let handle = timeline.sendAudio(url: url.path(percentEncoded: false), let handle = timeline.sendAudio(url: url.path(percentEncoded: false),
audioInfo: audioInfo, audioInfo: audioInfo,
caption: caption, caption: caption,
formattedCaption: nil, formattedCaption: nil, // Rust will build this from the caption's markdown.
progressWatcher: UploadProgressListener { progress in progressWatcher: nil,
progressSubject?.send(progress) useSendQueue: true)
},
useSendQueue: AppSettings.isDevelopmentBuild)
await requestHandle(handle) await requestHandle(handle)
@ -253,18 +250,15 @@ final class TimelineProxy: TimelineProxyProtocol {
func sendFile(url: URL, func sendFile(url: URL,
fileInfo: FileInfo, fileInfo: FileInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
MXLog.info("Sending file") MXLog.info("Sending file")
let handle = timeline.sendFile(url: url.path(percentEncoded: false), let handle = timeline.sendFile(url: url.path(percentEncoded: false),
fileInfo: fileInfo, fileInfo: fileInfo,
caption: caption, caption: caption,
formattedCaption: nil, formattedCaption: nil, // Rust will build this from the caption's markdown.
progressWatcher: UploadProgressListener { progress in progressWatcher: nil,
progressSubject?.send(progress) useSendQueue: true)
},
useSendQueue: AppSettings.isDevelopmentBuild)
await requestHandle(handle) await requestHandle(handle)
@ -279,12 +273,10 @@ final class TimelineProxy: TimelineProxyProtocol {
return .success(()) return .success(())
} }
// swiftlint:disable:next function_parameter_count
func sendImage(url: URL, func sendImage(url: URL,
thumbnailURL: URL, thumbnailURL: URL,
imageInfo: ImageInfo, imageInfo: ImageInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
MXLog.info("Sending image") MXLog.info("Sending image")
@ -292,11 +284,9 @@ final class TimelineProxy: TimelineProxyProtocol {
thumbnailUrl: thumbnailURL.path(percentEncoded: false), thumbnailUrl: thumbnailURL.path(percentEncoded: false),
imageInfo: imageInfo, imageInfo: imageInfo,
caption: caption, caption: caption,
formattedCaption: nil, formattedCaption: nil, // Rust will build this from the caption's markdown.
progressWatcher: UploadProgressListener { progress in progressWatcher: nil,
progressSubject?.send(progress) useSendQueue: true)
},
useSendQueue: AppSettings.isDevelopmentBuild)
await requestHandle(handle) await requestHandle(handle)
@ -334,7 +324,6 @@ final class TimelineProxy: TimelineProxyProtocol {
thumbnailURL: URL, thumbnailURL: URL,
videoInfo: VideoInfo, videoInfo: VideoInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
MXLog.info("Sending video") MXLog.info("Sending video")
@ -342,11 +331,9 @@ final class TimelineProxy: TimelineProxyProtocol {
thumbnailUrl: thumbnailURL.path(percentEncoded: false), thumbnailUrl: thumbnailURL.path(percentEncoded: false),
videoInfo: videoInfo, videoInfo: videoInfo,
caption: caption, caption: caption,
formattedCaption: nil, formattedCaption: nil, // Rust will build this from the caption's markdown.
progressWatcher: UploadProgressListener { progress in progressWatcher: nil,
progressSubject?.send(progress) useSendQueue: true)
},
useSendQueue: AppSettings.isDevelopmentBuild)
await requestHandle(handle) await requestHandle(handle)
@ -364,7 +351,6 @@ final class TimelineProxy: TimelineProxyProtocol {
func sendVoiceMessage(url: URL, func sendVoiceMessage(url: URL,
audioInfo: AudioInfo, audioInfo: AudioInfo,
waveform: [UInt16], waveform: [UInt16],
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
MXLog.info("Sending voice message") MXLog.info("Sending voice message")
@ -373,10 +359,8 @@ final class TimelineProxy: TimelineProxyProtocol {
waveform: waveform, waveform: waveform,
caption: nil, caption: nil,
formattedCaption: nil, formattedCaption: nil,
progressWatcher: UploadProgressListener { progress in progressWatcher: nil,
progressSubject?.send(progress) useSendQueue: true)
},
useSendQueue: AppSettings.isDevelopmentBuild)
await requestHandle(handle) await requestHandle(handle)

View File

@ -52,21 +52,17 @@ protocol TimelineProxyProtocol {
func sendAudio(url: URL, func sendAudio(url: URL,
audioInfo: AudioInfo, audioInfo: AudioInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
func sendFile(url: URL, func sendFile(url: URL,
fileInfo: FileInfo, fileInfo: FileInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
// swiftlint:disable:next function_parameter_count
func sendImage(url: URL, func sendImage(url: URL,
thumbnailURL: URL, thumbnailURL: URL,
imageInfo: ImageInfo, imageInfo: ImageInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
func sendLocation(body: String, func sendLocation(body: String,
@ -75,18 +71,15 @@ protocol TimelineProxyProtocol {
zoomLevel: UInt8?, zoomLevel: UInt8?,
assetType: AssetType?) async -> Result<Void, TimelineProxyError> assetType: AssetType?) async -> Result<Void, TimelineProxyError>
// swiftlint:disable:next function_parameter_count
func sendVideo(url: URL, func sendVideo(url: URL,
thumbnailURL: URL, thumbnailURL: URL,
videoInfo: VideoInfo, videoInfo: VideoInfo,
caption: String?, caption: String?,
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
func sendVoiceMessage(url: URL, func sendVoiceMessage(url: URL,
audioInfo: AudioInfo, audioInfo: AudioInfo,
waveform: [UInt16], waveform: [UInt16],
progressSubject: CurrentValueSubject<Double, Never>?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
func sendReadReceipt(for eventID: String, type: ReceiptType) async -> Result<Void, TimelineProxyError> func sendReadReceipt(for eventID: String, type: ReceiptType) async -> Result<Void, TimelineProxyError>

View File

@ -178,8 +178,7 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
let result = await roomProxy.timeline.sendVoiceMessage(url: oggFile, let result = await roomProxy.timeline.sendVoiceMessage(url: oggFile,
audioInfo: audioInfo, audioInfo: audioInfo,
waveform: waveform, waveform: waveform) { _ in }
progressSubject: nil) { _ in }
if case .failure(let error) = result { if case .failure(let error) = result {
MXLog.error("Failed to send the voice message. \(error)") MXLog.error("Failed to send the voice message. \(error)")

View File

@ -106,16 +106,16 @@ class MediaUploadPreviewScreenViewModelTests: XCTestCase {
private func setUpViewModel(url: URL, expectedCaption: String?) { private func setUpViewModel(url: URL, expectedCaption: String?) {
timelineProxy = TimelineProxyMock(.init()) timelineProxy = TimelineProxyMock(.init())
timelineProxy.sendAudioUrlAudioInfoCaptionProgressSubjectRequestHandleClosure = { [weak self] _, _, caption, _, _ in timelineProxy.sendAudioUrlAudioInfoCaptionRequestHandleClosure = { [weak self] _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
} }
timelineProxy.sendFileUrlFileInfoCaptionProgressSubjectRequestHandleClosure = { [weak self] _, _, caption, _, _ in timelineProxy.sendFileUrlFileInfoCaptionRequestHandleClosure = { [weak self] _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
} }
timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionProgressSubjectRequestHandleClosure = { [weak self] _, _, _, caption, _, _ in timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure = { [weak self] _, _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
} }
timelineProxy.sendVideoUrlThumbnailURLVideoInfoCaptionProgressSubjectRequestHandleClosure = { [weak self] _, _, _, caption, _, _ in timelineProxy.sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure = { [weak self] _, _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
} }

View File

@ -227,7 +227,7 @@ class VoiceMessageRecorderTests: XCTestCase {
let timelineProxy = TimelineProxyMock() let timelineProxy = TimelineProxyMock()
let roomProxy = JoinedRoomProxyMock() let roomProxy = JoinedRoomProxyMock()
roomProxy.timeline = timelineProxy roomProxy.timeline = timelineProxy
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.sdkError(SDKError.generic)) timelineProxy.sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue = .failure(.sdkError(SDKError.generic))
guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else { guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else {
XCTFail("An error is expected") XCTFail("An error is expected")
return return
@ -248,7 +248,7 @@ class VoiceMessageRecorderTests: XCTestCase {
let timelineProxy = TimelineProxyMock() let timelineProxy = TimelineProxyMock()
let roomProxy = JoinedRoomProxyMock() let roomProxy = JoinedRoomProxyMock()
roomProxy.timeline = timelineProxy roomProxy.timeline = timelineProxy
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.sdkError(SDKError.generic)) timelineProxy.sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue = .failure(.sdkError(SDKError.generic))
guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else { guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else {
XCTFail("An error is expected") XCTFail("An error is expected")
return return
@ -271,7 +271,7 @@ class VoiceMessageRecorderTests: XCTestCase {
let timelineProxy = TimelineProxyMock() let timelineProxy = TimelineProxyMock()
let roomProxy = JoinedRoomProxyMock() let roomProxy = JoinedRoomProxyMock()
roomProxy.timeline = timelineProxy roomProxy.timeline = timelineProxy
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.sdkError(SDKError.generic)) timelineProxy.sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue = .failure(.sdkError(SDKError.generic))
guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else { guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else {
XCTFail("An error is expected") XCTFail("An error is expected")
return return
@ -307,7 +307,7 @@ class VoiceMessageRecorderTests: XCTestCase {
XCTAssertEqual(destination.pathExtension, "ogg") XCTAssertEqual(destination.pathExtension, "ogg")
} }
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleClosure = { url, audioInfo, waveform, _, _ in timelineProxy.sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure = { url, audioInfo, waveform, _ in
XCTAssertEqual(url, convertedFileURL) XCTAssertEqual(url, convertedFileURL)
XCTAssertEqual(audioInfo.duration, self.audioRecorder.currentTime) XCTAssertEqual(audioInfo.duration, self.audioRecorder.currentTime)
XCTAssertEqual(audioInfo.size, convertedFileSize) XCTAssertEqual(audioInfo.size, convertedFileSize)
@ -323,7 +323,7 @@ class VoiceMessageRecorderTests: XCTestCase {
} }
XCTAssert(audioConverter.convertToOpusOggSourceURLDestinationURLCalled) XCTAssert(audioConverter.convertToOpusOggSourceURLDestinationURLCalled)
XCTAssert(timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleCalled) XCTAssert(timelineProxy.sendVoiceMessageUrlAudioInfoWaveformRequestHandleCalled)
// the converted file must have been deleted // the converted file must have been deleted
if let convertedFileURL { if let convertedFileURL {