Gate user status behind server support as well as the feature flag. (#5920)

This commit is contained in:
Doug
2026-07-24 13:23:54 +01:00
committed by GitHub
parent 4a9cd02fbc
commit 5d0343c480
7 changed files with 84 additions and 4 deletions
@@ -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()