Integrate QR Code library instead of requiring the app to be installed, also due to security reasons

This commit is contained in:
Dominik Schürmann 2015-01-14 19:14:30 +01:00
parent 9b093c6d73
commit 85b6669625
5 changed files with 17 additions and 6 deletions

View File

@ -10,8 +10,6 @@ dependencies {
compile project(':extern:openkeychain-api-lib')
compile project(':extern:html-textview')
compile project(':extern:StickyListHeaders:library')
compile project(':extern:zxing-qr-code')
compile project(':extern:zxing-android-integration')
compile project(':extern:spongycastle:core')
compile project(':extern:spongycastle:pg')
compile project(':extern:spongycastle:pkix')
@ -22,6 +20,11 @@ dependencies {
compile project(':extern:TokenAutoComplete:library')
compile project(':extern:safeslinger-exchange')
compile project(':extern:android-lockpattern:code')
// TODO: include as submodule?:
compile 'com.journeyapps:zxing-android-embedded:2.0.1@aar'
compile 'com.journeyapps:zxing-android-integration:2.0.1@aar'
compile 'com.google.zxing:core:3.0.1'
}
android {

View File

@ -78,7 +78,11 @@ public class QrCodeScanActivity extends FragmentActivity {
// scan using xzing's Barcode Scanner and return result parcel in OpenKeychain
returnResult = true;
new IntentIntegrator(this).initiateScan();
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES)
.setPrompt(getString(R.string.import_qr_code_text))
.setResultDisplayDuration(0)
.initiateScan();
} else if (ACTION_QR_CODE_API.equals(action)) {
// scan using xzing's Barcode Scanner from outside OpenKeychain
@ -168,7 +172,7 @@ public class QrCodeScanActivity extends FragmentActivity {
return;
}
if ( ! result.success()) {
if (!result.success()) {
// only return if no success...
Intent data = new Intent();
data.putExtras(returnData);

View File

@ -395,6 +395,7 @@
<string name="import_qr_code_wrong">"QR Code malformed! Please try again!"</string>
<string name="import_qr_code_too_short_fingerprint">"Fingerprint is too short (&lt; 16 characters)"</string>
<string name="import_qr_code_button">"Scan QR Code"</string>
<string name="import_qr_code_text">"Place your camera over the QR Code!"</string>
<!-- Generic result toast -->
<string name="view_log">"View Log"</string>

View File

@ -12,6 +12,11 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
// for https://github.com/journeyapps/zxing-android-embedded
url "http://dl.bintray.com/journeyapps/maven"
}
}
}

View File

@ -3,8 +3,6 @@ include ':extern:openpgp-api-lib'
include ':extern:openkeychain-api-lib'
include ':extern:html-textview'
include ':extern:StickyListHeaders:library'
include ':extern:zxing-qr-code'
include ':extern:zxing-android-integration'
include ':extern:spongycastle:core'
include ':extern:spongycastle:pg'
include ':extern:spongycastle:pkix'