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
@@ -281,7 +281,11 @@ class ClientProxy: ClientProxyProtocol {
try await client.setUtdDelegate(utdDelegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
let canSubscribeToUserProfile = appSettings.userStatusEnabled // TODO: @pixlwave to add a /versions check too.
let canSubscribeToUserProfile = if appSettings.userStatusEnabled, case .success(true) = await isUserStatusSupported() {
true
} else {
false
}
if !canSubscribeToUserProfile {
loadUserAvatarURLFromCache()
@@ -753,6 +757,15 @@ class ClientProxy: ClientProxyProtocol {
}
}
func isUserStatusSupported() async -> Result<Bool, ClientProxyError> {
do {
return try await .success(client.isUserStatusSupported())
} catch {
MXLog.error("Failed detecting user status support with error: \(error)")
return .failure(.sdkError(error))
}
}
// periphery:ignore - might be useful to have
func setUserStatus(_ status: UserStatus.Raw) async -> Result<Void, ClientProxyError> {
do {
@@ -226,6 +226,7 @@ protocol ClientProxyProtocol: AnyObject {
func setUserDisplayName(_ name: String) async -> Result<Void, ClientProxyError>
func setUserAvatar(media: MediaInfo) async -> Result<Void, ClientProxyError>
func removeUserAvatar() async -> Result<Void, ClientProxyError>
func isUserStatusSupported() async -> Result<Bool, ClientProxyError>
func setUserStatus(_ status: UserStatus.Raw) async -> Result<Void, ClientProxyError>
func removeUserStatus() async -> Result<Void, ClientProxyError>