mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-06 17:25:05 -05:00
Allow import of full keys from qr codes
This commit is contained in:
parent
0c4b809195
commit
c744cad8db
@ -98,22 +98,29 @@ public class ImportKeysQrCodeFragment extends Fragment {
|
||||
IntentResult scanResult = IntentIntegratorSupportV4.parseActivityResult(requestCode,
|
||||
resultCode, data);
|
||||
if (scanResult != null && scanResult.getFormatName() != null) {
|
||||
String scannedContent = scanResult.getContents();
|
||||
|
||||
Log.d(Constants.TAG, "scanResult content: " + scanResult.getContents());
|
||||
Log.d(Constants.TAG, "scannedContent: " + scannedContent);
|
||||
|
||||
// look if it's fingerprint only
|
||||
if (scanResult.getContents().toLowerCase(Locale.ENGLISH).startsWith(Constants.FINGERPRINT_SCHEME)) {
|
||||
if (scannedContent.toLowerCase(Locale.ENGLISH).startsWith(Constants.FINGERPRINT_SCHEME)) {
|
||||
importFingerprint(Uri.parse(scanResult.getContents()));
|
||||
return;
|
||||
}
|
||||
|
||||
// look if it is the whole key
|
||||
String[] parts = scanResult.getContents().split(",");
|
||||
String[] parts = scannedContent.split(",");
|
||||
if (parts.length == 3) {
|
||||
importParts(parts);
|
||||
return;
|
||||
}
|
||||
|
||||
// is this a full key encoded as qr code?
|
||||
if (scannedContent.startsWith("-----BEGIN PGP")) {
|
||||
mImportActivity.loadCallback(scannedContent.getBytes(), null, null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
// fail...
|
||||
Toast.makeText(getActivity(), R.string.import_qr_code_wrong, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
|
Loading…
Reference in New Issue
Block a user