Fixed tel URI handling when number starts with +

This commit is contained in:
Sylvain Berfini 2020-11-27 15:41:32 +01:00
parent 50c4a9549f
commit 31ed790378
2 changed files with 6 additions and 4 deletions

View file

@ -248,15 +248,17 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
Log.i("[Main Activity] Found uri: $uri to call")
val stringUri = uri.toString()
var addressToCall: String = stringUri
try {
addressToCall = URLDecoder.decode(stringUri, "UTF-8")
} catch (e: UnsupportedEncodingException) { }
if (addressToCall.startsWith("tel:")) {
Log.i("[Main Activity] Removing tel: prefix")
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")
val args = Bundle()
args.putString("URI", addressToCall)

View file

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.20'
repositories {
google()