Merge branch 'fix-721--qrcode-generation' into 'master'

Don't upper case QR code that has a URL.

See comment in #721 or this commit for explanation.

Fixes #721.

See merge request !358
This commit is contained in:
Daniel Martí 2016-07-25 11:11:05 +00:00
commit dd9b1fc613
2 changed files with 3 additions and 12 deletions

View File

@ -38,8 +38,6 @@ import org.fdroid.fdroid.data.Repo;
import org.fdroid.fdroid.data.RepoProvider; import org.fdroid.fdroid.data.RepoProvider;
import org.fdroid.fdroid.data.Schema.RepoTable; import org.fdroid.fdroid.data.Schema.RepoTable;
import java.util.Locale;
public class RepoDetailsActivity extends ActionBarActivity { public class RepoDetailsActivity extends ActionBarActivity {
private static final String TAG = "RepoDetailsActivity"; private static final String TAG = "RepoDetailsActivity";
@ -112,7 +110,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
Uri uri = Uri.parse(repo.address); Uri uri = Uri.parse(repo.address);
uri = uri.buildUpon().appendQueryParameter("fingerprint", repo.fingerprint).build(); uri = uri.buildUpon().appendQueryParameter("fingerprint", repo.fingerprint).build();
String qrUriString = uri.toString().toUpperCase(Locale.ENGLISH); String qrUriString = uri.toString();
new QrGenAsyncTask(this, R.id.qr_code).execute(qrUriString); new QrGenAsyncTask(this, R.id.qr_code).execute(qrUriString);
} }

View File

@ -132,19 +132,12 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner
TextView ipAddressView = (TextView) findViewById(R.id.device_ip_address); TextView ipAddressView = (TextView) findViewById(R.id.device_ip_address);
ipAddressView.setText(buttonLabel); ipAddressView.setText(buttonLabel);
/*
* Set URL to UPPER for compact QR Code, FDroid will translate it back.
* Remove the SSID from the query string since SSIDs are case-sensitive.
* Instead the receiver will have to rely on the BSSID to find the right
* wifi AP to join. Lots of QR Scanners are buggy and do not respect
* custom URI schemes, so we have to use http:// or https:// :-(
*/
Uri sharingUri = Utils.getSharingUri(FDroidApp.repo); Uri sharingUri = Utils.getSharingUri(FDroidApp.repo);
String qrUriString = (scheme + sharingUri.getHost()).toUpperCase(Locale.ENGLISH); String qrUriString = scheme + sharingUri.getHost();
if (sharingUri.getPort() != 80) { if (sharingUri.getPort() != 80) {
qrUriString += ":" + sharingUri.getPort(); qrUriString += ":" + sharingUri.getPort();
} }
qrUriString += sharingUri.getPath().toUpperCase(Locale.ENGLISH); qrUriString += sharingUri.getPath();
boolean first = true; boolean first = true;
// Andorid provides an API for getting the query parameters and iterating over them: // Andorid provides an API for getting the query parameters and iterating over them: