Fixed showing all drafts (#537)

This commit is contained in:
Agnieszka C 2022-12-30 11:55:05 +01:00
parent bf85cd147d
commit 06436ccf58
1 changed files with 8 additions and 5 deletions

View File

@ -789,11 +789,14 @@ fun Context.getAllDrafts(): HashMap<Long, String?> {
val projection = arrayOf(Sms.BODY, Sms.THREAD_ID)
try {
queryCursor(uri, projection) { cursor ->
cursor.use {
val threadId = cursor.getLongValue(Sms.THREAD_ID)
val draft = cursor.getStringValue(Sms.BODY) ?: return@queryCursor
drafts[threadId] = draft
val cursor = contentResolver.query(uri, projection, null, null, null)
cursor?.use {
while (it.moveToNext()) {
val threadId = it.getLongValue(Sms.THREAD_ID)
val draft = it.getStringValue(Sms.BODY)
if (draft != null) {
drafts[threadId] = draft
}
}
}
} catch (e: Exception) {