kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix story reply crash and tweak UI.
rodzic
c271b9c2de
commit
dc6fd8be7f
|
@ -1567,9 +1567,9 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
RecipientId author = mmsMessageRecord.getQuote().getAuthor();
|
RecipientId author = mmsMessageRecord.getQuote().getAuthor();
|
||||||
|
|
||||||
if (author.equals(Recipient.self().getId())) {
|
if (author.equals(Recipient.self().getId())) {
|
||||||
return context.getString(R.string.ConversationItem__s_dot_story, context.getString(R.string.QuoteView_you));
|
return context.getString(R.string.ConversationItem__reacted_to_your_story);
|
||||||
} else {
|
} else {
|
||||||
return context.getString(R.string.ConversationItem__s_dot_story, Recipient.resolved(author).getDisplayName(context));
|
return context.getString(R.string.ConversationItem__you_reacted_to_s_story, Recipient.resolved(author).getShortDisplayName(context));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return context.getString(R.string.ConversationItem__reacted_to_a_story);
|
return context.getString(R.string.ConversationItem__reacted_to_a_story);
|
||||||
|
|
|
@ -225,9 +225,10 @@ public class PushMediaSendJob extends PushSendJob {
|
||||||
|
|
||||||
if (message.getParentStoryId() != null) {
|
if (message.getParentStoryId() != null) {
|
||||||
try {
|
try {
|
||||||
MessageRecord storyRecord = SignalDatabase.mms().getMessageRecord(message.getParentStoryId().asMessageId().getId());
|
MessageRecord storyRecord = SignalDatabase.mms().getMessageRecord(message.getParentStoryId().asMessageId().getId());
|
||||||
|
Recipient storyRecipient = storyRecord.isOutgoing() ? Recipient.self() : storyRecord.getRecipient();
|
||||||
|
|
||||||
SignalServiceDataMessage.StoryContext storyContext = new SignalServiceDataMessage.StoryContext(address.getServiceId(), storyRecord.getDateSent());
|
SignalServiceDataMessage.StoryContext storyContext = new SignalServiceDataMessage.StoryContext(storyRecipient.requireServiceId(), storyRecord.getDateSent());
|
||||||
mediaMessageBuilder.withStoryContext(storyContext);
|
mediaMessageBuilder.withStoryContext(storyContext);
|
||||||
|
|
||||||
Optional<SignalServiceDataMessage.Reaction> reaction = getStoryReactionFor(message, storyContext);
|
Optional<SignalServiceDataMessage.Reaction> reaction = getStoryReactionFor(message, storyContext);
|
||||||
|
|
|
@ -1506,16 +1506,14 @@ public final class MessageContentProcessor {
|
||||||
|
|
||||||
if (message.getGroupContext().isPresent()) {
|
if (message.getGroupContext().isPresent()) {
|
||||||
parentStoryId = new ParentStoryId.GroupReply(storyMessageId.getId());
|
parentStoryId = new ParentStoryId.GroupReply(storyMessageId.getId());
|
||||||
} else {
|
} else if (SignalDatabase.storySends().canReply(senderRecipient.getId(), storyContext.getSentTimestamp())) {
|
||||||
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
|
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
|
||||||
|
|
||||||
if (!story.getStoryType().isStoryWithReplies()) {
|
|
||||||
warn(content.getTimestamp(), "Story has reactions disabled. Dropping reaction.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parentStoryId = new ParentStoryId.DirectReply(storyMessageId.getId());
|
parentStoryId = new ParentStoryId.DirectReply(storyMessageId.getId());
|
||||||
quoteModel = new QuoteModel(storyContext.getSentTimestamp(), storyAuthorRecipient, "", false, story.getSlideDeck().asAttachments(), Collections.emptyList());
|
quoteModel = new QuoteModel(storyContext.getSentTimestamp(), storyAuthorRecipient, "", false, story.getSlideDeck().asAttachments(), Collections.emptyList());
|
||||||
|
} else {
|
||||||
|
warn(content.getTimestamp(), "Story has reactions disabled. Dropping reaction.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (NoSuchMessageException e) {
|
} catch (NoSuchMessageException e) {
|
||||||
warn(content.getTimestamp(), "Couldn't find story for reaction.", e);
|
warn(content.getTimestamp(), "Couldn't find story for reaction.", e);
|
||||||
|
@ -1574,15 +1572,16 @@ public final class MessageContentProcessor {
|
||||||
ParentStoryId parentStoryId;
|
ParentStoryId parentStoryId;
|
||||||
QuoteModel quoteModel = null;
|
QuoteModel quoteModel = null;
|
||||||
try {
|
try {
|
||||||
MessageId storyMessageId = database.getStoryId(storyAuthorRecipient, storyContext.getSentTimestamp());
|
MessageId storyMessageId = database.getStoryId(storyAuthorRecipient, storyContext.getSentTimestamp());
|
||||||
|
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
|
||||||
|
Recipient threadRecipient = SignalDatabase.threads().getRecipientForThreadId(story.getThreadId());
|
||||||
|
boolean groupStory = threadRecipient != null && threadRecipient.isActiveGroup();
|
||||||
|
|
||||||
if (message.getGroupContext().isPresent()) {
|
if (message.getGroupContext().isPresent() ) {
|
||||||
parentStoryId = new ParentStoryId.GroupReply(storyMessageId.getId());
|
parentStoryId = new ParentStoryId.GroupReply(storyMessageId.getId());
|
||||||
} else if (SignalDatabase.storySends().canReply(senderRecipient.getId(), storyContext.getSentTimestamp())) {
|
} else if (groupStory || SignalDatabase.storySends().canReply(senderRecipient.getId(), storyContext.getSentTimestamp())) {
|
||||||
MmsMessageRecord story = (MmsMessageRecord) database.getMessageRecord(storyMessageId.getId());
|
|
||||||
|
|
||||||
parentStoryId = new ParentStoryId.DirectReply(storyMessageId.getId());
|
parentStoryId = new ParentStoryId.DirectReply(storyMessageId.getId());
|
||||||
quoteModel = new QuoteModel(storyContext.getSentTimestamp(), storyAuthorRecipient, message.getBody().orElse(""), false, story.getSlideDeck().asAttachments(), Collections.emptyList());
|
quoteModel = new QuoteModel(storyContext.getSentTimestamp(), groupStory ? threadRecipient.getId() : storyAuthorRecipient, "", false, story.getSlideDeck().asAttachments(), Collections.emptyList());
|
||||||
} else {
|
} else {
|
||||||
warn(content.getTimestamp(), "Story has replies disabled. Dropping reply.");
|
warn(content.getTimestamp(), "Story has replies disabled. Dropping reply.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -104,6 +104,31 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/story_reacted_label_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
android:layout_marginBottom="-3dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||||
|
android:paddingEnd="@dimen/message_bubble_horizontal_padding"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
|
android:id="@+id/story_reacted_label"
|
||||||
|
style="@style/TextAppearance.Signal.Subtitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="4sp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/signal_text_secondary"
|
||||||
|
tools:text="Reacted to your story" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.QuoteView
|
<org.thoughtcrime.securesms.components.QuoteView
|
||||||
android:id="@+id/quote_view"
|
android:id="@+id/quote_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -4643,8 +4643,10 @@
|
||||||
<!-- Label for a button in a notification at the bottom of the chat list to turn off censorship circumvention -->
|
<!-- Label for a button in a notification at the bottom of the chat list to turn off censorship circumvention -->
|
||||||
<string name="TurnOffCircumventionMegaphone_turn_off">Turn off</string>
|
<string name="TurnOffCircumventionMegaphone_turn_off">Turn off</string>
|
||||||
|
|
||||||
<!-- Conversation Item label for reactions to a story -->
|
<!-- Conversation Item label for when you react to someone else's story -->
|
||||||
<string name="ConversationItem__s_dot_story">%1$s · Story</string>
|
<string name="ConversationItem__you_reacted_to_s_story">You reacted to %1$s\'s story</string>
|
||||||
|
<!-- Conversation Item label for reactions to your story -->
|
||||||
|
<string name="ConversationItem__reacted_to_your_story">Reacted to your story</string>
|
||||||
<!-- Conversation Item label for reactions to an unavailable story -->
|
<!-- Conversation Item label for reactions to an unavailable story -->
|
||||||
<string name="ConversationItem__reacted_to_a_story">Reacted to a story</string>
|
<string name="ConversationItem__reacted_to_a_story">Reacted to a story</string>
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue