mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
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 <douglase@element.io>
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7719cd35f913cae2f0a9ea32599144e3f7d403ecb04db3b29ffd15e0083b95db
|
||||
size 146349
|
||||
oid sha256:d05ee428d23ebc290c425da19fecab22f9de29e8095d711909e218b3f2193507
|
||||
size 148739
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cba12ceacc565dbd7859dcb9e41bc6dde09a39e38166c1002e527b76968da5a5
|
||||
size 159450
|
||||
oid sha256:c0e5b3c166b12a6f887b7baf34b479f782e7bc4ae605705d79de7dcfb196e863
|
||||
size 160919
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:af428096543259ba33aeaa6e2da59ffcc58c6a564dd54567e998563c9fa58940
|
||||
size 94197
|
||||
oid sha256:8646628f69fc9192afbebddca1e42fb104ad6685f851b90ca236a106108d75d7
|
||||
size 95818
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4c4ad666f29a270f73834c24c77b00c01c77d287a789494247ee48a271639bff
|
||||
size 109287
|
||||
oid sha256:edc191cb214597e1e6518e9e57d6fd07f5707df5d861a4afa036053ffbc65793
|
||||
size 112210
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c855ae354074f93037f374b12bd1e9456209306a02918b3902a1d615c14f9f7f
|
||||
size 151707
|
||||
oid sha256:6dab484bcf18b86d5edeb8a61adb6cd852265db884e0c34b5e22fe8ef2b01b50
|
||||
size 148715
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8518ac313a58c90eff09f2ac1071a887150359f2a67f1b372588f06cddd9363e
|
||||
size 167451
|
||||
oid sha256:8e9e0347e5a926c0a879256eca108213287321707ac9baf2c1a8da7e259736f4
|
||||
size 160808
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2fdfc12b9d00a66a0cc4e284f6f6362be373db52feca10bcd24e073395d695a1
|
||||
size 98954
|
||||
oid sha256:d1dd350c7a95526ba01997fc068fdb37805bd25e916baa4462d36adbb7019c8e
|
||||
size 96134
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:acae5af1e0a715d8dbc65c91c3aa26245625d1db4483e2cc5fd69a152fa9be1d
|
||||
size 112640
|
||||
oid sha256:97a8bffed5a269b4fa95d1dfadb98eedbcde9441ee3eaf2c9eda60c9af38d550
|
||||
size 115440
|
||||
|
||||
Reference in New Issue
Block a user