From 10597ec9be8ddea61206b4d238ae1eb7c675d66f Mon Sep 17 00:00:00 2001 From: Aaron Thornburgh <112560169+americanrefugee@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:00:10 +0100 Subject: [PATCH] Use an iOS 26 close button and re-order some sections in SettingsScreen. (#5281) * Settings > Change Done button to Close Do it! * Change ordering of menu item sections Swap manage app section with manage account section. * Use a primaryAction placement for the close button. * Generate the preview snapshots. * Merge the Manage account and Manage devices actions. --------- Co-authored-by: Doug --- .../en-US.lproj/Localizable.strings | 1 + .../en.lproj/Localizable.strings | 1 + ElementX/Sources/Generated/Strings.swift | 2 ++ .../SettingsScreen/SettingsScreenModels.swift | 1 - .../SettingsScreenViewModel.swift | 1 - .../SettingsScreen/View/SettingsScreen.swift | 34 +++++++------------ ...sScreen.Bug-report-disabled-iPad-en-GB.png | 4 +-- ...Screen.Bug-report-disabled-iPad-pseudo.png | 4 +-- ...creen.Bug-report-disabled-iPhone-en-GB.png | 4 +-- ...reen.Bug-report-disabled-iPhone-pseudo.png | 4 +-- .../settingsScreen.Default-iPad-en-GB.png | 4 +-- .../settingsScreen.Default-iPad-pseudo.png | 4 +-- .../settingsScreen.Default-iPhone-en-GB.png | 4 +-- .../settingsScreen.Default-iPhone-pseudo.png | 4 +-- 14 files changed, 33 insertions(+), 39 deletions(-) diff --git a/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings b/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings index b1023cc18..6f1cd3922 100644 --- a/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en-US.lproj/Localizable.strings @@ -112,6 +112,7 @@ "action_leave_space" = "Leave space"; "action_load_more" = "Load more"; "action_manage_account" = "Manage account"; +"action_manage_account_and_devices" = "Manage account & devices"; "action_manage_devices" = "Manage devices"; "action_manage_rooms" = "Manage rooms"; "action_message" = "Message"; diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index e4f0136df..60d06eb20 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -112,6 +112,7 @@ "action_leave_space" = "Leave space"; "action_load_more" = "Load more"; "action_manage_account" = "Manage account"; +"action_manage_account_and_devices" = "Manage account & devices"; "action_manage_devices" = "Manage devices"; "action_manage_rooms" = "Manage rooms"; "action_message" = "Message"; diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index 20a1f3221..b0ace3180 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -262,6 +262,8 @@ internal enum L10n { internal static var actionLoadMore: String { return L10n.tr("Localizable", "action_load_more") } /// Manage account internal static var actionManageAccount: String { return L10n.tr("Localizable", "action_manage_account") } + /// Manage account & devices + internal static var actionManageAccountAndDevices: String { return L10n.tr("Localizable", "action_manage_account_and_devices") } /// Manage devices internal static var actionManageDevices: String { return L10n.tr("Localizable", "action_manage_devices") } /// Manage rooms diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift index a02b0acc7..531b8d558 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift @@ -38,7 +38,6 @@ struct SettingsScreenViewState: BindableState { var userID: String var showLinkNewDeviceButton: Bool var accountProfileURL: URL? - var accountSessionsListURL: URL? var showAccountDeactivation: Bool var userAvatarURL: URL? var userDisplayName: String? diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift index 49b8d6659..662eff076 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift @@ -88,7 +88,6 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo await userSession.clientProxy.loadUserAvatarURL() await userSession.clientProxy.loadUserDisplayName() await state.accountProfileURL = userSession.clientProxy.accountURL(action: .profile) - await state.accountSessionsListURL = userSession.clientProxy.accountURL(action: .devicesList) } } diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift index e9769cbe0..829ebe069 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift @@ -15,20 +15,20 @@ struct SettingsScreen: View { private var shouldHideManageAccountSection: Bool { context.viewState.accountProfileURL == nil && - context.viewState.accountSessionsListURL == nil && - !context.viewState.showBlockedUsers + !context.viewState.showBlockedUsers && + !context.viewState.showLinkNewDeviceButton } var body: some View { Form { userSection - manageMyAppSection - if !shouldHideManageAccountSection { manageAccountSection } + manageMyAppSection + generalSection signOutSection @@ -108,16 +108,8 @@ struct SettingsScreen: View { private var manageAccountSection: some View { Section { - if context.viewState.showLinkNewDeviceButton { - ListRow(label: .default(title: L10n.commonLinkNewDevice, - icon: \.devices), - kind: .navigationLink { - context.send(viewAction: .linkNewDevice) - }) - } - if let url = context.viewState.accountProfileURL { - ListRow(label: .default(title: L10n.actionManageAccount, + ListRow(label: .default(title: L10n.actionManageAccountAndDevices, icon: \.userProfile), kind: .button { context.send(viewAction: .manageAccount(url: url)) @@ -125,11 +117,11 @@ struct SettingsScreen: View { .accessibilityIdentifier(A11yIdentifiers.settingsScreen.account) } - if let url = context.viewState.accountSessionsListURL { - ListRow(label: .default(title: L10n.actionManageDevices, + if context.viewState.showLinkNewDeviceButton { + ListRow(label: .default(title: L10n.commonLinkNewDevice, icon: \.devices), - kind: .button { - context.send(viewAction: .manageAccount(url: url)) + kind: .navigationLink { + context.send(viewAction: .linkNewDevice) }) } @@ -246,8 +238,8 @@ struct SettingsScreen: View { } private var toolbar: some ToolbarContent { - ToolbarItem(placement: .confirmationAction) { - Button(L10n.actionDone) { context.send(viewAction: .close) } + ToolbarItem(placement: .primaryAction) { + ToolbarButton(role: .close) { context.send(viewAction: .close) } .accessibilityIdentifier(A11yIdentifiers.settingsScreen.done) } } @@ -270,13 +262,13 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview { ElementNavigationStack { SettingsScreen(context: viewModel.context) } - .snapshotPreferences(expect: viewModel.context.observe(\.viewState.accountSessionsListURL).map { $0 != nil }) + .snapshotPreferences(expect: viewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil }) .previewDisplayName("Default") ElementNavigationStack { SettingsScreen(context: bugReportDisabledViewModel.context) } - .snapshotPreferences(expect: bugReportDisabledViewModel.context.observe(\.viewState.accountSessionsListURL).map { $0 != nil }) + .snapshotPreferences(expect: bugReportDisabledViewModel.context.observe(\.viewState.accountProfileURL).map { $0 != nil }) .previewDisplayName("Bug report disabled") } diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-en-GB.png index 52ff344d2..cac4916fc 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7719cd35f913cae2f0a9ea32599144e3f7d403ecb04db3b29ffd15e0083b95db -size 146349 +oid sha256:d05ee428d23ebc290c425da19fecab22f9de29e8095d711909e218b3f2193507 +size 148739 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-pseudo.png index 89d24d3a2..32672b6c0 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPad-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cba12ceacc565dbd7859dcb9e41bc6dde09a39e38166c1002e527b76968da5a5 -size 159450 +oid sha256:c0e5b3c166b12a6f887b7baf34b479f782e7bc4ae605705d79de7dcfb196e863 +size 160919 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-en-GB.png index 3a3910d14..57e098a65 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af428096543259ba33aeaa6e2da59ffcc58c6a564dd54567e998563c9fa58940 -size 94197 +oid sha256:8646628f69fc9192afbebddca1e42fb104ad6685f851b90ca236a106108d75d7 +size 95818 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-pseudo.png index 3ff3c8a9a..a7344cdc0 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Bug-report-disabled-iPhone-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c4ad666f29a270f73834c24c77b00c01c77d287a789494247ee48a271639bff -size 109287 +oid sha256:edc191cb214597e1e6518e9e57d6fd07f5707df5d861a4afa036053ffbc65793 +size 112210 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-en-GB.png index 6dd260604..e5c38513d 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c855ae354074f93037f374b12bd1e9456209306a02918b3902a1d615c14f9f7f -size 151707 +oid sha256:6dab484bcf18b86d5edeb8a61adb6cd852265db884e0c34b5e22fe8ef2b01b50 +size 148715 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-pseudo.png index 81bae8735..b82ab29e8 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPad-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8518ac313a58c90eff09f2ac1071a887150359f2a67f1b372588f06cddd9363e -size 167451 +oid sha256:8e9e0347e5a926c0a879256eca108213287321707ac9baf2c1a8da7e259736f4 +size 160808 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-en-GB.png index ae2678ba2..ac725f8d3 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2fdfc12b9d00a66a0cc4e284f6f6362be373db52feca10bcd24e073395d695a1 -size 98954 +oid sha256:d1dd350c7a95526ba01997fc068fdb37805bd25e916baa4462d36adbb7019c8e +size 96134 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-pseudo.png index 10980ee4f..9dbcf3b8a 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/settingsScreen.Default-iPhone-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:acae5af1e0a715d8dbc65c91c3aa26245625d1db4483e2cc5fd69a152fa9be1d -size 112640 +oid sha256:97a8bffed5a269b4fa95d1dfadb98eedbcde9441ee3eaf2c9eda60c9af38d550 +size 115440