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") 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)

View file

@ -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()