Render custom emoji reactions in notifications tab
This commit is contained in:
parent
c708451dc4
commit
f1b3df55fb
|
@ -289,8 +289,11 @@ internal class StatusNotificationViewHolder(
|
|||
displayNameIndex + displayName.length,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
val emojis = notificationViewData.account.emojis?.toMutableList() ?: mutableListOf()
|
||||
if (notificationViewData.isCustomEmoji())
|
||||
emojis.add(notificationViewData.makeCustomEmoji())
|
||||
val emojifiedText = str.emojify(
|
||||
notificationViewData.account.emojis,
|
||||
emojis,
|
||||
binding.notificationTopText,
|
||||
animateEmojis
|
||||
)
|
||||
|
|
|
@ -32,6 +32,7 @@ data class Notification(
|
|||
val report: Report?,
|
||||
val pleroma: PleromaNotification? = null,
|
||||
val emoji: String? = null,
|
||||
@SerializedName("emoji_url") val emojiUrl: String? = null,
|
||||
) {
|
||||
|
||||
/** From https://docs.joinmastodon.org/entities/Notification/#type */
|
||||
|
|
|
@ -67,6 +67,7 @@ fun Notification.toViewData(
|
|||
this.status?.toViewData(isShowingContent, isExpanded, isCollapsed),
|
||||
this.report,
|
||||
this.emoji,
|
||||
this.emojiUrl,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -42,4 +42,14 @@ data class NotificationViewData(
|
|||
var statusViewData: StatusViewData.Concrete?,
|
||||
val report: Report?,
|
||||
val emoji: String?,
|
||||
val emojiUrl: String?,
|
||||
)
|
||||
{
|
||||
fun isCustomEmoji() = emojiUrl != null
|
||||
|
||||
fun makeCustomEmoji(): Emoji {
|
||||
// Trim ':' characters to comply with CustomEmojiHelper rules.
|
||||
val shortcode: String = emoji!!.substring(1, emoji.length - 1)
|
||||
return Emoji(shortcode, emojiUrl!!, emojiUrl, false)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue