This commit is contained in:
fmodf 2024-10-21 17:26:36 +02:00
parent 6a608ead2c
commit 4f90a0d744
3 changed files with 4 additions and 18 deletions

View file

@ -78,6 +78,9 @@ extension Client: Identifiable {
extension Client {
func updActivity(_ isActive: Bool) async {
credentials.isActive = isActive
Task {
try? await credentials.setActive(flag: isActive)
}
}
func addRoster(_ jid: String, name: String?, groups: [String]) async throws {

View file

@ -48,14 +48,6 @@ final class ClientsStore: ObservableObject {
updatedClients.append(contentsOf: newClients)
clients = updatedClients
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
}
@ -71,12 +63,6 @@ final class ClientsStore: ObservableObject {
resubscribeRosters()
resubscribeChats()
reconnectNeeded()
for client in clients where client.credentials.isActive {
print(client.credentials.bareJid)
}
objectWillChange.send()
}
private func client(for credentials: Credentials) -> Client? {

View file

@ -59,14 +59,11 @@ struct SettingsScreen: View {
get: { client.credentials.isActive },
set: { new in
Task {
try? await client.credentials.setActive(flag: new)
await client.updActivity(new)
}
}
))
)
.onTapGesture {
print("Tapped account \(client.credentials.bareJid)")
}
}
if parent == .main {