Implement support for 'allows replies' toggle.

This commit is contained in:
Alex Hart
2022-03-01 12:41:45 -04:00
parent ee176cbe3d
commit 35cd36e9fe
40 changed files with 374 additions and 148 deletions

View File

@@ -5,6 +5,7 @@ import org.thoughtcrime.securesms.attachments.PointerAttachment
import org.thoughtcrime.securesms.contactshare.Contact
import org.thoughtcrime.securesms.database.model.Mention
import org.thoughtcrime.securesms.database.model.ParentStoryId
import org.thoughtcrime.securesms.database.model.StoryType
import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList
import org.thoughtcrime.securesms.groups.GroupId
import org.thoughtcrime.securesms.linkpreview.LinkPreview
@@ -19,7 +20,7 @@ class IncomingMediaMessage(
val groupId: GroupId? = null,
val body: String? = null,
val isPushMessage: Boolean = false,
val isStory: Boolean = false,
val storyType: StoryType = StoryType.NONE,
val parentStoryId: ParentStoryId? = null,
val sentTimeMillis: Long,
val serverTimeMillis: Long,
@@ -83,7 +84,7 @@ class IncomingMediaMessage(
sentTimeMillis: Long,
serverTimeMillis: Long,
receivedTimeMillis: Long,
isStory: Boolean,
storyType: StoryType,
parentStoryId: ParentStoryId?,
subscriptionId: Int,
expiresIn: Long,
@@ -104,7 +105,7 @@ class IncomingMediaMessage(
groupId = if (group.isPresent) GroupUtil.idFromGroupContextOrThrow(group.get()) else null,
body = body.orNull(),
isPushMessage = true,
isStory = isStory,
storyType = storyType,
parentStoryId = parentStoryId,
sentTimeMillis = sentTimeMillis,
serverTimeMillis = serverTimeMillis,

View File

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.mms;
import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.database.model.StoryType;
import org.thoughtcrime.securesms.recipients.Recipient;
import java.util.Collections;
@@ -12,12 +13,12 @@ public class OutgoingExpirationUpdateMessage extends OutgoingSecureMediaMessage
public OutgoingExpirationUpdateMessage(Recipient recipient, long sentTimeMillis, long expiresIn) {
super(recipient,
"",
new LinkedList<Attachment>(),
new LinkedList<>(),
sentTimeMillis,
ThreadDatabase.DistributionTypes.CONVERSATION,
expiresIn,
false,
false,
StoryType.NONE,
null,
null,
Collections.emptyList(),

View File

@@ -7,6 +7,7 @@ import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.contactshare.Contact;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.database.model.Mention;
import org.thoughtcrime.securesms.database.model.StoryType;
import org.thoughtcrime.securesms.database.model.databaseprotos.DecryptedGroupV2Context;
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -38,7 +39,7 @@ public final class OutgoingGroupUpdateMessage extends OutgoingSecureMediaMessage
ThreadDatabase.DistributionTypes.CONVERSATION,
expiresIn,
viewOnce,
false,
StoryType.NONE,
null,
quote,
contacts,

View File

@@ -11,6 +11,7 @@ import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
import org.thoughtcrime.securesms.database.documents.NetworkFailure;
import org.thoughtcrime.securesms.database.model.Mention;
import org.thoughtcrime.securesms.database.model.ParentStoryId;
import org.thoughtcrime.securesms.database.model.StoryType;
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -30,7 +31,7 @@ public class OutgoingMediaMessage {
private final long expiresIn;
private final boolean viewOnce;
private final QuoteModel outgoingQuote;
private final boolean isStory;
private final StoryType storyType;
private final ParentStoryId parentStoryId;
private final Set<NetworkFailure> networkFailures = new HashSet<>();
@@ -47,7 +48,7 @@ public class OutgoingMediaMessage {
long expiresIn,
boolean viewOnce,
int distributionType,
boolean isStory,
@NonNull StoryType storyType,
@Nullable ParentStoryId parentStoryId,
@Nullable QuoteModel outgoingQuote,
@NonNull List<Contact> contacts,
@@ -65,7 +66,7 @@ public class OutgoingMediaMessage {
this.expiresIn = expiresIn;
this.viewOnce = viewOnce;
this.outgoingQuote = outgoingQuote;
this.isStory = isStory;
this.storyType = storyType;
this.parentStoryId = parentStoryId;
this.contacts.addAll(contacts);
@@ -83,7 +84,7 @@ public class OutgoingMediaMessage {
long expiresIn,
boolean viewOnce,
int distributionType,
boolean isStory,
@NonNull StoryType storyType,
@Nullable ParentStoryId parentStoryId,
@Nullable QuoteModel outgoingQuote,
@NonNull List<Contact> contacts,
@@ -98,7 +99,7 @@ public class OutgoingMediaMessage {
expiresIn,
viewOnce,
distributionType,
isStory,
storyType,
parentStoryId,
outgoingQuote,
contacts,
@@ -118,7 +119,7 @@ public class OutgoingMediaMessage {
this.expiresIn = that.expiresIn;
this.viewOnce = that.viewOnce;
this.outgoingQuote = that.outgoingQuote;
this.isStory = that.isStory;
this.storyType = that.storyType;
this.parentStoryId = that.parentStoryId;
this.identityKeyMismatches.addAll(that.identityKeyMismatches);
@@ -138,7 +139,7 @@ public class OutgoingMediaMessage {
expiresIn,
viewOnce,
distributionType,
isStory,
storyType,
parentStoryId,
outgoingQuote,
contacts,
@@ -193,8 +194,8 @@ public class OutgoingMediaMessage {
return viewOnce;
}
public boolean isStory() {
return isStory;
public @NonNull StoryType getStoryType() {
return storyType;
}
public @Nullable ParentStoryId getParentStoryId() {

View File

@@ -7,6 +7,7 @@ import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.contactshare.Contact;
import org.thoughtcrime.securesms.database.model.Mention;
import org.thoughtcrime.securesms.database.model.ParentStoryId;
import org.thoughtcrime.securesms.database.model.StoryType;
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -22,14 +23,14 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
int distributionType,
long expiresIn,
boolean viewOnce,
boolean isStory,
@NonNull StoryType storyType,
@Nullable ParentStoryId parentStoryId,
@Nullable QuoteModel quote,
@NonNull List<Contact> contacts,
@NonNull List<LinkPreview> previews,
@NonNull List<Mention> mentions)
{
super(recipient, body, attachments, sentTimeMillis, -1, expiresIn, viewOnce, distributionType, isStory, parentStoryId, quote, contacts, previews, mentions, Collections.emptySet(), Collections.emptySet());
super(recipient, body, attachments, sentTimeMillis, -1, expiresIn, viewOnce, distributionType, storyType, parentStoryId, quote, contacts, previews, mentions, Collections.emptySet(), Collections.emptySet());
}
public OutgoingSecureMediaMessage(OutgoingMediaMessage base) {
@@ -50,7 +51,7 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
getDistributionType(),
expiresIn,
isViewOnce(),
isStory(),
getStoryType(),
getParentStoryId(),
getOutgoingQuote(),
getSharedContacts(),