mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Updated settings screen (#2791)
This commit is contained in:
@@ -21,19 +21,23 @@ import SwiftUI
|
|||||||
struct SettingsScreen: View {
|
struct SettingsScreen: View {
|
||||||
@ObservedObject var context: SettingsScreenViewModel.Context
|
@ObservedObject var context: SettingsScreenViewModel.Context
|
||||||
|
|
||||||
|
private var shouldHideManageAccountSection: Bool {
|
||||||
|
context.viewState.accountProfileURL == nil &&
|
||||||
|
context.viewState.accountSessionsListURL == nil &&
|
||||||
|
!context.viewState.showBlockedUsers
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
userSection
|
userSection
|
||||||
|
|
||||||
accountSecuritySection
|
manageMyAppSection
|
||||||
|
|
||||||
mainSection
|
if !shouldHideManageAccountSection {
|
||||||
|
manageAccountSection
|
||||||
|
}
|
||||||
|
|
||||||
manageSessionsSection
|
generalSection
|
||||||
|
|
||||||
advancedOptionsSection
|
|
||||||
|
|
||||||
signOutSection
|
|
||||||
}
|
}
|
||||||
.compoundList()
|
.compoundList()
|
||||||
.navigationTitle(L10n.commonSettings)
|
.navigationTitle(L10n.commonSettings)
|
||||||
@@ -75,9 +79,22 @@ struct SettingsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
private var manageMyAppSection: some View {
|
||||||
private var accountSecuritySection: some View {
|
|
||||||
Section {
|
Section {
|
||||||
|
ListRow(label: .default(title: L10n.screenNotificationSettingsTitle,
|
||||||
|
icon: \.notifications),
|
||||||
|
kind: .navigationLink {
|
||||||
|
context.send(viewAction: .notifications)
|
||||||
|
})
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.notifications)
|
||||||
|
|
||||||
|
ListRow(label: .default(title: L10n.commonScreenLock,
|
||||||
|
icon: \.lock),
|
||||||
|
kind: .navigationLink {
|
||||||
|
context.send(viewAction: .appLock)
|
||||||
|
})
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.screenLock)
|
||||||
|
|
||||||
switch context.viewState.securitySectionMode {
|
switch context.viewState.securitySectionMode {
|
||||||
case .secureBackup:
|
case .secureBackup:
|
||||||
ListRow(label: .default(title: L10n.commonChatBackup,
|
ListRow(label: .default(title: L10n.commonChatBackup,
|
||||||
@@ -91,7 +108,7 @@ struct SettingsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mainSection: some View {
|
private var manageAccountSection: some View {
|
||||||
Section {
|
Section {
|
||||||
if let url = context.viewState.accountProfileURL {
|
if let url = context.viewState.accountProfileURL {
|
||||||
ListRow(label: .default(title: L10n.actionManageAccount,
|
ListRow(label: .default(title: L10n.actionManageAccount,
|
||||||
@@ -102,40 +119,13 @@ struct SettingsScreen: View {
|
|||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.account)
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.account)
|
||||||
}
|
}
|
||||||
|
|
||||||
ListRow(label: .default(title: L10n.screenNotificationSettingsTitle,
|
if let url = context.viewState.accountSessionsListURL {
|
||||||
icon: \.notifications),
|
ListRow(label: .default(title: L10n.actionManageDevices,
|
||||||
kind: .navigationLink {
|
icon: \.devices),
|
||||||
context.send(viewAction: .notifications)
|
kind: .button {
|
||||||
})
|
context.send(viewAction: .manageAccount(url: url))
|
||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.notifications)
|
})
|
||||||
|
}
|
||||||
ListRow(label: .default(title: L10n.commonAnalytics,
|
|
||||||
icon: \.chart),
|
|
||||||
kind: .navigationLink {
|
|
||||||
context.send(viewAction: .analytics)
|
|
||||||
})
|
|
||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.analytics)
|
|
||||||
|
|
||||||
ListRow(label: .default(title: L10n.commonScreenLock,
|
|
||||||
icon: \.lock),
|
|
||||||
kind: .navigationLink {
|
|
||||||
context.send(viewAction: .appLock)
|
|
||||||
})
|
|
||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.screenLock)
|
|
||||||
|
|
||||||
ListRow(label: .default(title: L10n.commonReportAProblem,
|
|
||||||
icon: \.chatProblem),
|
|
||||||
kind: .navigationLink {
|
|
||||||
context.send(viewAction: .reportBug)
|
|
||||||
})
|
|
||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.reportBug)
|
|
||||||
|
|
||||||
ListRow(label: .default(title: L10n.commonAbout,
|
|
||||||
icon: \.info),
|
|
||||||
kind: .navigationLink {
|
|
||||||
context.send(viewAction: .about)
|
|
||||||
})
|
|
||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.about)
|
|
||||||
|
|
||||||
if context.viewState.showBlockedUsers {
|
if context.viewState.showBlockedUsers {
|
||||||
ListRow(label: .default(title: L10n.commonBlockedUsers,
|
ListRow(label: .default(title: L10n.commonBlockedUsers,
|
||||||
@@ -148,21 +138,29 @@ struct SettingsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
private var generalSection: some View {
|
||||||
private var manageSessionsSection: some View {
|
|
||||||
if let url = context.viewState.accountSessionsListURL {
|
|
||||||
Section {
|
|
||||||
ListRow(label: .default(title: L10n.actionManageDevices,
|
|
||||||
icon: \.devices),
|
|
||||||
kind: .button {
|
|
||||||
context.send(viewAction: .manageAccount(url: url))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var advancedOptionsSection: some View {
|
|
||||||
Section {
|
Section {
|
||||||
|
ListRow(label: .default(title: L10n.commonAbout,
|
||||||
|
icon: \.info),
|
||||||
|
kind: .navigationLink {
|
||||||
|
context.send(viewAction: .about)
|
||||||
|
})
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.about)
|
||||||
|
|
||||||
|
ListRow(label: .default(title: L10n.commonReportAProblem,
|
||||||
|
icon: \.chatProblem),
|
||||||
|
kind: .navigationLink {
|
||||||
|
context.send(viewAction: .reportBug)
|
||||||
|
})
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.reportBug)
|
||||||
|
|
||||||
|
ListRow(label: .default(title: L10n.commonAnalytics,
|
||||||
|
icon: \.chart),
|
||||||
|
kind: .navigationLink {
|
||||||
|
context.send(viewAction: .analytics)
|
||||||
|
})
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.analytics)
|
||||||
|
|
||||||
ListRow(label: .default(title: L10n.commonAdvancedSettings,
|
ListRow(label: .default(title: L10n.commonAdvancedSettings,
|
||||||
icon: \.settings),
|
icon: \.settings),
|
||||||
kind: .navigationLink {
|
kind: .navigationLink {
|
||||||
@@ -178,11 +176,7 @@ struct SettingsScreen: View {
|
|||||||
})
|
})
|
||||||
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.developerOptions)
|
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.developerOptions)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var signOutSection: some View {
|
|
||||||
Section {
|
|
||||||
ListRow(label: .action(title: L10n.screenSignoutPreferenceItem,
|
ListRow(label: .action(title: L10n.screenSignoutPreferenceItem,
|
||||||
icon: \.signOut,
|
icon: \.signOut,
|
||||||
role: .destructive),
|
role: .destructive),
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:42c6c41d8e7cedc083dda31f83603bb3afdc827454f12dffff2262b6a66809fb
|
oid sha256:cc01bfa9374861acfbabf67447752b088fe54bd4fa6e6617594e7bd6dccad832
|
||||||
size 211546
|
size 218652
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:708a96b3352fc118715a9cd92369eaf5130aa2dbfdd41a5a122ef44d28becd93
|
oid sha256:efa7d95e396c1aa387858f43ecde481cb7154ea142cb4f608ddd82cc00ed0fbc
|
||||||
size 282736
|
size 295161
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:57d1dc985ee32ac33b689281ff6869c21e1cc97c4f3a1bb5c9c84dd3ea0f3010
|
oid sha256:1a398c20f4b5bfb5b1b83486106ba940552c87fc2a0cc378ca21faa0a699fdd7
|
||||||
size 143141
|
size 150271
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:b27765cd80dd36afd157d672c254f9d2481e70ccd1faca0409b6d4a9b5c91979
|
oid sha256:5d0449aabc314ab6d4e19268589cbaa2bfb0ac0c34cca6441ca8f2a6d06af0ae
|
||||||
size 188558
|
size 203384
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
The settings screen design has slightly changed order and grouping of the options.
|
||||||
Reference in New Issue
Block a user