support QR scanners that do not respect custom URI schemes

Some QR Code scanners don't respect custom schemes like fdroidrepo://, so
this is a workaround, since the local repo URI is all uppercase in the QR
Code for sending the local repo to another device.  This way, the QR Code
can still be all uppercase and use HTTP:// and Android will still route it
to FDroid, but via the Just Once/Always chooser (fdroidrepo:// goes
directly to FDroid with no prompt, when it works)
This commit is contained in:
Hans-Christoph Steiner 2014-04-07 21:07:01 -04:00
parent a477f421cb
commit 407e7662e9
2 changed files with 14 additions and 0 deletions

View File

@ -129,6 +129,12 @@
<data android:pathPattern="/.*/.*/fdroid/archive/*" />
<data android:pathPattern="/.*/.*/.*/fdroid/archive" />
<data android:pathPattern="/.*/.*/.*/fdroid/archive/*" />
<!--
Some QR Code scanners don't respect custom schemes like fdroidrepo://,
so this is a workaround, since the local repo URL is all uppercase in
the QR Code for sending the local repo to another device.
-->
<data android:path="/FDROID/REPO" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

View File

@ -208,6 +208,14 @@ public class RepoListFragment extends ListFragment
* case means it should be downcased.
*/
uri = Uri.parse(uri.toString().toLowerCase(Locale.ENGLISH));
} else if (uri.getPath().startsWith("/FDROID/REPO")) {
/*
* some QR scanners chop off the fdroidrepo:// and just try
* http://, then the incoming URI does not get downcased
* properly, and the query string is stripped off. So just
* downcase the path, and carry on to get something working.
*/
uri = Uri.parse(uri.toString().toLowerCase(Locale.ENGLISH));
}
// make scheme and host lowercase so they're readable in dialogs
scheme = scheme.toLowerCase(Locale.ENGLISH);