mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Enable the User Status feature on supported homeservers. (#6059)
* Remove the user status feature flag. * Handle User Status in tests.
This commit is contained in:
@@ -446,9 +446,6 @@ final nonisolated class AppSettings: @unchecked Sendable {
|
||||
@UserPreference(key: "clientPausingAndResumingEnabledV2", defaultValue: false, volatile: true)
|
||||
var clientPausingAndResumingEnabled: Bool
|
||||
|
||||
@UserPreference(defaultValue: false)
|
||||
var userStatusEnabled: Bool
|
||||
|
||||
@UserPreference(defaultValue: AppBuildType.current != .release)
|
||||
var developerOptionsEnabled: Bool
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ extension ClientProxyMock {
|
||||
loadUserProfileIfNeededReturnValue = .success(())
|
||||
setUserDisplayNameReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
||||
setUserAvatarMediaReturnValue = .success(())
|
||||
isUserStatusSupportedReturnValue = .success(false)
|
||||
isUserStatusSupportedReturnValue = .success(true)
|
||||
setUserStatusReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
||||
removeUserAvatarReturnValue = .success(())
|
||||
isAliasAvailableReturnValue = .success(true)
|
||||
|
||||
-1
@@ -72,7 +72,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var jumpToReadMarkerEnabled: Bool { get set }
|
||||
|
||||
var linkNewDeviceEnabled: Bool { get set }
|
||||
var userStatusEnabled: Bool { get set }
|
||||
|
||||
var roomThreadListEnabled: Bool { get set }
|
||||
|
||||
|
||||
-4
@@ -54,10 +54,6 @@ struct DeveloperOptionsScreen: View {
|
||||
Text("Moves search to a separate tab")
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.userStatusEnabled) {
|
||||
Text("User status")
|
||||
}
|
||||
|
||||
context.viewState.appHooks
|
||||
.developerOptionsScreenHook
|
||||
.generalSectionRows(isSignedIn: context.viewState.isSignedIn)
|
||||
|
||||
@@ -36,7 +36,7 @@ enum SettingsScreenSecuritySectionMode {
|
||||
struct SettingsScreenViewState: BindableState {
|
||||
var deviceID: String?
|
||||
var userProfile: UserProfile
|
||||
var showUserStatus = false
|
||||
var showUserStatusInput = false
|
||||
var showLinkNewDeviceButton: Bool
|
||||
var accountProfileURL: URL?
|
||||
var showAccountDeactivation: Bool
|
||||
|
||||
@@ -85,8 +85,8 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
|
||||
.store(in: &cancellables)
|
||||
|
||||
Task {
|
||||
if appSettings.userStatusEnabled, case .success(true) = await userSession.clientProxy.isUserStatusSupported() {
|
||||
state.showUserStatus = true
|
||||
if case .success(true) = await userSession.clientProxy.isUserStatusSupported() {
|
||||
state.showUserStatusInput = true
|
||||
}
|
||||
await userSession.clientProxy.loadUserProfileIfNeeded()
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ struct SettingsScreen: View {
|
||||
Form {
|
||||
userSection
|
||||
|
||||
if context.viewState.showUserStatus {
|
||||
if context.viewState.showUserStatusInput {
|
||||
userStatusSection
|
||||
}
|
||||
|
||||
@@ -291,12 +291,16 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
SettingsScreen(context: viewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: viewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil })
|
||||
.frame(height: 1100)
|
||||
.previewLayout(.sizeThatFits)
|
||||
.previewDisplayName("Default")
|
||||
|
||||
ElementNavigationStack {
|
||||
SettingsScreen(context: bugReportDisabledViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: bugReportDisabledViewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil })
|
||||
.frame(height: 1050)
|
||||
.previewLayout(.sizeThatFits)
|
||||
.previewDisplayName("Bug report disabled")
|
||||
}
|
||||
|
||||
|
||||
@@ -281,8 +281,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
|
||||
try await client.setUtdDelegate(utdDelegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
|
||||
|
||||
let canSubscribeToUserProfile = if appSettings.userStatusEnabled,
|
||||
await (try? client.isProfilesSlidingSyncExtensionSupported()) == true {
|
||||
let canSubscribeToUserProfile = if await (try? client.isProfilesSlidingSyncExtensionSupported()) == true {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
@@ -311,11 +310,9 @@ class ClientProxy: ClientProxyProtocol {
|
||||
mediaPreviewConfigListenerTaskHandle = await createMediaPreviewConfigObserver()
|
||||
}
|
||||
|
||||
if appSettings.userStatusEnabled {
|
||||
Task {
|
||||
guard case .success(true) = await isUserStatusSupported() else { return }
|
||||
client.enableAutomaticCallStatus(enabled: true)
|
||||
}
|
||||
Task {
|
||||
guard case .success(true) = await isUserStatusSupported() else { return }
|
||||
client.enableAutomaticCallStatus(enabled: true)
|
||||
}
|
||||
|
||||
liveLocationOwnInfoUpdatesListenerTaskHandle = createLiveLocationOwnInfoUpdatesObserver()
|
||||
@@ -1531,14 +1528,12 @@ private struct ClientProxyServices {
|
||||
init(client: ClientProtocol,
|
||||
notificationSettings: NotificationSettingsProxyProtocol,
|
||||
appSettings: AppSettings) async throws {
|
||||
var syncServiceBuilder = client
|
||||
let syncService = try await client
|
||||
.syncService()
|
||||
.withOfflineMode()
|
||||
.withSharePos(enable: true)
|
||||
if appSettings.userStatusEnabled {
|
||||
syncServiceBuilder = syncServiceBuilder.withProfilesExtension()
|
||||
}
|
||||
let syncService = try await syncServiceBuilder.finish()
|
||||
.withProfilesExtension()
|
||||
.finish()
|
||||
|
||||
let roomListService = syncService.roomListService()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user