another.im-ios/ConversationsClassic/View/Main/Settings/SettingsScreen.swift
2024-10-07 17:09:55 +02:00

67 lines
2.2 KiB
Swift

import SwiftUI
struct SettingsScreen: View {
@EnvironmentObject var clientsStore: ClientsStore
var body: some View {
ZStack {
// Background color
Color.Material.Background.light
.ignoresSafeArea()
// 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(
iconType: .charCircle(client.credentials.bareJid),
text: client.credentials.bareJid,
controlType: .none
)
.onTapGesture {
print("Tapped account \(client.credentials.bareJid)")
}
}
SharedListRow(
iconType: .image(Image(systemName: "plus"), .Material.Elements.active),
text: L10n.Settings.Section.Accounts.add,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
// Dev section
#if DEBUG
SharedSectionTitle(text: "Dev tools")
SharedListRow(
iconType: .image(Image(systemName: "xmark.octagon"), .Rainbow.red500),
text: "Clean all data",
controlType: .none
)
.onTapGesture {
clientsStore.flushAllData()
Database.shared.flushAllData()
}
#endif
}
.listStyle(.plain)
.environment(\.defaultMinListRowHeight, 10)
Spacer()
}
}
}
}