mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add support for manually starting SaS verification flows and accepting remotely started ones
This commit is contained in:
committed by
Stefan Ceriu
parent
7888736a4d
commit
956e92a9ac
+27
@@ -31,6 +31,14 @@ private class WeakSessionVerificationControllerProxy: SessionVerificationControl
|
||||
proxy?.didReceiveData(data)
|
||||
}
|
||||
|
||||
func didAcceptVerificationRequest() {
|
||||
proxy?.didAcceptVerificationRequest()
|
||||
}
|
||||
|
||||
func didStartSasVerification() {
|
||||
proxy?.didStartSasVerification()
|
||||
}
|
||||
|
||||
func didFail() {
|
||||
proxy?.didFail()
|
||||
}
|
||||
@@ -73,6 +81,17 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
}
|
||||
}
|
||||
|
||||
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
try self.sessionVerificationController.startSasVerification()
|
||||
return .success(())
|
||||
} catch {
|
||||
return .failure(.failedStartingSasVerification)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func approveVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
@@ -108,6 +127,14 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
fileprivate func didAcceptVerificationRequest() {
|
||||
callbacks.send(.acceptedVerificationRequest)
|
||||
}
|
||||
|
||||
fileprivate func didStartSasVerification() {
|
||||
callbacks.send(.startedSasVerification)
|
||||
}
|
||||
|
||||
fileprivate func didReceiveData(_ data: [MatrixRustSDK.SessionVerificationEmoji]) {
|
||||
callbacks.send(.receivedVerificationData(data.map { emoji in
|
||||
SessionVerificationEmoji(symbol: emoji.symbol(), description: emoji.description())
|
||||
|
||||
Reference in New Issue
Block a user