Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Mar 15, 2023
1 parent 74b210e commit 4209185
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ object MatrixPatterns {
// Android does not support in URL so extract it.
private const val PERMALINK_BASE_REGEX = "https://matrix\\.to/#/"
private const val APP_BASE_REGEX = "https://[A-Z0-9.-]+\\.[A-Z]{2,}/[A-Z]{3,}/#/room/"
private const val URL_PARAMS = "\\b[-a-zA-Z0-9()@:%_\\+.~#?&//=]*"
const val SEP_REGEX = "/"

private val PATTERN_CONTAIN_MATRIX_TO_PERMALINK = PERMALINK_BASE_REGEX.toRegex(RegexOption.IGNORE_CASE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class EventTextRenderer @AssistedInject constructor(
* @param text the text to be rendered
*/
fun render(text: CharSequence): CharSequence {
return renderNotifyEveryone(renderPermalinks(text))
// return renderNotifyEveryone(text)
val formattedText = renderPermalinks(text)
return renderNotifyEveryone(formattedText)
}

private fun renderNotifyEveryone(text: CharSequence): CharSequence {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,18 @@ class PillImageSpan(

private fun createChipDrawable(): ChipDrawable {
val textPadding = context.resources.getDimension(R.dimen.pill_text_padding)
val hasRoomAvatar = matrixItem is MatrixItem.RoomItem && matrixItem.avatarUrl.isNullOrEmpty()
val icon = when {
matrixItem is MatrixItem.RoomItem &&
matrixItem.avatarUrl.isNullOrEmpty() &&
hasRoomAvatar && matrixItem.displayName == context.getString(R.string.pill_message_from_unknown_user) -> null
hasRoomAvatar &&
(matrixItem.displayName == context.getString(R.string.pill_message_in_unknown_room) ||
matrixItem.displayName == context.getString(R.string.pill_message_unknown_room_or_space)) -> {
matrixItem.displayName == context.getString(R.string.pill_message_unknown_room_or_space)) -> {
ContextCompat.getDrawable(context, R.drawable.ic_permalink)
}
matrixItem is MatrixItem.UserItem &&
matrixItem.avatarUrl.isNullOrEmpty() &&
matrixItem is MatrixItem.UserItem && matrixItem.avatarUrl.isNullOrEmpty() &&
matrixItem.displayName == context.getString(R.string.pill_message_unknown_user) -> {
ContextCompat.getDrawable(context, R.drawable.ic_user_round)
}
matrixItem is MatrixItem.RoomItem &&
matrixItem.avatarUrl.isNullOrEmpty() &&
matrixItem.displayName == context.getString(R.string.pill_message_from_unknown_user) -> null
else -> {
try {
avatarRenderer.getCachedDrawable(glideRequests, matrixItem)
Expand Down

0 comments on commit 4209185

Please sign in to comment.