Merge pull request #691 from hjubb/fix_url_open_dialog

Fix URL Open Dialog
This commit is contained in:
Niels Andriesse 2021-08-03 15:47:53 +10:00 committed by GitHub
commit d99d4d5ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests
import org.thoughtcrime.securesms.util.SearchUtil
import org.thoughtcrime.securesms.util.SearchUtil.StyleFactory
import org.thoughtcrime.securesms.util.UiModeUtilities
import java.net.IDN
import java.util.*
import kotlin.math.roundToInt
@ -212,7 +213,8 @@ class VisibleMessageContentView : LinearLayout {
// replace URLSpans with ModalURLSpans
body.getSpans<URLSpan>(0, body.length).toList().forEach { urlSpan ->
val replacementSpan = ModalURLSpan(urlSpan.url) { url ->
val updatedUrl = urlSpan.url.let(IDN::toASCII)
val replacementSpan = ModalURLSpan(updatedUrl) { url ->
val activity = context as AppCompatActivity
OpenURLDialog(url).show(activity.supportFragmentManager, "Open URL Dialog")
}