wip
This commit is contained in:
parent
339aab2bb4
commit
0bd2b7d82d
|
@ -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 {
|
||||||
|
|
|
@ -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)")
|
||||||
|
|
Loading…
Reference in a new issue