Implement UI and backend for sending story reactions.

Co-authored-by: Rashad Sookram <rashad@signal.org>
This commit is contained in:
Alex Hart
2022-03-16 13:44:54 -03:00
committed by Cody Henthorne
parent 7f4a12c179
commit 437c1e2f21
41 changed files with 689 additions and 343 deletions

View File

@@ -22,6 +22,7 @@ class IncomingMediaMessage(
val isPushMessage: Boolean = false,
val storyType: StoryType = StoryType.NONE,
val parentStoryId: ParentStoryId? = null,
val isStoryReaction: Boolean = false,
val sentTimeMillis: Long,
val serverTimeMillis: Long,
val receivedTimeMillis: Long,
@@ -86,6 +87,7 @@ class IncomingMediaMessage(
receivedTimeMillis: Long,
storyType: StoryType,
parentStoryId: ParentStoryId?,
isStoryReaction: Boolean,
subscriptionId: Int,
expiresIn: Long,
expirationUpdate: Boolean,
@@ -107,6 +109,7 @@ class IncomingMediaMessage(
isPushMessage = true,
storyType = storyType,
parentStoryId = parentStoryId,
isStoryReaction = isStoryReaction,
sentTimeMillis = sentTimeMillis,
serverTimeMillis = serverTimeMillis,
receivedTimeMillis = receivedTimeMillis,

View File

@@ -19,6 +19,7 @@ public class OutgoingExpirationUpdateMessage extends OutgoingSecureMediaMessage
false,
StoryType.NONE,
null,
false,
null,
Collections.emptyList(),
Collections.emptyList(),

View File

@@ -41,6 +41,7 @@ public final class OutgoingGroupUpdateMessage extends OutgoingSecureMediaMessage
viewOnce,
StoryType.NONE,
null,
false,
quote,
contacts,
previews,

View File

@@ -33,6 +33,7 @@ public class OutgoingMediaMessage {
private final QuoteModel outgoingQuote;
private final StoryType storyType;
private final ParentStoryId parentStoryId;
private final boolean isStoryReaction;
private final Set<NetworkFailure> networkFailures = new HashSet<>();
private final Set<IdentityKeyMismatch> identityKeyMismatches = new HashSet<>();
@@ -50,6 +51,7 @@ public class OutgoingMediaMessage {
int distributionType,
@NonNull StoryType storyType,
@Nullable ParentStoryId parentStoryId,
boolean isStoryReaction,
@Nullable QuoteModel outgoingQuote,
@NonNull List<Contact> contacts,
@NonNull List<LinkPreview> linkPreviews,
@@ -68,6 +70,7 @@ public class OutgoingMediaMessage {
this.outgoingQuote = outgoingQuote;
this.storyType = storyType;
this.parentStoryId = parentStoryId;
this.isStoryReaction = isStoryReaction;
this.contacts.addAll(contacts);
this.linkPreviews.addAll(linkPreviews);
@@ -86,6 +89,7 @@ public class OutgoingMediaMessage {
int distributionType,
@NonNull StoryType storyType,
@Nullable ParentStoryId parentStoryId,
boolean isStoryReaction,
@Nullable QuoteModel outgoingQuote,
@NonNull List<Contact> contacts,
@NonNull List<LinkPreview> linkPreviews,
@@ -101,6 +105,7 @@ public class OutgoingMediaMessage {
distributionType,
storyType,
parentStoryId,
isStoryReaction,
outgoingQuote,
contacts,
linkPreviews,
@@ -121,6 +126,7 @@ public class OutgoingMediaMessage {
this.outgoingQuote = that.outgoingQuote;
this.storyType = that.storyType;
this.parentStoryId = that.parentStoryId;
this.isStoryReaction = that.isStoryReaction;
this.identityKeyMismatches.addAll(that.identityKeyMismatches);
this.networkFailures.addAll(that.networkFailures);
@@ -141,6 +147,7 @@ public class OutgoingMediaMessage {
distributionType,
storyType,
parentStoryId,
isStoryReaction,
outgoingQuote,
contacts,
linkPreviews,
@@ -202,6 +209,10 @@ public class OutgoingMediaMessage {
return parentStoryId;
}
public boolean isStoryReaction() {
return isStoryReaction;
}
public @Nullable QuoteModel getOutgoingQuote() {
return outgoingQuote;
}

View File

@@ -25,12 +25,13 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
boolean viewOnce,
@NonNull StoryType storyType,
@Nullable ParentStoryId parentStoryId,
boolean isStoryReaction,
@Nullable QuoteModel quote,
@NonNull List<Contact> contacts,
@NonNull List<LinkPreview> previews,
@NonNull List<Mention> mentions)
{
super(recipient, body, attachments, sentTimeMillis, -1, expiresIn, viewOnce, distributionType, storyType, parentStoryId, quote, contacts, previews, mentions, Collections.emptySet(), Collections.emptySet());
super(recipient, body, attachments, sentTimeMillis, -1, expiresIn, viewOnce, distributionType, storyType, parentStoryId, isStoryReaction, quote, contacts, previews, mentions, Collections.emptySet(), Collections.emptySet());
}
public OutgoingSecureMediaMessage(OutgoingMediaMessage base) {
@@ -53,6 +54,7 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
isViewOnce(),
getStoryType(),
getParentStoryId(),
isStoryReaction(),
getOutgoingQuote(),
getSharedContacts(),
getLinkPreviews(),
@@ -69,6 +71,7 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
isViewOnce(),
getStoryType(),
getParentStoryId(),
isStoryReaction(),
getOutgoingQuote(),
getSharedContacts(),
getLinkPreviews(),