mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Avoid publishing changes from a background thread, dispatch upload task handles on the main queue
This commit is contained in:
@@ -1011,9 +1011,9 @@ class RoomProxyMock: RoomProxyProtocol {
|
|||||||
return sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleCallsCount > 0
|
return sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleCallsCount > 0
|
||||||
}
|
}
|
||||||
var sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
var sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
||||||
var sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure: ((URL, URL, ImageInfo, CurrentValueSubject<Double, Never>?, (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
var sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure: ((URL, URL, ImageInfo, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
||||||
|
|
||||||
func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleCallsCount += 1
|
sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleCallsCount += 1
|
||||||
if let sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure = sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure {
|
if let sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure = sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure {
|
||||||
return await sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure(url, thumbnailURL, imageInfo, progressSubject, requestHandle)
|
return await sendImageUrlThumbnailURLImageInfoProgressSubjectRequestHandleClosure(url, thumbnailURL, imageInfo, progressSubject, requestHandle)
|
||||||
@@ -1028,9 +1028,9 @@ class RoomProxyMock: RoomProxyProtocol {
|
|||||||
return sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleCallsCount > 0
|
return sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleCallsCount > 0
|
||||||
}
|
}
|
||||||
var sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
var sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
||||||
var sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure: ((URL, URL, VideoInfo, CurrentValueSubject<Double, Never>?, (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
var sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure: ((URL, URL, VideoInfo, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
||||||
|
|
||||||
func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleCallsCount += 1
|
sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleCallsCount += 1
|
||||||
if let sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure = sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure {
|
if let sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure = sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure {
|
||||||
return await sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure(url, thumbnailURL, videoInfo, progressSubject, requestHandle)
|
return await sendVideoUrlThumbnailURLVideoInfoProgressSubjectRequestHandleClosure(url, thumbnailURL, videoInfo, progressSubject, requestHandle)
|
||||||
@@ -1045,9 +1045,9 @@ class RoomProxyMock: RoomProxyProtocol {
|
|||||||
return sendAudioUrlAudioInfoProgressSubjectRequestHandleCallsCount > 0
|
return sendAudioUrlAudioInfoProgressSubjectRequestHandleCallsCount > 0
|
||||||
}
|
}
|
||||||
var sendAudioUrlAudioInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
var sendAudioUrlAudioInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
||||||
var sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure: ((URL, AudioInfo, CurrentValueSubject<Double, Never>?, (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
var sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure: ((URL, AudioInfo, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
||||||
|
|
||||||
func sendAudio(url: URL, audioInfo: AudioInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
func sendAudio(url: URL, audioInfo: AudioInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendAudioUrlAudioInfoProgressSubjectRequestHandleCallsCount += 1
|
sendAudioUrlAudioInfoProgressSubjectRequestHandleCallsCount += 1
|
||||||
if let sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure = sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure {
|
if let sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure = sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure {
|
||||||
return await sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure(url, audioInfo, progressSubject, requestHandle)
|
return await sendAudioUrlAudioInfoProgressSubjectRequestHandleClosure(url, audioInfo, progressSubject, requestHandle)
|
||||||
@@ -1062,9 +1062,9 @@ class RoomProxyMock: RoomProxyProtocol {
|
|||||||
return sendFileUrlFileInfoProgressSubjectRequestHandleCallsCount > 0
|
return sendFileUrlFileInfoProgressSubjectRequestHandleCallsCount > 0
|
||||||
}
|
}
|
||||||
var sendFileUrlFileInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
var sendFileUrlFileInfoProgressSubjectRequestHandleReturnValue: Result<Void, RoomProxyError>!
|
||||||
var sendFileUrlFileInfoProgressSubjectRequestHandleClosure: ((URL, FileInfo, CurrentValueSubject<Double, Never>?, (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
var sendFileUrlFileInfoProgressSubjectRequestHandleClosure: ((URL, FileInfo, CurrentValueSubject<Double, Never>?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>)?
|
||||||
|
|
||||||
func sendFile(url: URL, fileInfo: FileInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
func sendFile(url: URL, fileInfo: FileInfo, progressSubject: CurrentValueSubject<Double, Never>?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendFileUrlFileInfoProgressSubjectRequestHandleCallsCount += 1
|
sendFileUrlFileInfoProgressSubjectRequestHandleCallsCount += 1
|
||||||
if let sendFileUrlFileInfoProgressSubjectRequestHandleClosure = sendFileUrlFileInfoProgressSubjectRequestHandleClosure {
|
if let sendFileUrlFileInfoProgressSubjectRequestHandleClosure = sendFileUrlFileInfoProgressSubjectRequestHandleClosure {
|
||||||
return await sendFileUrlFileInfoProgressSubjectRequestHandleClosure(url, fileInfo, progressSubject, requestHandle)
|
return await sendFileUrlFileInfoProgressSubjectRequestHandleClosure(url, fileInfo, progressSubject, requestHandle)
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
thumbnailURL: URL,
|
thumbnailURL: URL,
|
||||||
imageInfo: ImageInfo,
|
imageInfo: ImageInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||||
defer {
|
defer {
|
||||||
sendMessageBackgroundTask?.stop()
|
sendMessageBackgroundTask?.stop()
|
||||||
@@ -323,7 +323,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
progressSubject?.send(progress)
|
progressSubject?.send(progress)
|
||||||
})
|
})
|
||||||
|
|
||||||
requestHandle(handle)
|
await requestHandle(handle)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try await handle.join()
|
try await handle.join()
|
||||||
@@ -338,7 +338,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
thumbnailURL: URL,
|
thumbnailURL: URL,
|
||||||
videoInfo: VideoInfo,
|
videoInfo: VideoInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||||
defer {
|
defer {
|
||||||
sendMessageBackgroundTask?.stop()
|
sendMessageBackgroundTask?.stop()
|
||||||
@@ -348,7 +348,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
progressSubject?.send(progress)
|
progressSubject?.send(progress)
|
||||||
})
|
})
|
||||||
|
|
||||||
requestHandle(handle)
|
await requestHandle(handle)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try await handle.join()
|
try await handle.join()
|
||||||
@@ -362,7 +362,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
func sendAudio(url: URL,
|
func sendAudio(url: URL,
|
||||||
audioInfo: AudioInfo,
|
audioInfo: AudioInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||||
defer {
|
defer {
|
||||||
sendMessageBackgroundTask?.stop()
|
sendMessageBackgroundTask?.stop()
|
||||||
@@ -372,7 +372,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
progressSubject?.send(progress)
|
progressSubject?.send(progress)
|
||||||
})
|
})
|
||||||
|
|
||||||
requestHandle(handle)
|
await requestHandle(handle)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try await handle.join()
|
try await handle.join()
|
||||||
@@ -386,7 +386,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
func sendFile(url: URL,
|
func sendFile(url: URL,
|
||||||
fileInfo: FileInfo,
|
fileInfo: FileInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError> {
|
||||||
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
|
||||||
defer {
|
defer {
|
||||||
sendMessageBackgroundTask?.stop()
|
sendMessageBackgroundTask?.stop()
|
||||||
@@ -396,7 +396,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
progressSubject?.send(progress)
|
progressSubject?.send(progress)
|
||||||
})
|
})
|
||||||
|
|
||||||
requestHandle(handle)
|
await requestHandle(handle)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try await handle.join()
|
try await handle.join()
|
||||||
|
|||||||
@@ -103,23 +103,23 @@ protocol RoomProxyProtocol {
|
|||||||
thumbnailURL: URL,
|
thumbnailURL: URL,
|
||||||
imageInfo: ImageInfo,
|
imageInfo: ImageInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||||
|
|
||||||
func sendVideo(url: URL,
|
func sendVideo(url: URL,
|
||||||
thumbnailURL: URL,
|
thumbnailURL: URL,
|
||||||
videoInfo: VideoInfo,
|
videoInfo: VideoInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||||
|
|
||||||
func sendAudio(url: URL,
|
func sendAudio(url: URL,
|
||||||
audioInfo: AudioInfo,
|
audioInfo: AudioInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||||
|
|
||||||
func sendFile(url: URL,
|
func sendFile(url: URL,
|
||||||
fileInfo: FileInfo,
|
fileInfo: FileInfo,
|
||||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||||
|
|
||||||
func sendLocation(body: String,
|
func sendLocation(body: String,
|
||||||
geoURI: GeoURI,
|
geoURI: GeoURI,
|
||||||
|
|||||||
Reference in New Issue
Block a user