This commit is contained in:
fmodf 2024-10-07 19:10:03 +02:00
parent 339aab2bb4
commit 0bd2b7d82d
2 changed files with 15 additions and 0 deletions

View file

@ -24,6 +24,15 @@ struct Credentials: DBStorable, Hashable {
try self.delete(db) try self.delete(db)
} }
} }
func setActive(flag: Bool) async throws {
let db = Database.shared.dbQueue
_ = try await db.write { db in
var updated = self
updated.isActive = flag
try updated.save(db)
}
}
} }
extension Credentials: UniversalInputSelectionElement { extension Credentials: UniversalInputSelectionElement {

View file

@ -27,6 +27,12 @@ struct SettingsScreen: View {
iconType: .charCircle(client.credentials.bareJid), iconType: .charCircle(client.credentials.bareJid),
text: client.credentials.bareJid, text: client.credentials.bareJid,
controlType: .none controlType: .none
// controlType: .switcher(isOn: Binding(
// get: { client.credentials.isActive },
// set: { new in
// client.setActive(new)
// }
// ))
) )
.onTapGesture { .onTapGesture {
print("Tapped account \(client.credentials.bareJid)") print("Tapped account \(client.credentials.bareJid)")