Add proper thread summary for reactions to stories.
This commit is contained in:
parent
d64aa3bc43
commit
b183a38f3c
2 changed files with 14 additions and 0 deletions
|
@ -50,6 +50,8 @@ public final class ThreadBodyUtil {
|
||||||
return format(context, record, emoji, R.string.ThreadRecord_sticker);
|
return format(context, record, emoji, R.string.ThreadRecord_sticker);
|
||||||
} else if (MessageRecordUtil.hasGiftBadge(record)) {
|
} else if (MessageRecordUtil.hasGiftBadge(record)) {
|
||||||
return String.format("%s %s", EmojiStrings.GIFT, getGiftSummary(context, record));
|
return String.format("%s %s", EmojiStrings.GIFT, getGiftSummary(context, record));
|
||||||
|
} else if (MessageRecordUtil.isStoryReaction(record)) {
|
||||||
|
return getStoryReactionSummary(context, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasImage = false;
|
boolean hasImage = false;
|
||||||
|
@ -84,6 +86,14 @@ public final class ThreadBodyUtil {
|
||||||
return context.getString(R.string.ThreadRecord__you_received_a_gift);
|
return context.getString(R.string.ThreadRecord__you_received_a_gift);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static @NonNull String getStoryReactionSummary(@NonNull Context context, @NonNull MessageRecord messageRecord) {
|
||||||
|
if (messageRecord.isOutgoing()) {
|
||||||
|
return context.getString(R.string.ThreadRecord__reacted_s_to_their_story, messageRecord.getDisplayBody(context));
|
||||||
|
} else {
|
||||||
|
return context.getString(R.string.ThreadRecord__reacted_s_to_your_story, messageRecord.getDisplayBody(context));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static @NonNull String format(@NonNull Context context, @NonNull MessageRecord record, @NonNull String emoji, @StringRes int defaultStringRes) {
|
private static @NonNull String format(@NonNull Context context, @NonNull MessageRecord record, @NonNull String emoji, @StringRes int defaultStringRes) {
|
||||||
return String.format("%s %s", emoji, getBodyOrDefault(context, record, defaultStringRes));
|
return String.format("%s %s", emoji, getBodyOrDefault(context, record, defaultStringRes));
|
||||||
|
|
|
@ -1811,6 +1811,10 @@
|
||||||
<string name="ThreadRecord__you_sent_a_gift">You sent a gift</string>
|
<string name="ThreadRecord__you_sent_a_gift">You sent a gift</string>
|
||||||
<!-- Displayed in the notification when the user has opened a received gift -->
|
<!-- Displayed in the notification when the user has opened a received gift -->
|
||||||
<string name="ThreadRecord__you_redeemed_a_gift_badge">You redeemed a gift badge</string>
|
<string name="ThreadRecord__you_redeemed_a_gift_badge">You redeemed a gift badge</string>
|
||||||
|
<!-- Displayed in the conversation list when someone reacted to your story -->
|
||||||
|
<string name="ThreadRecord__reacted_s_to_your_story">Reacted %1$s to your story</string>
|
||||||
|
<!-- Displayed in the conversation list when you reacted to someone's story -->
|
||||||
|
<string name="ThreadRecord__reacted_s_to_their_story">Reacted %1$s to their story</string>
|
||||||
|
|
||||||
<!-- UpdateApkReadyListener -->
|
<!-- UpdateApkReadyListener -->
|
||||||
<string name="UpdateApkReadyListener_Signal_update">Signal update</string>
|
<string name="UpdateApkReadyListener_Signal_update">Signal update</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue