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