Handle keepMutedChatsArchived more generically, also apply it to sends.

Fixes #12788
This commit is contained in:
Greyson Parrelli
2023-02-22 12:24:16 -05:00
parent 3f93d4b9fc
commit 17aa0365d6
6 changed files with 50 additions and 25 deletions

View File

@@ -113,6 +113,16 @@ fun Cursor.readToSingleInt(defaultValue: Int = 0): Int {
}
}
fun Cursor.readToSingleBoolean(defaultValue: Boolean = false): Boolean {
return use {
if (it.moveToFirst()) {
it.getInt(0) != 0
} else {
defaultValue
}
}
}
@JvmOverloads
inline fun <T> Cursor.readToList(predicate: (T) -> Boolean = { true }, mapper: (Cursor) -> T): List<T> {
val list = mutableListOf<T>()