mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Gate user status behind server support as well as the feature flag. (#5920)
This commit is contained in:
@@ -46,6 +46,7 @@ enum ClientProxyMockError: Error {
|
||||
}
|
||||
|
||||
extension ClientProxyMock {
|
||||
// swiftlint:disable:next function_body_length
|
||||
convenience init(_ configuration: ClientProxyMockConfiguration) {
|
||||
self.init()
|
||||
|
||||
@@ -91,6 +92,8 @@ extension ClientProxyMock {
|
||||
loadUserProfileIfNeededReturnValue = .success(())
|
||||
setUserDisplayNameReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
||||
setUserAvatarMediaReturnValue = .success(())
|
||||
isUserStatusSupportedReturnValue = .success(false)
|
||||
setUserStatusReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
||||
removeUserAvatarReturnValue = .success(())
|
||||
isAliasAvailableReturnValue = .success(true)
|
||||
searchUsersSearchTermLimitReturnValue = .success(.init(results: [], limited: false))
|
||||
|
||||
@@ -3235,6 +3235,34 @@ nonisolated class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
|
||||
return removeUserAvatarReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - isUserStatusSupported
|
||||
|
||||
private let isUserStatusSupportedCallsCountLock = NSLock()
|
||||
private nonisolated(unsafe) var isUserStatusSupportedUnderlyingCallsCount = 0
|
||||
var isUserStatusSupportedCallsCount: Int {
|
||||
get { isUserStatusSupportedCallsCountLock.withLock { isUserStatusSupportedUnderlyingCallsCount } }
|
||||
set { isUserStatusSupportedCallsCountLock.withLock { isUserStatusSupportedUnderlyingCallsCount = newValue } }
|
||||
}
|
||||
var isUserStatusSupportedCalled: Bool {
|
||||
return isUserStatusSupportedCallsCount > 0
|
||||
}
|
||||
|
||||
private let isUserStatusSupportedReturnValueLock = NSLock()
|
||||
private nonisolated(unsafe) var isUserStatusSupportedUnderlyingReturnValue: Result<Bool, ClientProxyError>!
|
||||
var isUserStatusSupportedReturnValue: Result<Bool, ClientProxyError>! {
|
||||
get { isUserStatusSupportedReturnValueLock.withLock { isUserStatusSupportedUnderlyingReturnValue } }
|
||||
set { isUserStatusSupportedReturnValueLock.withLock { isUserStatusSupportedUnderlyingReturnValue = newValue } }
|
||||
}
|
||||
nonisolated(unsafe) var isUserStatusSupportedClosure: (() async -> Result<Bool, ClientProxyError>)?
|
||||
|
||||
@concurrent func isUserStatusSupported() async -> Result<Bool, ClientProxyError> {
|
||||
isUserStatusSupportedCallsCountLock.withLock { isUserStatusSupportedUnderlyingCallsCount += 1 }
|
||||
if let isUserStatusSupportedClosure = isUserStatusSupportedClosure {
|
||||
return await isUserStatusSupportedClosure()
|
||||
} else {
|
||||
return isUserStatusSupportedReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - setUserStatus
|
||||
|
||||
private let setUserStatusCallsCountLock = NSLock()
|
||||
|
||||
Reference in New Issue
Block a user