This commit is contained in:
fmodf 2024-10-16 16:42:08 +02:00
parent c153985bf0
commit 473cf3b30b
3 changed files with 11 additions and 10 deletions

View file

@ -76,6 +76,10 @@ extension Client: Identifiable {
} }
extension Client { extension Client {
func updActivity(_ isActive: Bool) async {
credentials.isActive = isActive
}
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(
jid: JID(jid), jid: JID(jid),

View file

@ -48,11 +48,13 @@ final class ClientsStore: ObservableObject {
updatedClients.append(contentsOf: newClients) updatedClients.append(contentsOf: newClients)
clients = updatedClients clients = updatedClients
// for creds in credentials { Task {
// if let client = client(for: creds) { for client in clients {
// client.credentials = creds if let creds = credentials.first(where: { $0.bareJid == client.credentials.bareJid }) {
// } await client.updActivity(creds.isActive)
// } }
}
}
if !ready { if !ready {
ready = true ready = true

View file

@ -85,11 +85,6 @@ struct SettingsScreen: View {
Spacer() Spacer()
} }
} }
// .onDisappear {
// if settingsStore.credentials.isEmpty || settingsStore.credentials.allSatisfy({ !$0.isActive }) {
// router.dismissScreenStack()
// }
// }
} }
@ViewBuilder private var addAccountSelector: some View { @ViewBuilder private var addAccountSelector: some View {