ios: move preferences, icon (#1376)

* ios: move preferences, icon

* don't disable database settings on chat stop

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
This commit is contained in:
Evgeny Poberezkin
2022-11-17 06:57:27 +00:00
committed by GitHub
parent 828b502431
commit 56f3874a93
3 changed files with 46 additions and 32 deletions

View File

@@ -109,7 +109,9 @@ struct ChatInfoView: View {
.navigationBarTitle("Contact preferences")
.navigationBarTitleDisplayMode(.large)
} label: {
Text("Contact preferences")
settingsRow("switch.2") {
Text("Contact preferences")
}
}
}

View File

@@ -52,7 +52,9 @@ struct GroupChatInfoView: View {
.navigationBarTitle("Group preferences")
.navigationBarTitleDisplayMode(.large)
} label: {
Text("Group preferences")
settingsRow("switch.2") {
Text("Group preferences")
}
}
} header: {
Text("Preferences")

View File

@@ -89,10 +89,8 @@ struct SettingsView: View {
ProfilePreview(profileOf: user)
.padding(.leading, -8)
}
.disabled(chatModel.chatRunning != true)
incognitoRow()
.disabled(chatModel.chatRunning != true)
NavigationLink {
CreateLinkView(selection: .longTerm, viaNavLink: true)
@@ -100,33 +98,17 @@ struct SettingsView: View {
} label: {
settingsRow("qrcode") { Text("Your SimpleX contact address") }
}
.disabled(chatModel.chatRunning != true)
NavigationLink {
DatabaseView(showSettings: $showSettings, chatItemTTL: chatModel.chatItemTTL)
.navigationTitle("Your chat database")
} label: {
let color: Color = chatModel.chatDbEncrypted == false ? .orange : .secondary
settingsRow("internaldrive", color: color) {
HStack {
Text("Database passphrase & export")
Spacer()
if chatModel.chatRunning == false {
Image(systemName: "exclamationmark.octagon.fill").foregroundColor(.red)
}
}
}
}
}
Section("Settings") {
NavigationLink {
PreferencesView(profile: user.profile, preferences: user.fullPreferences, currentPreferences: user.fullPreferences)
.navigationTitle("Your preferences")
} label: {
settingsRow("list.bullet") { Text("Chat preferences") }
settingsRow("switch.2") { Text("Chat preferences") }
}
}
.disabled(chatModel.chatRunning != true)
Section("Settings") {
NavigationLink {
NotificationsView()
.navigationTitle("Notifications")
@@ -136,18 +118,32 @@ struct SettingsView: View {
Text("Notifications")
}
}
.disabled(chatModel.chatRunning != true)
NavigationLink {
NetworkAndServers()
.navigationTitle("Network & servers")
} label: {
settingsRow("externaldrive.connected.to.line.below") { Text("Network & servers") }
}
.disabled(chatModel.chatRunning != true)
NavigationLink {
CallSettings()
.navigationTitle("Your calls")
} label: {
settingsRow("video") { Text("Audio & video calls") }
}
.disabled(chatModel.chatRunning != true)
NavigationLink {
PrivacySettings()
.navigationTitle("Your privacy")
} label: {
settingsRow("lock") { Text("Privacy & security") }
}
.disabled(chatModel.chatRunning != true)
if UIApplication.shared.supportsAlternateIcons {
NavigationLink {
AppearanceSettings()
@@ -155,15 +151,11 @@ struct SettingsView: View {
} label: {
settingsRow("sun.max") { Text("Appearance") }
}
.disabled(chatModel.chatRunning != true)
}
NavigationLink {
NetworkAndServers()
.navigationTitle("Network & servers")
} label: {
settingsRow("externaldrive.connected.to.line.below") { Text("Network & servers") }
}
chatDatabaseRow()
}
.disabled(chatModel.chatRunning != true)
Section("Help") {
NavigationLink {
@@ -283,6 +275,24 @@ struct SettingsView: View {
.padding(.leading, indent)
}
}
private func chatDatabaseRow() -> some View {
NavigationLink {
DatabaseView(showSettings: $showSettings, chatItemTTL: chatModel.chatItemTTL)
.navigationTitle("Your chat database")
} label: {
let color: Color = chatModel.chatDbEncrypted == false ? .orange : .secondary
settingsRow("internaldrive", color: color) {
HStack {
Text("Database passphrase & export")
Spacer()
if chatModel.chatRunning == false {
Image(systemName: "exclamationmark.octagon.fill").foregroundColor(.red)
}
}
}
}
}
private enum SettingsSheet: Identifiable {
case incognitoInfo