disable creation and enabling of e2ee if remote preference for disabling it is true

This commit is contained in:
Mauro Romito
2026-07-13 14:03:15 +02:00
committed by Mauro
parent 3ba5c08c13
commit b730815842
5 changed files with 23 additions and 5 deletions
@@ -434,13 +434,24 @@ final class SecurityAndPrivacyScreenViewModelTests {
try await deferred.fulfill()
}
@Test
func encryptionOptionAvailability() {
setupViewModel(joinedParentSpaces: [], joinRule: .public)
#expect(context.viewState.canEnableEncryption)
setupViewModel(joinedParentSpaces: [], joinRule: .public, forceDisableE2EE: true)
#expect(!context.viewState.canEnableEncryption)
}
// MARK: - Helpers
private func setupViewModel(joinedParentSpaces: [SpaceServiceRoom],
topLevelSpaces: [SpaceServiceRoom] = [],
joinRule: ElementX.JoinRule) {
joinRule: ElementX.JoinRule,
forceDisableE2EE: Bool = false) {
let appSettings = AppSettings.volatile()
appSettings.knockingEnabled = true
appSettings.forceDisableE2EE.applyRemoteValue(forceDisableE2EE)
roomProxy = JoinedRoomProxyMock(.init(isEncrypted: false,
canonicalAlias: "#room:matrix.org",
members: .allMembersAsCreator,