mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Avoid publishing changes from a background thread, dispatch upload task handles on the main queue
This commit is contained in:
@@ -313,7 +313,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
thumbnailURL: URL,
|
||||
imageInfo: ImageInfo,
|
||||
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)
|
||||
defer {
|
||||
sendMessageBackgroundTask?.stop()
|
||||
@@ -323,7 +323,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
progressSubject?.send(progress)
|
||||
})
|
||||
|
||||
requestHandle(handle)
|
||||
await requestHandle(handle)
|
||||
|
||||
do {
|
||||
try await handle.join()
|
||||
@@ -338,7 +338,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
thumbnailURL: URL,
|
||||
videoInfo: VideoInfo,
|
||||
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)
|
||||
defer {
|
||||
sendMessageBackgroundTask?.stop()
|
||||
@@ -348,7 +348,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
progressSubject?.send(progress)
|
||||
})
|
||||
|
||||
requestHandle(handle)
|
||||
await requestHandle(handle)
|
||||
|
||||
do {
|
||||
try await handle.join()
|
||||
@@ -362,7 +362,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
func sendAudio(url: URL,
|
||||
audioInfo: AudioInfo,
|
||||
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)
|
||||
defer {
|
||||
sendMessageBackgroundTask?.stop()
|
||||
@@ -372,7 +372,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
progressSubject?.send(progress)
|
||||
})
|
||||
|
||||
requestHandle(handle)
|
||||
await requestHandle(handle)
|
||||
|
||||
do {
|
||||
try await handle.join()
|
||||
@@ -386,7 +386,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
func sendFile(url: URL,
|
||||
fileInfo: FileInfo,
|
||||
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)
|
||||
defer {
|
||||
sendMessageBackgroundTask?.stop()
|
||||
@@ -396,7 +396,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
progressSubject?.send(progress)
|
||||
})
|
||||
|
||||
requestHandle(handle)
|
||||
await requestHandle(handle)
|
||||
|
||||
do {
|
||||
try await handle.join()
|
||||
|
||||
@@ -103,23 +103,23 @@ protocol RoomProxyProtocol {
|
||||
thumbnailURL: URL,
|
||||
imageInfo: ImageInfo,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
requestHandle: @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>
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func sendAudio(url: URL,
|
||||
audioInfo: AudioInfo,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func sendFile(url: URL,
|
||||
fileInfo: FileInfo,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func sendLocation(body: String,
|
||||
geoURI: GeoURI,
|
||||
|
||||
Reference in New Issue
Block a user