mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +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)
|
@UserPreference(key: "clientPausingAndResumingEnabledV2", defaultValue: false, volatile: true)
|
||||||
var clientPausingAndResumingEnabled: Bool
|
var clientPausingAndResumingEnabled: Bool
|
||||||
|
|
||||||
@UserPreference(defaultValue: false)
|
|
||||||
var userStatusEnabled: Bool
|
|
||||||
|
|
||||||
@UserPreference(defaultValue: AppBuildType.current != .release)
|
@UserPreference(defaultValue: AppBuildType.current != .release)
|
||||||
var developerOptionsEnabled: Bool
|
var developerOptionsEnabled: Bool
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ extension ClientProxyMock {
|
|||||||
loadUserProfileIfNeededReturnValue = .success(())
|
loadUserProfileIfNeededReturnValue = .success(())
|
||||||
setUserDisplayNameReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
setUserDisplayNameReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
||||||
setUserAvatarMediaReturnValue = .success(())
|
setUserAvatarMediaReturnValue = .success(())
|
||||||
isUserStatusSupportedReturnValue = .success(false)
|
isUserStatusSupportedReturnValue = .success(true)
|
||||||
setUserStatusReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
setUserStatusReturnValue = .failure(.sdkError(ClientProxyMockError.generic))
|
||||||
removeUserAvatarReturnValue = .success(())
|
removeUserAvatarReturnValue = .success(())
|
||||||
isAliasAvailableReturnValue = .success(true)
|
isAliasAvailableReturnValue = .success(true)
|
||||||
|
|||||||
-1
@@ -72,7 +72,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
|||||||
var jumpToReadMarkerEnabled: Bool { get set }
|
var jumpToReadMarkerEnabled: Bool { get set }
|
||||||
|
|
||||||
var linkNewDeviceEnabled: Bool { get set }
|
var linkNewDeviceEnabled: Bool { get set }
|
||||||
var userStatusEnabled: Bool { get set }
|
|
||||||
|
|
||||||
var roomThreadListEnabled: Bool { get set }
|
var roomThreadListEnabled: Bool { get set }
|
||||||
|
|
||||||
|
|||||||
-4
@@ -54,10 +54,6 @@ struct DeveloperOptionsScreen: View {
|
|||||||
Text("Moves search to a separate tab")
|
Text("Moves search to a separate tab")
|
||||||
}
|
}
|
||||||
|
|
||||||
Toggle(isOn: $context.userStatusEnabled) {
|
|
||||||
Text("User status")
|
|
||||||
}
|
|
||||||
|
|
||||||
context.viewState.appHooks
|
context.viewState.appHooks
|
||||||
.developerOptionsScreenHook
|
.developerOptionsScreenHook
|
||||||
.generalSectionRows(isSignedIn: context.viewState.isSignedIn)
|
.generalSectionRows(isSignedIn: context.viewState.isSignedIn)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ enum SettingsScreenSecuritySectionMode {
|
|||||||
struct SettingsScreenViewState: BindableState {
|
struct SettingsScreenViewState: BindableState {
|
||||||
var deviceID: String?
|
var deviceID: String?
|
||||||
var userProfile: UserProfile
|
var userProfile: UserProfile
|
||||||
var showUserStatus = false
|
var showUserStatusInput = false
|
||||||
var showLinkNewDeviceButton: Bool
|
var showLinkNewDeviceButton: Bool
|
||||||
var accountProfileURL: URL?
|
var accountProfileURL: URL?
|
||||||
var showAccountDeactivation: Bool
|
var showAccountDeactivation: Bool
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
|
|||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
if appSettings.userStatusEnabled, case .success(true) = await userSession.clientProxy.isUserStatusSupported() {
|
if case .success(true) = await userSession.clientProxy.isUserStatusSupported() {
|
||||||
state.showUserStatus = true
|
state.showUserStatusInput = true
|
||||||
}
|
}
|
||||||
await userSession.clientProxy.loadUserProfileIfNeeded()
|
await userSession.clientProxy.loadUserProfileIfNeeded()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ struct SettingsScreen: View {
|
|||||||
Form {
|
Form {
|
||||||
userSection
|
userSection
|
||||||
|
|
||||||
if context.viewState.showUserStatus {
|
if context.viewState.showUserStatusInput {
|
||||||
userStatusSection
|
userStatusSection
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,12 +291,16 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
SettingsScreen(context: viewModel.context)
|
SettingsScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(expect: viewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil })
|
.snapshotPreferences(expect: viewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil })
|
||||||
|
.frame(height: 1100)
|
||||||
|
.previewLayout(.sizeThatFits)
|
||||||
.previewDisplayName("Default")
|
.previewDisplayName("Default")
|
||||||
|
|
||||||
ElementNavigationStack {
|
ElementNavigationStack {
|
||||||
SettingsScreen(context: bugReportDisabledViewModel.context)
|
SettingsScreen(context: bugReportDisabledViewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(expect: bugReportDisabledViewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil })
|
.snapshotPreferences(expect: bugReportDisabledViewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil })
|
||||||
|
.frame(height: 1050)
|
||||||
|
.previewLayout(.sizeThatFits)
|
||||||
.previewDisplayName("Bug report disabled")
|
.previewDisplayName("Bug report disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,8 +281,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
try await client.setUtdDelegate(utdDelegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
|
try await client.setUtdDelegate(utdDelegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
|
||||||
|
|
||||||
let canSubscribeToUserProfile = if appSettings.userStatusEnabled,
|
let canSubscribeToUserProfile = if await (try? client.isProfilesSlidingSyncExtensionSupported()) == true {
|
||||||
await (try? client.isProfilesSlidingSyncExtensionSupported()) == true {
|
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
@@ -311,11 +310,9 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
mediaPreviewConfigListenerTaskHandle = await createMediaPreviewConfigObserver()
|
mediaPreviewConfigListenerTaskHandle = await createMediaPreviewConfigObserver()
|
||||||
}
|
}
|
||||||
|
|
||||||
if appSettings.userStatusEnabled {
|
Task {
|
||||||
Task {
|
guard case .success(true) = await isUserStatusSupported() else { return }
|
||||||
guard case .success(true) = await isUserStatusSupported() else { return }
|
client.enableAutomaticCallStatus(enabled: true)
|
||||||
client.enableAutomaticCallStatus(enabled: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
liveLocationOwnInfoUpdatesListenerTaskHandle = createLiveLocationOwnInfoUpdatesObserver()
|
liveLocationOwnInfoUpdatesListenerTaskHandle = createLiveLocationOwnInfoUpdatesObserver()
|
||||||
@@ -1531,14 +1528,12 @@ private struct ClientProxyServices {
|
|||||||
init(client: ClientProtocol,
|
init(client: ClientProtocol,
|
||||||
notificationSettings: NotificationSettingsProxyProtocol,
|
notificationSettings: NotificationSettingsProxyProtocol,
|
||||||
appSettings: AppSettings) async throws {
|
appSettings: AppSettings) async throws {
|
||||||
var syncServiceBuilder = client
|
let syncService = try await client
|
||||||
.syncService()
|
.syncService()
|
||||||
.withOfflineMode()
|
.withOfflineMode()
|
||||||
.withSharePos(enable: true)
|
.withSharePos(enable: true)
|
||||||
if appSettings.userStatusEnabled {
|
.withProfilesExtension()
|
||||||
syncServiceBuilder = syncServiceBuilder.withProfilesExtension()
|
.finish()
|
||||||
}
|
|
||||||
let syncService = try await syncServiceBuilder.finish()
|
|
||||||
|
|
||||||
let roomListService = syncService.roomListService()
|
let roomListService = syncService.roomListService()
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:5001fc410195d974fceb85fb9c8e03a25bd7614fe9ffd7d35d1ca3791b71df4d
|
oid sha256:1f726044d8a49d258c45fed908f8b8f01ebcded5bbbc38b02a0cff3dcd6c034e
|
||||||
size 150756
|
size 197258
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:da52953ab4cf8a4b09f00ee3c5942f8bb946b108b1613fad1e906e833cf6fa00
|
oid sha256:42a6af7f39cb3a6d50e84e256791b1dc5f08f545bdc3ef2f43d67e52ef44531d
|
||||||
size 156816
|
size 207954
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f0b3e32358f640201ad8efb3f397287c3b8f1286eb8f4b3510d521a104db5180
|
oid sha256:cd22f43cdcddea73a1d2f1c4b9422baed91912212372b9960ed3e71aba3c3aa5
|
||||||
size 97973
|
size 128292
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:834144dc590660e7553cb94e24464d5eab47d096641c4e435190c731233db3d1
|
oid sha256:2827f5cbfc4062bc8c5add80065425f75d45d75154b7c52c7e842365233058fc
|
||||||
size 114090
|
size 142202
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:49948b289947884a323d3d9e5af9b2d2b98689d57c6b15426cb56c9bab661da5
|
oid sha256:d94de7877b34ea3c7ecab8a05814a13e68fecb57b192d7021e7e1a915372efbb
|
||||||
size 150999
|
size 208219
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c9a15bdedcbd5957ecf376e56a443dfaa55c08a486ab21df53b8def37df37e60
|
oid sha256:311918b62e279dc255d8111b50f2496c1335f9af883134c2edb2ba3db75e8e0b
|
||||||
size 157077
|
size 219747
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c63dec2f3675ac96551c66cc5398cdfaa87ed600c267c92267bb50b8cf83120d
|
oid sha256:0c651a47907c1892238d8d3b8bdfced2ccbb48e37db2d7cd5c0329768f7fee06
|
||||||
size 98379
|
size 135855
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:b0107312537fe0627c61fc799f91009b36b39464e64545cb7280bf2b67fa3cb5
|
oid sha256:b24d1b64e3f5b635c805625af5c1895d423d410efaae25755e13b933d582b62c
|
||||||
size 117471
|
size 152479
|
||||||
|
|||||||
Reference in New Issue
Block a user