mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 12:28:29 +00:00
Convert the SessionVerificationProxy to async-uniffi
This commit is contained in:
committed by
Stefan Ceriu
parent
89ac0c290b
commit
0d97ed8075
+5
-15
@@ -72,59 +72,49 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
|||||||
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||||
sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self))
|
sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self))
|
||||||
|
|
||||||
return await Task.dispatch(on: .global()) {
|
|
||||||
do {
|
do {
|
||||||
try self.sessionVerificationController.requestVerification()
|
try await sessionVerificationController.requestVerification()
|
||||||
return .success(())
|
return .success(())
|
||||||
} catch {
|
} catch {
|
||||||
return .failure(.failedRequestingVerification)
|
return .failure(.failedRequestingVerification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||||
await Task.dispatch(on: .global()) {
|
|
||||||
do {
|
do {
|
||||||
try self.sessionVerificationController.startSasVerification()
|
try await sessionVerificationController.startSasVerification()
|
||||||
return .success(())
|
return .success(())
|
||||||
} catch {
|
} catch {
|
||||||
return .failure(.failedStartingSasVerification)
|
return .failure(.failedStartingSasVerification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func approveVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
func approveVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||||
await Task.dispatch(on: .global()) {
|
|
||||||
do {
|
do {
|
||||||
try self.sessionVerificationController.approveVerification()
|
try await sessionVerificationController.approveVerification()
|
||||||
return .success(())
|
return .success(())
|
||||||
} catch {
|
} catch {
|
||||||
return .failure(.failedApprovingVerification)
|
return .failure(.failedApprovingVerification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func declineVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
func declineVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||||
await Task.dispatch(on: .global()) {
|
|
||||||
do {
|
do {
|
||||||
try self.sessionVerificationController.declineVerification()
|
try await sessionVerificationController.declineVerification()
|
||||||
return .success(())
|
return .success(())
|
||||||
} catch {
|
} catch {
|
||||||
return .failure(.failedDecliningVerification)
|
return .failure(.failedDecliningVerification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func cancelVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
func cancelVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||||
await Task.dispatch(on: .global()) {
|
|
||||||
do {
|
do {
|
||||||
try self.sessionVerificationController.cancelVerification()
|
try await sessionVerificationController.cancelVerification()
|
||||||
return .success(())
|
return .success(())
|
||||||
} catch {
|
} catch {
|
||||||
return .failure(.failedCancellingVerification)
|
return .failure(.failedCancellingVerification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user