-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown and sploiler in roomlist + spoiler in notifications #4483
Conversation
Make notifications spoiler aware
} else { | ||
lastContent?.body ?: "" | ||
lastContentBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small clean up here, should not change anything.
?: newContent?.toModel<MessageContent>()?.body | ||
?: (this as MessageTextContent?)?.matrixFormattedBody?.let { ContentUtils.formatSpoilerTextFromHtml(it) } | ||
?: body | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fun should now be used when we want to display an Event, but not when user wants to edit it
@@ -44,4 +46,15 @@ object ContentUtils { | |||
} | |||
return repliedBody | |||
} | |||
|
|||
@Suppress("RegExpRedundantEscape") | |||
fun formatSpoilerTextFromHtml(formattedBody: String): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would deserve some unit test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although it uses androidx.core.text.HtmlCompat.fromHtml
so we wouldn't be able to write a unit test unless we use a java equivalent
} | ||
MessageType.MSGTYPE_FILE -> { | ||
return simpleFormat(senderName, stringProvider.getString(R.string.sent_a_file), appendAuthor) | ||
} | ||
MessageType.MSGTYPE_TEXT -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to the beginning since this is the most common case
EventType.STICKER -> { | ||
return simpleFormat(senderName, stringProvider.getString(R.string.send_a_sticker), appendAuthor) | ||
} | ||
EventType.REACTION -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move below since this is less common than EventType.MESSAGE
I squash the commits for a cleaner Git history |
Replacement for #4426 and #2694