Add read and viewed receipts to the MSL.

This commit is contained in:
Greyson Parrelli
2021-06-30 17:26:40 -04:00
committed by Alex Hart
parent 3d0e15e2b8
commit 0921ebe5f1
13 changed files with 190 additions and 97 deletions

View File

@@ -23,7 +23,7 @@ public class SendReadReceiptsJobMigrationTest {
@Test
public void givenSendReadReceiptJobDataWithoutThreadIdAndThreadIdFound_whenIMigrate_thenIInsertThreadId() {
// GIVEN
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>());
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(),
"asdf",
new Data.Builder()
@@ -45,7 +45,7 @@ public class SendReadReceiptsJobMigrationTest {
@Test
public void givenSendReadReceiptJobDataWithoutThreadIdAndThreadIdNotFound_whenIMigrate_thenIGetAFailingJob() {
// GIVEN
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>());
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(),
"asdf",
new Data.Builder()
@@ -64,7 +64,7 @@ public class SendReadReceiptsJobMigrationTest {
@Test
public void givenSendReadReceiptJobDataWithThreadId_whenIMigrate_thenIDoNotReplace() {
// GIVEN
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>());
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(), "asdf", job.serialize());
// WHEN

View File

@@ -13,6 +13,7 @@ import org.mockito.stubbing.Answer;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.thoughtcrime.securesms.database.MessageDatabase;
import org.thoughtcrime.securesms.database.model.MessageId;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobmanager.Data;
import org.thoughtcrime.securesms.jobmanager.Job;
@@ -94,7 +95,8 @@ public class MarkReadReceiverTest {
private MessageDatabase.MarkedMessageInfo createMarkedMessageInfo(long threadId, @NonNull RecipientId recipientId) {
return new MessageDatabase.MarkedMessageInfo(threadId,
new MessageDatabase.SyncMessageId(recipientId, 0),
new MessageDatabase.ExpirationInfo(0, 0, 0, false));
new MessageDatabase.SyncMessageId(recipientId, 0),
new MessageId(1, true),
new MessageDatabase.ExpirationInfo(0, 0, 0, false));
}
}