mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +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()
|
||||
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5001fc410195d974fceb85fb9c8e03a25bd7614fe9ffd7d35d1ca3791b71df4d
|
||||
size 150756
|
||||
oid sha256:1f726044d8a49d258c45fed908f8b8f01ebcded5bbbc38b02a0cff3dcd6c034e
|
||||
size 197258
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:da52953ab4cf8a4b09f00ee3c5942f8bb946b108b1613fad1e906e833cf6fa00
|
||||
size 156816
|
||||
oid sha256:42a6af7f39cb3a6d50e84e256791b1dc5f08f545bdc3ef2f43d67e52ef44531d
|
||||
size 207954
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f0b3e32358f640201ad8efb3f397287c3b8f1286eb8f4b3510d521a104db5180
|
||||
size 97973
|
||||
oid sha256:cd22f43cdcddea73a1d2f1c4b9422baed91912212372b9960ed3e71aba3c3aa5
|
||||
size 128292
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:834144dc590660e7553cb94e24464d5eab47d096641c4e435190c731233db3d1
|
||||
size 114090
|
||||
oid sha256:2827f5cbfc4062bc8c5add80065425f75d45d75154b7c52c7e842365233058fc
|
||||
size 142202
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:49948b289947884a323d3d9e5af9b2d2b98689d57c6b15426cb56c9bab661da5
|
||||
size 150999
|
||||
oid sha256:d94de7877b34ea3c7ecab8a05814a13e68fecb57b192d7021e7e1a915372efbb
|
||||
size 208219
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c9a15bdedcbd5957ecf376e56a443dfaa55c08a486ab21df53b8def37df37e60
|
||||
size 157077
|
||||
oid sha256:311918b62e279dc255d8111b50f2496c1335f9af883134c2edb2ba3db75e8e0b
|
||||
size 219747
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c63dec2f3675ac96551c66cc5398cdfaa87ed600c267c92267bb50b8cf83120d
|
||||
size 98379
|
||||
oid sha256:0c651a47907c1892238d8d3b8bdfced2ccbb48e37db2d7cd5c0329768f7fee06
|
||||
size 135855
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b0107312537fe0627c61fc799f91009b36b39464e64545cb7280bf2b67fa3cb5
|
||||
size 117471
|
||||
oid sha256:b24d1b64e3f5b635c805625af5c1895d423d410efaae25755e13b933d582b62c
|
||||
size 152479
|
||||
|
||||
Reference in New Issue
Block a user