mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Only offer to verify if a cross-signed device is available and improve the UX whilst waiting. (#4710)
* Only offer to verify if a cross-signed device is available * Wait until we know which verification options are available before showing them. --------- Co-authored-by: Hubert Chathi <hubertc@matrix.org>
This commit is contained in:
@@ -2287,6 +2287,70 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
|
||||
return isOnlyDeviceLeftReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - hasDevicesToVerifyAgainst
|
||||
|
||||
var hasDevicesToVerifyAgainstUnderlyingCallsCount = 0
|
||||
var hasDevicesToVerifyAgainstCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return hasDevicesToVerifyAgainstUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = hasDevicesToVerifyAgainstUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
hasDevicesToVerifyAgainstUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
hasDevicesToVerifyAgainstUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var hasDevicesToVerifyAgainstCalled: Bool {
|
||||
return hasDevicesToVerifyAgainstCallsCount > 0
|
||||
}
|
||||
|
||||
var hasDevicesToVerifyAgainstUnderlyingReturnValue: Result<Bool, ClientProxyError>!
|
||||
var hasDevicesToVerifyAgainstReturnValue: Result<Bool, ClientProxyError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return hasDevicesToVerifyAgainstUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<Bool, ClientProxyError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = hasDevicesToVerifyAgainstUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
hasDevicesToVerifyAgainstUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
hasDevicesToVerifyAgainstUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var hasDevicesToVerifyAgainstClosure: (() async -> Result<Bool, ClientProxyError>)?
|
||||
|
||||
func hasDevicesToVerifyAgainst() async -> Result<Bool, ClientProxyError> {
|
||||
hasDevicesToVerifyAgainstCallsCount += 1
|
||||
if let hasDevicesToVerifyAgainstClosure = hasDevicesToVerifyAgainstClosure {
|
||||
return await hasDevicesToVerifyAgainstClosure()
|
||||
} else {
|
||||
return hasDevicesToVerifyAgainstReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - startSync
|
||||
|
||||
var startSyncUnderlyingCallsCount = 0
|
||||
|
||||
Reference in New Issue
Block a user