Update history visible settings (#4861)

* Fixes #4852 - Update history visible settings

* Address PR comments and move attributed strings to the view state
This commit is contained in:
Stefan Ceriu 2025-12-17 15:04:02 +02:00 committed by GitHub
parent aa28ef3f19
commit 8164c88437
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 150 additions and 112 deletions

View file

@ -702,9 +702,11 @@
"screen_security_and_privacy_room_directory_visibility_section_footer" = "Allow for this room to be found by searching %1$@ public room directory";
"screen_security_and_privacy_room_directory_visibility_toggle_description" = "Allow to be found by searching the public directory.";
"screen_security_and_privacy_room_directory_visibility_toggle_title" = "Visible in public directory";
"screen_security_and_privacy_room_history_anyone_option_title" = "Anyone (history is public)";
"screen_security_and_privacy_room_history_section_footer" = "Changes won't affect past messages, only new ones. %@";
"screen_security_and_privacy_room_history_section_header" = "Who can read history";
"screen_security_and_privacy_room_history_since_invite_option_title" = "Members only since they were invited";
"screen_security_and_privacy_room_history_since_selecting_option_title" = "Members only since selecting this option";
"screen_security_and_privacy_room_history_since_invite_option_title" = "Members since invited";
"screen_security_and_privacy_room_history_since_selecting_option_title" = "Members (full history)";
"screen_security_and_privacy_room_publishing_section_footer" = "Room addresses are ways to find and access rooms. This also ensures you can easily share your room with others.\nYou can choose to publish your room in your homeserver public room directory.";
"screen_security_and_privacy_room_publishing_section_header" = "Room publishing";
"screen_security_and_privacy_room_visibility_section_footer" = "Addresses are a way to find and access rooms and spaces. This also ensures you can easily share them with others.";
@ -1411,7 +1413,6 @@
"screen_security_and_privacy_room_access_anyone_option_title" = "Anyone";
"screen_security_and_privacy_room_access_footer_manage_spaces_action" = "Manage spaces";
"screen_security_and_privacy_room_address_section_footer" = "Youll need an address in order to make it visible in the public directory.";
"screen_security_and_privacy_room_history_anyone_option_title" = "Anyone";
"screen_space_settings_leave_space" = "Leave space";
"screen_space_settings_roles_and_permissions" = "Roles & permissions";
"screen_space_settings_security_and_privacy" = "Security & privacy";

View file

@ -702,9 +702,11 @@
"screen_security_and_privacy_room_directory_visibility_section_footer" = "Allow for this room to be found by searching %1$@ public room directory";
"screen_security_and_privacy_room_directory_visibility_toggle_description" = "Allow to be found by searching the public directory.";
"screen_security_and_privacy_room_directory_visibility_toggle_title" = "Visible in public directory";
"screen_security_and_privacy_room_history_anyone_option_title" = "Anyone (history is public)";
"screen_security_and_privacy_room_history_section_footer" = "Changes won't affect past messages, only new ones. %@";
"screen_security_and_privacy_room_history_section_header" = "Who can read history";
"screen_security_and_privacy_room_history_since_invite_option_title" = "Members only since they were invited";
"screen_security_and_privacy_room_history_since_selecting_option_title" = "Members only since selecting this option";
"screen_security_and_privacy_room_history_since_invite_option_title" = "Members since invited";
"screen_security_and_privacy_room_history_since_selecting_option_title" = "Members (full history)";
"screen_security_and_privacy_room_publishing_section_footer" = "Room addresses are ways to find and access rooms. This also ensures you can easily share your room with others.\nYou can choose to publish your room in your homeserver public room directory.";
"screen_security_and_privacy_room_publishing_section_header" = "Room publishing";
"screen_security_and_privacy_room_visibility_section_footer" = "Addresses are a way to find and access rooms and spaces. This also ensures you can easily share them with others.";
@ -1411,7 +1413,6 @@
"screen_security_and_privacy_room_access_anyone_option_title" = "Anyone";
"screen_security_and_privacy_room_access_footer_manage_spaces_action" = "Manage spaces";
"screen_security_and_privacy_room_address_section_footer" = "Youll need an address in order to make it visible in the public directory.";
"screen_security_and_privacy_room_history_anyone_option_title" = "Anyone";
"screen_space_settings_leave_space" = "Leave space";
"screen_space_settings_roles_and_permissions" = "Roles & permissions";
"screen_space_settings_security_and_privacy" = "Security & privacy";

View file

@ -125,6 +125,7 @@ final class AppSettings {
deviceVerificationURL: URL,
chatBackupDetailsURL: URL,
identityPinningViolationDetailsURL: URL,
historySharingDetailsURL: URL,
elementWebHosts: [String],
accountProvisioningHost: String,
bugReportApplicationID: String,
@ -144,6 +145,7 @@ final class AppSettings {
self.deviceVerificationURL = deviceVerificationURL
self.chatBackupDetailsURL = chatBackupDetailsURL
self.identityPinningViolationDetailsURL = identityPinningViolationDetailsURL
self.historySharingDetailsURL = historySharingDetailsURL
self.elementWebHosts = elementWebHosts
self.accountProvisioningHost = accountProvisioningHost
self.bugReportApplicationID = bugReportApplicationID
@ -202,6 +204,9 @@ final class AppSettings {
private(set) var chatBackupDetailsURL: URL = "https://element.io/help#encryption5"
/// A URL where users can go read more about identity pinning violations
private(set) var identityPinningViolationDetailsURL: URL = "https://element.io/help#encryption18"
/// A URL describing how history sharing works
private(set) var historySharingDetailsURL: URL = "https://element.io/en/help#e2ee-history-sharing"
/// Any domains that Element web may be hosted on - used for handling links.
private(set) var elementWebHosts = ["app.element.io", "staging.element.io", "develop.element.io"]
/// The domain that account provisioning links will be hosted on - used for handling the links.

View file

@ -2906,13 +2906,17 @@ internal enum L10n {
internal static var screenSecurityAndPrivacyRoomDirectoryVisibilityToggleDescription: String { return L10n.tr("Localizable", "screen_security_and_privacy_room_directory_visibility_toggle_description") }
/// Visible in public directory
internal static var screenSecurityAndPrivacyRoomDirectoryVisibilityToggleTitle: String { return L10n.tr("Localizable", "screen_security_and_privacy_room_directory_visibility_toggle_title") }
/// Anyone
/// Anyone (history is public)
internal static var screenSecurityAndPrivacyRoomHistoryAnyoneOptionTitle: String { return L10n.tr("Localizable", "screen_security_and_privacy_room_history_anyone_option_title") }
/// Changes won't affect past messages, only new ones. %@
internal static func screenSecurityAndPrivacyRoomHistorySectionFooter(_ p1: Any) -> String {
return L10n.tr("Localizable", "screen_security_and_privacy_room_history_section_footer", String(describing: p1))
}
/// Who can read history
internal static var screenSecurityAndPrivacyRoomHistorySectionHeader: String { return L10n.tr("Localizable", "screen_security_and_privacy_room_history_section_header") }
/// Members only since they were invited
/// Members since invited
internal static var screenSecurityAndPrivacyRoomHistorySinceInviteOptionTitle: String { return L10n.tr("Localizable", "screen_security_and_privacy_room_history_since_invite_option_title") }
/// Members only since selecting this option
/// Members (full history)
internal static var screenSecurityAndPrivacyRoomHistorySinceSelectingOptionTitle: String { return L10n.tr("Localizable", "screen_security_and_privacy_room_history_since_selecting_option_title") }
/// Room addresses are ways to find and access rooms. This also ensures you can easily share your room with others.
/// You can choose to publish your room in your homeserver public room directory.

View file

@ -15,20 +15,12 @@ enum SecurityAndPrivacyScreenViewModelAction {
}
struct SecurityAndPrivacyScreenViewState: BindableState {
private static let accessSectionFooterAttributedString = {
let linkPlaceholder = "{link}"
var footer = AttributedString(L10n.screenSecurityAndPrivacyRoomAccessFooter(linkPlaceholder))
var linkString = AttributedString(L10n.screenSecurityAndPrivacyRoomAccessFooterManageSpacesAction)
// Doesn't really matter
linkString.link = .init(stringLiteral: "action://manageSpace")
linkString.bold()
footer.replace(linkPlaceholder, with: linkString)
return footer
}()
let serverName: String
var currentSettings: SecurityAndPrivacySettings
var bindings: SecurityAndPrivacyScreenViewStateBindings
let strings: SecurityAndPrivacyScreenStrings
var canonicalAlias: String?
var isKnockingEnabled: Bool
var isSpaceSettingsEnabled: Bool
@ -38,6 +30,7 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
var canEditJoinRule = false
var canEnableEncryption = false
var canEditHistoryVisibility = false
/// The union of joined parent spaces and the joined spaces in the current access type
var selectableJoinedSpaces: [SpaceRoomProxyProtocol] = []
@ -58,13 +51,13 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
}
var availableVisibilityOptions: [SecurityAndPrivacyHistoryVisibility] {
var options = [SecurityAndPrivacyHistoryVisibility.sinceSelection]
var options = [SecurityAndPrivacyHistoryVisibility.shared]
if !bindings.desiredSettings.isEncryptionEnabled, bindings.desiredSettings.accessType == .anyone {
options.append(.anyone)
options.append(.worldReadable)
} else {
options.append(.sinceInvite)
options.append(.invited)
}
return options
return options.sorted()
}
var isSpaceMembersOptionAvailable: Bool {
@ -113,16 +106,14 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
}
}
var accessSectionFooter: AttributedString? {
if (bindings.desiredSettings.accessType.isSpaceMembers &&
isSpaceMembersOptionSelectable) ||
(bindings.desiredSettings.accessType.isAskToJoinWithSpaceMembers &&
isAskToJoinWithSpaceMembersOptionSelectable),
var shouldShowAccessSectionFooter: Bool {
if (bindings.desiredSettings.accessType.isSpaceMembers && isSpaceMembersOptionSelectable) ||
(bindings.desiredSettings.accessType.isAskToJoinWithSpaceMembers && isAskToJoinWithSpaceMembersOptionSelectable),
case .multiple = spaceSelection {
Self.accessSectionFooterAttributedString
} else {
nil
return true
}
return false
}
enum SpaceSelection {
@ -169,7 +160,8 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
historyVisibility: SecurityAndPrivacyHistoryVisibility,
isSpace: Bool,
isKnockingEnabled: Bool,
isSpaceSettingsEnabled: Bool) {
isSpaceSettingsEnabled: Bool,
historySharingDetailsURL: URL) {
self.serverName = serverName
self.isKnockingEnabled = isKnockingEnabled
self.isSpace = isSpace
@ -180,6 +172,7 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
historyVisibility: historyVisibility)
currentSettings = settings
bindings = SecurityAndPrivacyScreenViewStateBindings(desiredSettings: settings)
strings = SecurityAndPrivacyScreenStrings(historySharingDetailsURL: historySharingDetailsURL)
}
}
@ -254,17 +247,44 @@ enum SecurityAndPrivacyScreenViewAction {
case manageSpaces
}
enum SecurityAndPrivacyHistoryVisibility {
case sinceSelection
case sinceInvite
case anyone
enum SecurityAndPrivacyHistoryVisibility: Int, Comparable {
case invited
case shared
case worldReadable
var fallbackOption: Self {
switch self {
case .sinceInvite, .sinceSelection:
return .sinceSelection
case .anyone:
return .sinceInvite
case .invited, .shared:
return .shared
case .worldReadable:
return .invited
}
}
static func < (lhs: SecurityAndPrivacyHistoryVisibility, rhs: SecurityAndPrivacyHistoryVisibility) -> Bool {
lhs.rawValue < rhs.rawValue
}
}
struct SecurityAndPrivacyScreenStrings {
let accessSectionFooterString: AttributedString
let historySectionFooterString: AttributedString
init(historySharingDetailsURL: URL) {
let linkPlaceholder = "{link}"
var accessFooterString = AttributedString(L10n.screenSecurityAndPrivacyRoomAccessFooter(linkPlaceholder))
var accessLinkString = AttributedString(L10n.screenSecurityAndPrivacyRoomAccessFooterManageSpacesAction)
accessLinkString.link = .init(stringLiteral: "action://manageSpace") // The link address doesn't matter
accessLinkString.bold()
accessFooterString.replace(linkPlaceholder, with: accessLinkString)
accessSectionFooterString = accessFooterString
var historyFooterString = AttributedString(L10n.screenSecurityAndPrivacyRoomHistorySectionFooter(linkPlaceholder))
var historyLinkString = AttributedString(L10n.actionLearnMore)
historyLinkString.link = historySharingDetailsURL
historyLinkString.bold()
historyFooterString.replace(linkPlaceholder, with: historyLinkString)
historySectionFooterString = historyFooterString
}
}

View file

@ -38,7 +38,8 @@ class SecurityAndPrivacyScreenViewModel: SecurityAndPrivacyScreenViewModelType,
historyVisibility: roomProxy.infoPublisher.value.historyVisibility.toSecurityAndPrivacyHistoryVisibility,
isSpace: roomProxy.infoPublisher.value.isSpace,
isKnockingEnabled: appSettings.knockingEnabled,
isSpaceSettingsEnabled: appSettings.spaceSettingsEnabled))
isSpaceSettingsEnabled: appSettings.spaceSettingsEnabled,
historySharingDetailsURL: appSettings.historySharingDetailsURL))
if let powerLevels = roomProxy.infoPublisher.value.powerLevels {
setupPermissions(powerLevels: powerLevels)
@ -345,11 +346,11 @@ private extension RoomHistoryVisibility {
var toSecurityAndPrivacyHistoryVisibility: SecurityAndPrivacyHistoryVisibility {
switch self {
case .joined, .invited:
return .sinceInvite
return .invited
case .shared, .custom:
return .sinceSelection
return .shared
case .worldReadable:
return .anyone
return .worldReadable
}
}
}
@ -357,11 +358,11 @@ private extension RoomHistoryVisibility {
private extension SecurityAndPrivacyHistoryVisibility {
var toRoomHistoryVisibility: RoomHistoryVisibility {
switch self {
case .sinceSelection:
case .shared:
return .shared
case .sinceInvite:
case .invited:
return .invited
case .anyone:
case .worldReadable:
return .worldReadable
}
}

View file

@ -80,8 +80,8 @@ struct SecurityAndPrivacyScreen: View {
Text(L10n.screenSecurityAndPrivacyRoomAccessSectionHeader)
.compoundListSectionHeader()
} footer: {
if let footer = context.viewState.accessSectionFooter {
Text(footer)
if context.viewState.shouldShowAccessSectionFooter {
Text(context.viewState.strings.accessSectionFooterString)
.compoundListSectionFooter()
.environment(\.openURL, OpenURLAction { _ in
context.send(viewAction: .manageSpaces)
@ -133,20 +133,23 @@ struct SecurityAndPrivacyScreen: View {
Section {
ForEach(context.viewState.availableVisibilityOptions, id: \.self) { option in
switch option {
case .sinceSelection:
ListRow(label: .plain(title: L10n.screenSecurityAndPrivacyRoomHistorySinceSelectingOptionTitle),
kind: .selection(isSelected: context.desiredSettings.historyVisibility == .sinceSelection) { context.desiredSettings.historyVisibility = .sinceSelection })
case .anyone:
ListRow(label: .plain(title: L10n.screenSecurityAndPrivacyRoomHistoryAnyoneOptionTitle),
kind: .selection(isSelected: context.desiredSettings.historyVisibility == .anyone) { context.desiredSettings.historyVisibility = .anyone })
case .sinceInvite:
case .invited:
ListRow(label: .plain(title: L10n.screenSecurityAndPrivacyRoomHistorySinceInviteOptionTitle),
kind: .selection(isSelected: context.desiredSettings.historyVisibility == .sinceInvite) { context.desiredSettings.historyVisibility = .sinceInvite })
kind: .selection(isSelected: context.desiredSettings.historyVisibility == .invited) { context.desiredSettings.historyVisibility = .invited })
case .shared:
ListRow(label: .plain(title: L10n.screenSecurityAndPrivacyRoomHistorySinceSelectingOptionTitle),
kind: .selection(isSelected: context.desiredSettings.historyVisibility == .shared) { context.desiredSettings.historyVisibility = .shared })
case .worldReadable:
ListRow(label: .plain(title: L10n.screenSecurityAndPrivacyRoomHistoryAnyoneOptionTitle),
kind: .selection(isSelected: context.desiredSettings.historyVisibility == .worldReadable) { context.desiredSettings.historyVisibility = .worldReadable })
}
}
} header: {
Text(L10n.screenSecurityAndPrivacyRoomHistorySectionHeader)
.compoundListSectionHeader()
} footer: {
Text(context.viewState.strings.historySectionFooterString)
.compoundListSectionFooter()
}
}

View file

@ -140,6 +140,7 @@ class MockScreen: Identifiable {
deviceVerificationURL: appSettings.deviceVerificationURL,
chatBackupDetailsURL: appSettings.chatBackupDetailsURL,
identityPinningViolationDetailsURL: appSettings.identityPinningViolationDetailsURL,
historySharingDetailsURL: appSettings.historySharingDetailsURL,
elementWebHosts: appSettings.elementWebHosts,
accountProvisioningHost: appSettings.accountProvisioningHost,
bugReportApplicationID: appSettings.bugReportApplicationID,

@ -1 +1 @@
Subproject commit e2c37065c61558b89129f90d71bd772bc30d3b22
Subproject commit a6439b534c613e1467e7e428ee4a03547c9bd44f

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b48503263e69f43d77a74d362a7321ad34b8a921d8b55920412a0097d439327
size 199998
oid sha256:4a2874e02e5bae080c7f422b1359199f70f208d60735825416419882e8161b80
size 195179

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:04f76939d9f03527eea26ea8f671c772c8f9ec45ee2d1a13b0621ada54fa9805
size 239279
oid sha256:c90113d2a9b105c70446f58fa0e766b1cfdb83d4dae9b4c34efbb575b2cc5d3e
size 233537

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e27693a7e2e81d74edfca587593d50ea25e6eafbf3af381152ed358bfc9bc56
size 132843
oid sha256:f7aa48ef3727c3fcc42a3b85a55417c217e50a4e50546b1fcb5bf92bb76152e3
size 132863

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3bcd80b001708d7b146832168487813d1523f421cb30e17c8c540017b72db92
size 169810
oid sha256:b0aa0475b725e6098fa24ac761fd3f49911b383c9570c8bb13db4f3377a01d95
size 173106

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4f699861f429677ecbdd74449f9a5316b35446346d67a1f7433ca2cdce3d439
size 207842
oid sha256:d1a17202d7e423dd0cf4f3c593f53567fd90f225909a7aa7383eb66f91637926
size 215712

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3973e132104bbca48b78481b1b625d1cbc322d2346792538ec6f7f7abcc5642c
size 116706
oid sha256:4077cfd59711750fdb1fe0b7db83d0ba40d037ad1f5bb90003f5cf5be256e71c
size 118589

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a9269423611b2bc9bba3a1fc435a78bb759b04d56987532ec98fb6d2eb6e254f
size 171602
oid sha256:f38216df06296e66f901f091bddd63a4a39543f6b8ba918852ff63c27968b425
size 175811

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29d02ff5d0e8b72fd0331ae941b1f31dfc7b673d90239d91a7c4084f8c136621
size 144394
oid sha256:19ee4c8b01d1b18b962971ae0b1b950279863d12e832b572e2635837ace8f569
size 148707

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:82799f6f7b4492e9ac35126851a00be1f7419449dbf55a3b1d65366127b71de3
size 170443
oid sha256:96cf543a0c2e74f0551ea7fd0ce6e7e8bd99917548fe909140fe437a9e567068
size 178398

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e845ee148aa81dcedfe402297b1f02bc43a1d44d996ddc5cbc63a7654ed25d84
size 92004
oid sha256:108fa3154405e527b4f83dfb15f2d7720b375c349c8d9de50c4984192839ef26
size 93016

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d4387dfb9c807dd865ceeea3c2385a0443cb507aa2bb168256a55557c871b65
size 127409
oid sha256:78b1a757c93851e03f3b3985b0e0b53a132447b307cae179cc2f1004b3ace777
size 132322

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1bec92ef9a845303d03b1ea1889db19f7a47e98ab8dd054e87b67bd0f1aa3b26
size 186779
oid sha256:9af7a48f714bec7db946bdf6762507aca1cd5609eadcb025857f7f3a7bd33179
size 198158

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:340e36605dc15ae5a8b0277e263308b8ca1d50daf17bf096a6817728a4f21314
size 230701
oid sha256:09c27b020aa57d79a2c3f45477488ec16221b9c0527d3e267a1ff97e4e7de201
size 250631

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b802c8a6e3d596fcbbe93e06e4d61c710dba500c425208f2a0c135da72eccf9e
size 132822
oid sha256:5ea2f6d3dfa555f7be8886086f8f9885e8a537599e5e130d8019e870b5018b2a
size 134575

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ab333cea8fc694964547481d6f7f81a2a0cde6a36b280136d3f27025432f77c
size 159173
oid sha256:c324010c3328fa225c4477f1bb27be733072e5d8cd3ce888db6220a6d3bda0e6
size 170487

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2bcebf976c3d773027f92bbd67219ad73c094911006df8bdcc212944e2bf1256
size 196268
oid sha256:a9f990d9f6f2f095601efa8c1e4095a35d536144c38bcef9ad6c2aa9f860b8c3
size 216361

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e395a16e80474762ccbb09e690bc87e570adaf0bbf7b45ec66d2c236711f758
size 107787
oid sha256:bbc7316079d963ff3b8bc1680ba8bdc8212985668552de2fca39a6c51d004ab0
size 115669

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ce54e285e0750c2d0435f14e27ea142e7519a0aa8f7666785ad7c6fd00db6a8
size 150993
oid sha256:23fddbb25038c9fdc0bfa53d48e0093cd22f4bc02453d0c4e436a64d531eb388
size 153794

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5260ba3c86cd6d45a7c6c8340f535a584e4a6df6633beacaa8fdc5ee2d8e070c
size 156742
oid sha256:b05a474e324855ae6a103ba650d11789b18ad5aabbf2690d5597302e58f1949b
size 160311

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8482c728dcab50c5ec8dee6a26e45c9c274c72e2ba38ae5a2f65aa4f99d7d7f0
size 187240
oid sha256:ae46bf0c3b975cd3314419e27af5e008f4c33e7682803a917f7b830accfc126c
size 195684

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:26a31269bb5d89e8575f92305885f876eea5f05cb44b993705519d25bdd6354a
size 103262
oid sha256:1709e4b6fa0940284e48c4b8725c79361b5618fcdc3e49db8b87ccc5b0d874d9
size 105070

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:55fd33e5832f09c6cbbb5456ba3a50a878fae58cd87845cc6e2702cb6ad802f0
size 146541
oid sha256:9ff5f7930b551928469368cd0ce87fc0819ee63ccd01f8c1f627b21251ae8507
size 151578

View file

@ -172,6 +172,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase {
deviceVerificationURL: appSettings.deviceVerificationURL,
chatBackupDetailsURL: appSettings.chatBackupDetailsURL,
identityPinningViolationDetailsURL: appSettings.identityPinningViolationDetailsURL,
historySharingDetailsURL: appSettings.historySharingDetailsURL,
elementWebHosts: appSettings.elementWebHosts,
accountProvisioningHost: appSettings.accountProvisioningHost,
bugReportApplicationID: appSettings.bugReportApplicationID,

View file

@ -46,7 +46,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
context.send(viewAction: .selectedSpaceMembersAccess)
XCTAssertEqual(context.desiredSettings.accessType, .spaceMembers(spaceIDs: [space.id]))
XCTAssertNil(context.viewState.accessSectionFooter)
XCTAssertFalse(context.viewState.shouldShowAccessSectionFooter)
XCTAssertFalse(context.viewState.isSaveDisabled)
let expectation = expectation(description: "Join rule has updated")
@ -77,7 +77,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
context.send(viewAction: .selectedAskToJoinWithSpaceMembersAccess)
XCTAssertEqual(context.desiredSettings.accessType, .askToJoinWithSpaceMembers(spaceIDs: [space.id]))
XCTAssertNil(context.viewState.accessSectionFooter)
XCTAssertFalse(context.viewState.shouldShowAccessSectionFooter)
XCTAssertFalse(context.viewState.isSaveDisabled)
let expectation = expectation(description: "Join rule has updated")
@ -101,7 +101,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
XCTAssertEqual(context.viewState.currentSettings.accessType, .spaceMembers(spaceIDs: [space.id]))
XCTAssertEqual(context.desiredSettings, context.viewState.currentSettings)
XCTAssertTrue(context.viewState.isSpaceMembersOptionSelectable)
XCTAssertNil(context.viewState.accessSectionFooter)
XCTAssertFalse(context.viewState.shouldShowAccessSectionFooter)
XCTAssertTrue(context.viewState.isSaveDisabled)
guard case .singleUnknown = context.viewState.spaceSelection else {
XCTFail("Expected spaceSelection to be .singleUnknown")
@ -152,7 +152,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
try await deferredAction.fulfill()
selectedIDs.send([spaces[0].id])
XCTAssertEqual(context.desiredSettings.accessType, .spaceMembers(spaceIDs: [spaces[0].id]))
XCTAssertNotNil(context.viewState.accessSectionFooter)
XCTAssertTrue(context.viewState.shouldShowAccessSectionFooter)
XCTAssertFalse(context.viewState.isSaveDisabled)
let expectation = expectation(description: "Join rule has updated")
@ -196,7 +196,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
try await deferredAction.fulfill()
selectedIDs.send([spaces[0].id])
XCTAssertEqual(context.desiredSettings.accessType, .askToJoinWithSpaceMembers(spaceIDs: [spaces[0].id]))
XCTAssertNotNil(context.viewState.accessSectionFooter)
XCTAssertTrue(context.viewState.shouldShowAccessSectionFooter)
XCTAssertFalse(context.viewState.isSaveDisabled)
let expectation = expectation(description: "Join rule has updated")
@ -242,7 +242,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
try await deferredAction.fulfill()
selectedIDs.send([spaces[0].id, "unknownSpaceID"])
XCTAssertEqual(context.desiredSettings.accessType, .spaceMembers(spaceIDs: [spaces[0].id, "unknownSpaceID"]))
XCTAssertNotNil(context.viewState.accessSectionFooter)
XCTAssertTrue(context.viewState.shouldShowAccessSectionFooter)
XCTAssertFalse(context.viewState.isSaveDisabled)
let expectation = expectation(description: "Join rule has updated")
@ -293,7 +293,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
try await deferredAction.fulfill()
selectedIDs.send([allSpaces[0].id, "unknownSpaceID"])
XCTAssertEqual(context.desiredSettings.accessType, .spaceMembers(spaceIDs: [allSpaces[0].id, "unknownSpaceID"]))
XCTAssertNotNil(context.viewState.accessSectionFooter)
XCTAssertTrue(context.viewState.shouldShowAccessSectionFooter)
XCTAssertFalse(context.viewState.isSaveDisabled)
}
@ -309,7 +309,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
XCTAssertTrue(context.viewState.currentSettings.accessType.isSpaceMembers)
XCTAssertTrue(context.viewState.isSaveDisabled)
XCTAssertFalse(context.viewState.isSpaceMembersOptionSelectable)
XCTAssertNil(context.viewState.accessSectionFooter)
XCTAssertFalse(context.viewState.shouldShowAccessSectionFooter)
guard case .empty = context.viewState.spaceSelection else {
XCTFail("Expected spaceSelection to be .empty")
return
@ -329,7 +329,7 @@ class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
XCTAssertTrue(context.viewState.currentSettings.accessType.isSpaceMembers)
XCTAssertTrue(context.viewState.isSaveDisabled)
XCTAssertTrue(context.viewState.isSpaceMembersOptionSelectable)
XCTAssertNotNil(context.viewState.accessSectionFooter)
XCTAssertTrue(context.viewState.shouldShowAccessSectionFooter)
guard case .multiple = context.viewState.spaceSelection else {
XCTFail("Expected spaceSelection to be .multiple")
return

View file

@ -324,6 +324,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase {
deviceVerificationURL: appSettings.deviceVerificationURL,
chatBackupDetailsURL: appSettings.chatBackupDetailsURL,
identityPinningViolationDetailsURL: appSettings.identityPinningViolationDetailsURL,
historySharingDetailsURL: appSettings.historySharingDetailsURL,
elementWebHosts: appSettings.elementWebHosts,
accountProvisioningHost: appSettings.accountProvisioningHost,
bugReportApplicationID: appSettings.bugReportApplicationID,