Merge pull request #538 from Aga-C/show_all_drafts

Fixed showing all drafts (#537)
This commit is contained in:
Tibor Kaputa 2023-01-01 21:08:25 +01:00 committed by GitHub
commit db37ac1b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) {