diff --git a/ConversationsClassic/AppData/Store/ClientsStore.swift b/ConversationsClassic/AppData/Store/ClientsStore.swift index dd87076..7fb1f80 100644 --- a/ConversationsClassic/AppData/Store/ClientsStore.swift +++ b/ConversationsClassic/AppData/Store/ClientsStore.swift @@ -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