Fixed tel URI handling when number starts with +
This commit is contained in:
parent
50c4a9549f
commit
31ed790378
2 changed files with 6 additions and 4 deletions
|
@ -248,15 +248,17 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
Log.i("[Main Activity] Found uri: $uri to call")
|
Log.i("[Main Activity] Found uri: $uri to call")
|
||||||
val stringUri = uri.toString()
|
val stringUri = uri.toString()
|
||||||
var addressToCall: String = stringUri
|
var addressToCall: String = stringUri
|
||||||
try {
|
|
||||||
addressToCall = URLDecoder.decode(stringUri, "UTF-8")
|
|
||||||
} catch (e: UnsupportedEncodingException) { }
|
|
||||||
|
|
||||||
if (addressToCall.startsWith("tel:")) {
|
if (addressToCall.startsWith("tel:")) {
|
||||||
Log.i("[Main Activity] Removing tel: prefix")
|
Log.i("[Main Activity] Removing tel: prefix")
|
||||||
addressToCall = addressToCall.substring("tel:".length)
|
addressToCall = addressToCall.substring("tel:".length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val address = coreContext.core.interpretUrl(addressToCall)
|
||||||
|
if (address != null) {
|
||||||
|
addressToCall = address.asStringUriOnly()
|
||||||
|
}
|
||||||
|
|
||||||
Log.i("[Main Activity] Starting dialer with pre-filled URI $addressToCall")
|
Log.i("[Main Activity] Starting dialer with pre-filled URI $addressToCall")
|
||||||
val args = Bundle()
|
val args = Bundle()
|
||||||
args.putString("URI", addressToCall)
|
args.putString("URI", addressToCall)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.10'
|
ext.kotlin_version = '1.4.20'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
|
Loading…
Reference in a new issue