mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Replace detached tasks with Task.dispatch(on:) (#201)
* Use Task.detach(on:) everywhere that was blocking.
* Don't wrap the continuations in a Task 🤦♂️
* Add sendable requirement to closure.
This commit is contained in:
+4
-8
@@ -63,7 +63,7 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
}
|
||||
|
||||
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
await Task.detached {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
try self.sessionVerificationController.requestVerification()
|
||||
return .success(())
|
||||
@@ -71,11 +71,10 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
return .failure(.failedRequestingVerification)
|
||||
}
|
||||
}
|
||||
.value
|
||||
}
|
||||
|
||||
func approveVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
await Task.detached {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
try self.sessionVerificationController.approveVerification()
|
||||
return .success(())
|
||||
@@ -83,11 +82,10 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
return .failure(.failedApprovingVerification)
|
||||
}
|
||||
}
|
||||
.value
|
||||
}
|
||||
|
||||
func declineVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
await Task.detached {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
try self.sessionVerificationController.declineVerification()
|
||||
return .success(())
|
||||
@@ -95,11 +93,10 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
return .failure(.failedDecliningVerification)
|
||||
}
|
||||
}
|
||||
.value
|
||||
}
|
||||
|
||||
func cancelVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
await Task.detached {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
try self.sessionVerificationController.cancelVerification()
|
||||
return .success(())
|
||||
@@ -107,7 +104,6 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
return .failure(.failedCancellingVerification)
|
||||
}
|
||||
}
|
||||
.value
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
Reference in New Issue
Block a user