Avoid rebinding conversation items when pulsing them.

This commit is contained in:
Greyson Parrelli
2026-09-23 16:12:24 -04:00
committed by Michelle Tang
parent b8d43fa504
commit fbf57fd522
3 changed files with 16 additions and 1 deletions
@@ -17,6 +17,13 @@ interface ConversationAdapterBridge {
const val PAYLOAD_NAME_COLORS = 1
const val PAYLOAD_SELECTED = 2
const val PAYLOAD_PARENT_SCROLLING = 3
/**
* The pulse highlight is rendered entirely by the item decoration, so items that receive this
* payload deliberately do nothing. It exists so that requesting a pulse does not force a full
* rebind of an item that is already on screen.
*/
const val PAYLOAD_PULSE = 4
}
fun hasNoConversationMessages(): Boolean
@@ -272,7 +272,7 @@ class ConversationAdapterV2(
if (recordToPulse != null) {
pulseRequest = ConversationAdapterBridge.PulseRequest(position, recordToPulse!!.messageRecord.isOutgoing)
}
notifyItemChanged(position)
notifyItemChanged(position, ConversationAdapterBridge.PAYLOAD_PULSE)
}
}
@@ -519,6 +519,10 @@ class ConversationAdapterV2(
payloadApplied = true
}
if (payload.contains(ConversationAdapterBridge.PAYLOAD_PULSE)) {
payloadApplied = true
}
return payloadApplied
}
@@ -252,6 +252,10 @@ open class V2ConversationItemTextOnlyViewHolder<Model : MappingModel<Model>>(
hasProcessedSupportedPayload = true
}
if (ConversationAdapterBridge.PAYLOAD_PULSE in payload) {
hasProcessedSupportedPayload = true
}
if (hasProcessedSupportedPayload && V2Payload.WALLPAPER !in payload) {
return
}