This commit is contained in:
fmodf 2024-10-07 17:09:55 +02:00
parent 2e9b4f5d19
commit 4f379adfb7
3 changed files with 13 additions and 30 deletions

View file

@ -69,6 +69,12 @@ final class Client: ObservableObject {
} }
} }
extension Client: Identifiable {
var id: String {
credentials.bareJid
}
}
extension Client { extension Client {
func addRoster(_ jid: String, name: String?, groups: [String]) async throws { func addRoster(_ jid: String, name: String?, groups: [String]) async throws {
_ = try await connection.module(.roster).addItem( _ = try await connection.module(.roster).addItem(

View file

@ -76,4 +76,5 @@
// MARK: Settings // MARK: Settings
"Settings.Main.title" = "Settings"; "Settings.Main.title" = "Settings";
"Settings.Section.Accounts.title" = "Accounts"; "Settings.Section.Accounts.title" = "Accounts";
"Settings.Section.Accounts.add" = "Add new account";

View file

@ -23,42 +23,18 @@ struct SettingsScreen: View {
ForEach(clientsStore.clients) { client in ForEach(clientsStore.clients) { client in
SharedListRow( SharedListRow(
iconType: .image(Image(systemName: "person.fill"), .Material.Elements.active), iconType: .charCircle(client.credentials.bareJid),
text: "name", text: client.credentials.bareJid,
controlType: .none controlType: .none
) )
.onTapGesture { .onTapGesture {
print("Tapped client: \(client.name)") print("Tapped account \(client.credentials.bareJid)")
} }
} }
SharedListRow( SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active), iconType: .image(Image(systemName: "plus"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup, text: L10n.Settings.Section.Accounts.add,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none
)
.onTapGesture {
print("Tapped createGroup")
}
SharedListRow(
iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active),
text: L10n.Chats.Create.Main.createGroup,
controlType: .none controlType: .none
) )
.onTapGesture { .onTapGesture {
@ -70,7 +46,7 @@ struct SettingsScreen: View {
SharedSectionTitle(text: "Dev tools") SharedSectionTitle(text: "Dev tools")
SharedListRow( SharedListRow(
iconType: .image(Image(systemName: "xmark.octagon"), .Material.Elements.active), iconType: .image(Image(systemName: "xmark.octagon"), .Rainbow.red500),
text: "Clean all data", text: "Clean all data",
controlType: .none controlType: .none
) )