Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
maureenorea-clores committed Sep 21, 2024
1 parent ef8479e commit 2393ae3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ internal fun UiMessage.applyCustomClickableImage(clickableImage: ClickableImage?
return false
}

return if (this.startsWith("http")) {
Regex("https://.*").matches(this)
} else {
Regex(".*://.*").matches(this)
}
val allowedPattern = Regex("https://.*|.*://.*")
return this.matches(allowedPattern)
}

@SuppressWarnings("ComplexCondition")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApplyClickableImageSpec {
uiMessage = message.applyCustomClickableImage(ClickableImage("ogle.124dsefsd"), false)
uiMessage shouldBeEqualTo message

uiMessage = message.applyCustomClickableImage(ClickableImage("http://test.com"), false)
uiMessage = message.applyCustomClickableImage(ClickableImage("intent:/invalid/deeplink"), false)
uiMessage shouldBeEqualTo message

uiMessage = message.applyCustomClickableImage(ClickableImage(" myapp://open"), false)
Expand Down

0 comments on commit 2393ae3

Please sign in to comment.