How to change the code so that you can open sms links
Nobody has claimed this yet.
- Dominant language
- Objective-C++
- Stars
- 2.7k
- Forks
- 734
- Avg merge
- 11h 39m
- Merged PRs (30d)
- 1
Description
Good afternoon! I need to use this webview to make sms links open in the message application. I was given a sample code on kotlin. Please tell me how I can change this webview so that everything works for me.
webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?,
): Boolean {
if (request?.url == null || request.url.toString().contains("http://") || request.url.toString().contains("https://"))
return false
return try {
var uri = request.url.toString()
if (request.url.toString().contains("sms"))
uri = request.url.toString().replaceFirst("(?<=sms:)/{2}".toRegex(), "")
Intent(Intent.ACTION_VIEW, Uri.parse(uri)).also { startActivity(it) }
true
} catch (e: Exception) {
true
}
}
}
or maybe there is an opportunity to do this in the next commit?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the WebViewClient shouldOverrideUrlLoading example in the issue and the unity-webview project’s Android link-handling entry points. Determine how sms links should be delegated to the message application, and verify that regular HTTP and HTTPS links remain unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100