Add a service and flow coordinator for the LinkNewDevice feature. (#4859)

* Add a LinkNewDeviceService that exposes the SDK's grant QR code login methods.

* Add a flow coordinator for linking a new device.

Changes the presentation too.
This commit is contained in:
Doug
2025-12-15 14:44:26 +00:00
committed by GitHub
parent 27ca265991
commit 93dfc84a57
38 changed files with 536 additions and 73 deletions
@@ -4019,6 +4019,70 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
return removeUserAvatarReturnValue
}
}
//MARK: - linkNewDeviceService
var linkNewDeviceServiceUnderlyingCallsCount = 0
var linkNewDeviceServiceCallsCount: Int {
get {
if Thread.isMainThread {
return linkNewDeviceServiceUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = linkNewDeviceServiceUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
linkNewDeviceServiceUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
linkNewDeviceServiceUnderlyingCallsCount = newValue
}
}
}
}
var linkNewDeviceServiceCalled: Bool {
return linkNewDeviceServiceCallsCount > 0
}
var linkNewDeviceServiceUnderlyingReturnValue: LinkNewDeviceService!
var linkNewDeviceServiceReturnValue: LinkNewDeviceService! {
get {
if Thread.isMainThread {
return linkNewDeviceServiceUnderlyingReturnValue
} else {
var returnValue: LinkNewDeviceService? = nil
DispatchQueue.main.sync {
returnValue = linkNewDeviceServiceUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
linkNewDeviceServiceUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
linkNewDeviceServiceUnderlyingReturnValue = newValue
}
}
}
}
var linkNewDeviceServiceClosure: (() -> LinkNewDeviceService)?
func linkNewDeviceService() -> LinkNewDeviceService {
linkNewDeviceServiceCallsCount += 1
if let linkNewDeviceServiceClosure = linkNewDeviceServiceClosure {
return linkNewDeviceServiceClosure()
} else {
return linkNewDeviceServiceReturnValue
}
}
//MARK: - deactivateAccount
var deactivateAccountPasswordEraseDataUnderlyingCallsCount = 0