Fixed showing all drafts (#537)
This commit is contained in:
parent
bf85cd147d
commit
06436ccf58
|
@ -789,11 +789,14 @@ fun Context.getAllDrafts(): HashMap<Long, String?> {
|
||||||
val projection = arrayOf(Sms.BODY, Sms.THREAD_ID)
|
val projection = arrayOf(Sms.BODY, Sms.THREAD_ID)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
queryCursor(uri, projection) { cursor ->
|
val cursor = contentResolver.query(uri, projection, null, null, null)
|
||||||
cursor.use {
|
cursor?.use {
|
||||||
val threadId = cursor.getLongValue(Sms.THREAD_ID)
|
while (it.moveToNext()) {
|
||||||
val draft = cursor.getStringValue(Sms.BODY) ?: return@queryCursor
|
val threadId = it.getLongValue(Sms.THREAD_ID)
|
||||||
drafts[threadId] = draft
|
val draft = it.getStringValue(Sms.BODY)
|
||||||
|
if (draft != null) {
|
||||||
|
drafts[threadId] = draft
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
Loading…
Reference in New Issue