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 {
func updActivity(_ isActive: Bool) async {
credentials.isActive = isActive
}
func addRoster(_ jid: String, name: String?, groups: [String]) async throws {
_ = try await connection.module(.roster).addItem(
jid: JID(jid),

View file

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

View file

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