mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Mark sent gift viewed when opened.
This commit is contained in:
committed by
Cody Henthorne
parent
15af1d3bd1
commit
425a13e68c
@@ -9,7 +9,7 @@ interface OpenableGift {
|
||||
/**
|
||||
* Returns a projection to draw a top, or null to not do so.
|
||||
*/
|
||||
fun getOpenableGiftProjection(): Projection?
|
||||
fun getOpenableGiftProjection(isAnimating: Boolean): Projection?
|
||||
|
||||
/**
|
||||
* Returns a unique id assosicated with this gift.
|
||||
|
||||
@@ -70,12 +70,12 @@ class OpenableGiftItemDecoration(context: Context) : RecyclerView.ItemDecoration
|
||||
val notAnimated = openableChildren.filterNot { animationState.containsKey(it.getGiftId()) }
|
||||
|
||||
notAnimated.filterNot { messageIdsOpenedThisSession.contains(it.getGiftId()) }.forEach { child ->
|
||||
val projection = child.getOpenableGiftProjection()
|
||||
val projection = child.getOpenableGiftProjection(false)
|
||||
if (projection != null) {
|
||||
if (messageIdsShakenThisSession.contains(child.getGiftId())) {
|
||||
child.setOpenGiftCallback {
|
||||
child.clearOpenGiftCallback()
|
||||
val proj = it.getOpenableGiftProjection()
|
||||
val proj = it.getOpenableGiftProjection(true)
|
||||
if (proj != null) {
|
||||
messageIdsOpenedThisSession.add(it.getGiftId())
|
||||
startOpenAnimation(it)
|
||||
@@ -210,7 +210,7 @@ class OpenableGiftItemDecoration(context: Context) : RecyclerView.ItemDecoration
|
||||
}
|
||||
|
||||
fun update(animatorDurationScale: Float, canvas: Canvas, drawBox: (Canvas, Projection) -> Unit, drawBow: (Canvas, Projection) -> Unit): Boolean {
|
||||
val projection = openableGift.getOpenableGiftProjection() ?: return false
|
||||
val projection = openableGift.getOpenableGiftProjection(true) ?: return false
|
||||
|
||||
if (animatorDurationScale <= 0f) {
|
||||
update(canvas, projection, 0f, 0f, drawBox, drawBow)
|
||||
|
||||
Reference in New Issue
Block a user