wip
This commit is contained in:
parent
6a608ead2c
commit
4f90a0d744
|
@ -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 {
|
||||
|
|
|
@ -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? {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue