another.im-ios/ConversationsClassic/View/Main/Settings/SettingsScreen.swift

67 lines
2.2 KiB
Swift
Raw Normal View History

2024-06-19 15:15:27 +00:00
import SwiftUI
struct SettingsScreen: View {
2024-10-04 15:58:04 +00:00
@EnvironmentObject var clientsStore: ClientsStore
2024-06-19 15:15:27 +00:00
var body: some View {
ZStack {
2024-10-07 12:54:07 +00:00
// Background color
2024-07-04 08:21:12 +00:00
Color.Material.Background.light
2024-06-19 15:15:27 +00:00
.ignoresSafeArea()
2024-10-07 12:54:07 +00:00
// Content
VStack(spacing: 0) {
// Header
SharedNavigationBar(
centerText: .init(text: L10n.Settings.Main.title)
)
// List
List {
// Accounts section
SharedSectionTitle(text: L10n.Settings.Section.Accounts.title)
ForEach(clientsStore.clients) { client in
SharedListRow(
2024-10-07 15:09:55 +00:00
iconType: .charCircle(client.credentials.bareJid),
text: client.credentials.bareJid,
2024-10-07 12:54:07 +00:00
controlType: .none
)
.onTapGesture {
2024-10-07 15:09:55 +00:00
print("Tapped account \(client.credentials.bareJid)")
2024-10-07 12:54:07 +00:00
}
}
SharedListRow(
2024-10-07 15:09:55 +00:00
iconType: .image(Image(systemName: "plus"), .Material.Elements.active),
text: L10n.Settings.Section.Accounts.add,
2024-10-07 12:54:07 +00:00
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
// Dev section
#if DEBUG
SharedSectionTitle(text: "Dev tools")
SharedListRow(
2024-10-07 15:09:55 +00:00
iconType: .image(Image(systemName: "xmark.octagon"), .Rainbow.red500),
2024-10-07 12:54:07 +00:00
text: "Clean all data",
controlType: .none
)
.onTapGesture {
clientsStore.flushAllData()
Database.shared.flushAllData()
}
#endif
2024-10-04 15:58:04 +00:00
}
2024-10-07 12:54:07 +00:00
.listStyle(.plain)
.environment(\.defaultMinListRowHeight, 10)
Spacer()
}
2024-06-19 15:15:27 +00:00
}
}
}