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:
Stefan Ceriu
2024-10-29 15:21:17 +02:00
committed by GitHub
parent cf5e9fb313
commit d77bb935b7
104 changed files with 995 additions and 483 deletions
@@ -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(())