From 4f379adfb7fbf49a7d9cd79521ae6a1c10448be3 Mon Sep 17 00:00:00 2001 From: fmodf Date: Mon, 7 Oct 2024 17:09:55 +0200 Subject: [PATCH] wip --- .../AppData/Client/Client.swift | 6 ++++ .../Resources/Strings/Localizable.strings | 1 + .../View/Main/Settings/SettingsScreen.swift | 36 ++++--------------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/ConversationsClassic/AppData/Client/Client.swift b/ConversationsClassic/AppData/Client/Client.swift index 45b4a15..13398c5 100644 --- a/ConversationsClassic/AppData/Client/Client.swift +++ b/ConversationsClassic/AppData/Client/Client.swift @@ -69,6 +69,12 @@ final class Client: ObservableObject { } } +extension Client: Identifiable { + var id: String { + credentials.bareJid + } +} + extension Client { func addRoster(_ jid: String, name: String?, groups: [String]) async throws { _ = try await connection.module(.roster).addItem( diff --git a/ConversationsClassic/Resources/Strings/Localizable.strings b/ConversationsClassic/Resources/Strings/Localizable.strings index c50bbb3..7eb5d85 100644 --- a/ConversationsClassic/Resources/Strings/Localizable.strings +++ b/ConversationsClassic/Resources/Strings/Localizable.strings @@ -76,4 +76,5 @@ // MARK: Settings "Settings.Main.title" = "Settings"; "Settings.Section.Accounts.title" = "Accounts"; +"Settings.Section.Accounts.add" = "Add new account"; diff --git a/ConversationsClassic/View/Main/Settings/SettingsScreen.swift b/ConversationsClassic/View/Main/Settings/SettingsScreen.swift index 3e3764c..27b0512 100644 --- a/ConversationsClassic/View/Main/Settings/SettingsScreen.swift +++ b/ConversationsClassic/View/Main/Settings/SettingsScreen.swift @@ -23,42 +23,18 @@ struct SettingsScreen: View { ForEach(clientsStore.clients) { client in SharedListRow( - iconType: .image(Image(systemName: "person.fill"), .Material.Elements.active), - text: "name", + iconType: .charCircle(client.credentials.bareJid), + text: client.credentials.bareJid, controlType: .none ) .onTapGesture { - print("Tapped client: \(client.name)") + print("Tapped account \(client.credentials.bareJid)") } } 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 - ) - .onTapGesture { - print("Tapped createGroup") - } - SharedListRow( - iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active), - text: L10n.Chats.Create.Main.createGroup, + iconType: .image(Image(systemName: "plus"), .Material.Elements.active), + text: L10n.Settings.Section.Accounts.add, controlType: .none ) .onTapGesture { @@ -70,7 +46,7 @@ struct SettingsScreen: View { SharedSectionTitle(text: "Dev tools") SharedListRow( - iconType: .image(Image(systemName: "xmark.octagon"), .Material.Elements.active), + iconType: .image(Image(systemName: "xmark.octagon"), .Rainbow.red500), text: "Clean all data", controlType: .none )