Add new VIEWED item in RecieptMessage enumeration.

Also includes necessary Database changes for supporting this as well as View-Once receipt support.
This commit is contained in:
Alex Hart
2020-11-20 09:16:37 -04:00
parent 7bb1262571
commit ce44e3949c
26 changed files with 432 additions and 33 deletions

View File

@@ -8,9 +8,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class Data {
@@ -138,6 +140,19 @@ public class Data {
return longArrays.get(key);
}
public List<Long> getLongArrayAsList(@NonNull String key) {
throwIfAbsent(longArrays, key);
long[] array = Objects.requireNonNull(longArrays.get(key));
List<Long> longs = new ArrayList<>(array.length);
for (long l : array) {
longs.add(l);
}
return longs;
}
public boolean hasFloat(@NonNull String key) {
return floats.containsKey(key);
@@ -295,6 +310,17 @@ public class Data {
return this;
}
public Builder putLongListAsArray(@NonNull String key, @NonNull List<Long> value) {
long[] longs = new long[value.size()];
for (int i = 0; i < value.size(); i++) {
longs[i] = value.get(i);
}
longArrays.put(key, longs);
return this;
}
public Builder putFloat(@NonNull String key, float value) {
floats.put(key, value);
return this;

View File

@@ -39,6 +39,7 @@ import org.thoughtcrime.securesms.jobs.RotateProfileKeyJob;
import org.thoughtcrime.securesms.jobs.RotateSignedPreKeyJob;
import org.thoughtcrime.securesms.jobs.SendDeliveryReceiptJob;
import org.thoughtcrime.securesms.jobs.SendReadReceiptJob;
import org.thoughtcrime.securesms.jobs.SendViewedReceiptJob;
import org.thoughtcrime.securesms.jobs.ServiceOutageDetectionJob;
import org.thoughtcrime.securesms.jobs.SmsReceiveJob;
import org.thoughtcrime.securesms.jobs.SmsSendJob;
@@ -90,6 +91,7 @@ public class WorkManagerFactoryMappings {
put("RotateSignedPreKeyJob", RotateSignedPreKeyJob.KEY);
put("SendDeliveryReceiptJob", SendDeliveryReceiptJob.KEY);
put("SendReadReceiptJob", SendReadReceiptJob.KEY);
put("SendViewedReceiptJob", SendViewedReceiptJob.KEY);
put("ServiceOutageDetectionJob", ServiceOutageDetectionJob.KEY);
put("SmsReceiveJob", SmsReceiveJob.KEY);
put("SmsSendJob", SmsSendJob.KEY);