mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Gate user status behind server support as well as the feature flag. (#5920)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user