Fix issue with date header ID generation.

We render based on the date received, but were generating the ID with
the date sent. This caused the potential for a weird caching bug that
could cause us to render the wrong date.
This commit is contained in:
Greyson Parrelli 2021-08-18 10:00:53 -04:00
parent 199fb517b1
commit b58cede072

View file

@ -16,7 +16,6 @@
*/ */
package org.thoughtcrime.securesms.conversation; package org.thoughtcrime.securesms.conversation;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -69,7 +68,6 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -347,8 +345,8 @@ public class ConversationAdapter
if (conversationMessage == null) return -1; if (conversationMessage == null) return -1;
calendar.setTime(new Date(conversationMessage.getMessageRecord().getDateSent())); calendar.setTimeInMillis(conversationMessage.getMessageRecord().getDateReceived());
return Util.hashCode(calendar.get(Calendar.YEAR), calendar.get(Calendar.DAY_OF_YEAR)); return calendar.get(Calendar.YEAR) * 1000L + calendar.get(Calendar.DAY_OF_YEAR);
} }
@Override @Override