Decode tel URIs

This commit is contained in:
M66B 2021-07-04 20:41:13 +02:00
parent 5b2b41c166
commit 8df733e65c
1 changed files with 11 additions and 4 deletions

View File

@ -550,16 +550,23 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
} }
private Spanned format(Uri uri, Context context) { private Spanned format(Uri uri, Context context) {
String scheme = uri.getScheme();
String host = uri.getHost();
String text = uri.toString(); String text = uri.toString();
SpannableStringBuilder ssb = new SpannableStringBuilder(text); SpannableStringBuilder ssb = new SpannableStringBuilder(text);
try { try {
String host = uri.getHost();
int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink); int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink);
if (host == null && "mailto".equals(uri.getScheme())) { if ("tel".equals(scheme)) {
MailTo email = MailTo.parse(uri.toString()); // tel://+123%2045%20678%123456
host = UriHelper.getEmailDomain(email.getTo()); host = Uri.decode(host);
text = "tel://" + host;
} else if ("mailto".equals(scheme)) {
if (host != null) {
MailTo email = MailTo.parse(uri.toString());
host = UriHelper.getEmailDomain(email.getTo());
}
} }
if (host != null) { if (host != null) {