This commit is contained in:
fmodf 2024-10-20 21:28:59 +02:00
parent 78de092b06
commit 9315a89f65

View file

@ -60,10 +60,6 @@ final class ClientsStore: ObservableObject {
ready = true
}
resubscribeRosters()
resubscribeChats()
reconnectNeeded()
if credentials.isEmpty {
listState = .empty
} else if credentials.allSatisfy({ !$0.isActive }) {
@ -72,6 +68,14 @@ final class ClientsStore: ObservableObject {
listState = .haveSomeEnabled
}
resubscribeRosters()
resubscribeChats()
reconnectNeeded()
for client in clients where client.credentials.isActive {
print(client.credentials.bareJid)
}
objectWillChange.send()
}
@ -198,7 +202,7 @@ extension ClientsStore {
private extension ClientsStore {
private func resubscribeRosters() {
let clientsJids = clients
.filter { $0.state != .disabled }
.filter { $0.credentials.isActive }
.map { $0.credentials.bareJid }
rostersCancellable = ValueObservation.tracking { db in
@ -223,7 +227,7 @@ private extension ClientsStore {
func resubscribeChats() {
let clientsJids = clients
.filter { $0.state != .disabled }
.filter { $0.credentials.isActive }
.map { $0.credentials.bareJid }
chatsCancellable = ValueObservation.tracking { db in