mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
parent
c482bd0aaf
commit
54104b00ed
5 changed files with 77 additions and 4 deletions
|
|
@ -230,8 +230,18 @@ interface PacketDao {
|
|||
suspend fun setMuteUntil(contacts: List<String>, until: Long) {
|
||||
val contactList =
|
||||
contacts.map { contact ->
|
||||
getContactSettings(contact)?.copy(muteUntil = until)
|
||||
?: ContactSettings(contact_key = contact, muteUntil = until)
|
||||
// Always mute
|
||||
val absoluteMuteUntil =
|
||||
if (until == Long.MAX_VALUE) {
|
||||
Long.MAX_VALUE
|
||||
} else if (until == 0L) { // unmute
|
||||
0L
|
||||
} else {
|
||||
System.currentTimeMillis() + until
|
||||
}
|
||||
|
||||
getContactSettings(contact)?.copy(muteUntil = absoluteMuteUntil)
|
||||
?: ContactSettings(contact_key = contact, muteUntil = absoluteMuteUntil)
|
||||
}
|
||||
upsertContactSettings(contactList)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue