mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Incoming session verification support (#3428)
* Fixes #1227 - Add support for receiving and interacting with incoming session verification requests. * Fix a couple of random small warnings * Move static view config to the view state * Update snapshots
This commit is contained in:
@@ -16,16 +16,18 @@ extension SessionVerificationControllerProxyMock {
|
||||
SessionVerificationEmoji(symbol: "🏁", description: "Flag"),
|
||||
SessionVerificationEmoji(symbol: "🌏", description: "Globe")]
|
||||
|
||||
static func configureMock(callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never> = .init(),
|
||||
static func configureMock(actions: PassthroughSubject<SessionVerificationControllerProxyAction, Never> = .init(),
|
||||
isVerified: Bool = false,
|
||||
requestDelay: Duration = .seconds(1)) -> SessionVerificationControllerProxyMock {
|
||||
let mock = SessionVerificationControllerProxyMock()
|
||||
mock.underlyingCallbacks = callbacks
|
||||
mock.underlyingActions = actions
|
||||
|
||||
mock.acknowledgeVerificationRequestDetailsReturnValue = .success(())
|
||||
|
||||
mock.requestVerificationClosure = { [unowned mock] in
|
||||
Task.detached {
|
||||
try await Task.sleep(for: requestDelay)
|
||||
mock.callbacks.send(.acceptedVerificationRequest)
|
||||
mock.actions.send(.acceptedVerificationRequest)
|
||||
}
|
||||
|
||||
return .success(())
|
||||
@@ -34,11 +36,11 @@ extension SessionVerificationControllerProxyMock {
|
||||
mock.startSasVerificationClosure = { [unowned mock] in
|
||||
Task.detached {
|
||||
try await Task.sleep(for: requestDelay)
|
||||
mock.callbacks.send(.startedSasVerification)
|
||||
mock.actions.send(.startedSasVerification)
|
||||
|
||||
Task.detached {
|
||||
try await Task.sleep(for: requestDelay)
|
||||
mock.callbacks.send(.receivedVerificationData(emojis))
|
||||
mock.actions.send(.receivedVerificationData(emojis))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +50,7 @@ extension SessionVerificationControllerProxyMock {
|
||||
mock.approveVerificationClosure = { [unowned mock] in
|
||||
Task.detached {
|
||||
try await Task.sleep(for: requestDelay)
|
||||
mock.callbacks.send(.finished)
|
||||
mock.actions.send(.finished)
|
||||
}
|
||||
|
||||
return .success(())
|
||||
@@ -57,7 +59,7 @@ extension SessionVerificationControllerProxyMock {
|
||||
mock.declineVerificationClosure = { [unowned mock] in
|
||||
Task.detached {
|
||||
try await Task.sleep(for: requestDelay)
|
||||
mock.callbacks.send(.cancelled)
|
||||
mock.actions.send(.cancelled)
|
||||
}
|
||||
|
||||
return .success(())
|
||||
@@ -66,7 +68,7 @@ extension SessionVerificationControllerProxyMock {
|
||||
mock.cancelVerificationClosure = { [unowned mock] in
|
||||
Task.detached {
|
||||
try await Task.sleep(for: requestDelay)
|
||||
mock.callbacks.send(.cancelled)
|
||||
mock.actions.send(.cancelled)
|
||||
}
|
||||
|
||||
return .success(())
|
||||
|
||||
Reference in New Issue
Block a user