I've noticed a bug on the pop-up overlay when receiving a new text message.
If I have any older unread text messages, new SMS notification will show the content of the older one- not the new one that the notification is intended for.
Preliminary review of the code suggests this block is the culprit:
val text = try {
extras.getCharSequence(Notification.EXTRA_TEXT)?.toString()
?: extras.getString(Notification.EXTRA_TEXT) ?: ""
} catch (_: Exception) { "" }
Suggested fix:
val text = try {
val lines = extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES)
when {
!lines.isNullOrEmpty() -> lines.last().toString()
else -> extras.getCharSequence(Notification.EXTRA_TEXT)?.toString()
?: extras.getString(Notification.EXTRA_TEXT) ?: ""
}
} catch (_: Exception) { "" }
I've noticed a bug on the pop-up overlay when receiving a new text message.
If I have any older unread text messages, new SMS notification will show the content of the older one- not the new one that the notification is intended for.
Preliminary review of the code suggests this block is the culprit:
val text = try {
extras.getCharSequence(Notification.EXTRA_TEXT)?.toString()
?: extras.getString(Notification.EXTRA_TEXT) ?: ""
} catch (_: Exception) { "" }
Suggested fix:
val text = try {
val lines = extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES)
when {
!lines.isNullOrEmpty() -> lines.last().toString()
else -> extras.getCharSequence(Notification.EXTRA_TEXT)?.toString()
?: extras.getString(Notification.EXTRA_TEXT) ?: ""
}
} catch (_: Exception) { "" }