Skip to content
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

Merged
merged 18 commits into from
Nov 17, 2021

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Nov 17, 2021

Replacement for #4426 and #2694

} else {
lastContent?.body ?: ""
lastContentBody
Copy link
Member Author

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
}
Copy link
Member Author

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 {
Copy link
Member Author

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...

Copy link
Contributor

@ouchadam ouchadam Nov 17, 2021

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 -> {
Copy link
Member Author

@bmarty bmarty Nov 17, 2021

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 -> {
Copy link
Member Author

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

@bmarty bmarty marked this pull request as ready for review November 17, 2021 09:03
@github-actions
Copy link

github-actions bot commented Nov 17, 2021

Unit Test Results

  66 files  ±0    66 suites  ±0   53s ⏱️ -14s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit b5127c7. ± Comparison against base commit 10ec6e7.

♻️ This comment has been updated with latest results.

@bmarty bmarty enabled auto-merge (squash) November 17, 2021 10:13
@bmarty
Copy link
Member Author

bmarty commented Nov 17, 2021

I squash the commits for a cleaner Git history

@bmarty bmarty merged commit 0fd29d7 into develop Nov 17, 2021
@bmarty bmarty deleted the feature/bma/markdown_roomlist branch November 17, 2021 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants