Merge pull request #2323 from wiktor-k/ndef-openpgp4fpr
Add support for NDEF tags with `openpgp4fpr` URIs
This commit is contained in:
@@ -743,6 +743,20 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- NFC: Handle NFC tags with "openpgp4fpr" scheme URIs detected from outside our application -->
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
|
<!-- Android's scheme matcher is case-sensitive, so include most likely variations -->
|
||||||
|
<data android:scheme="openpgp4fpr" />
|
||||||
|
<data android:scheme="OPENPGP4FPR" />
|
||||||
|
<data android:scheme="OpenPGP4FPR" />
|
||||||
|
<data android:scheme="OpenPGP4Fpr" />
|
||||||
|
<data android:scheme="OpenPGP4fpr" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".ui.MainActivity" />
|
android:value=".ui.MainActivity" />
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.nfc.NfcAdapter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
@@ -123,7 +124,7 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
|
|||||||
action = ACTION_IMPORT_KEY_FROM_FACEBOOK;
|
action = ACTION_IMPORT_KEY_FROM_FACEBOOK;
|
||||||
} else if ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) {
|
} else if ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) {
|
||||||
action = ACTION_SEARCH_KEYSERVER_FROM_URL;
|
action = ACTION_SEARCH_KEYSERVER_FROM_URL;
|
||||||
} else if ("openpgp4fpr".equalsIgnoreCase(scheme)) {
|
} else if (Constants.FINGERPRINT_SCHEME.equalsIgnoreCase(scheme)) {
|
||||||
action = ACTION_IMPORT_KEY_FROM_KEYSERVER;
|
action = ACTION_IMPORT_KEY_FROM_KEYSERVER;
|
||||||
extras.putString(EXTRA_FINGERPRINT, dataUri.getSchemeSpecificPart());
|
extras.putString(EXTRA_FINGERPRINT, dataUri.getSchemeSpecificPart());
|
||||||
} else {
|
} else {
|
||||||
@@ -131,7 +132,11 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
|
|||||||
// delegate action to ACTION_IMPORT_KEY
|
// delegate action to ACTION_IMPORT_KEY
|
||||||
action = ACTION_IMPORT_KEY;
|
action = ACTION_IMPORT_KEY;
|
||||||
}
|
}
|
||||||
|
} else if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action) && Constants.FINGERPRINT_SCHEME.equalsIgnoreCase(scheme)) {
|
||||||
|
action = ACTION_IMPORT_KEY_FROM_KEYSERVER;
|
||||||
|
extras.putString(EXTRA_FINGERPRINT, dataUri.getSchemeSpecificPart());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
// -> switch to default below
|
// -> switch to default below
|
||||||
action = "";
|
action = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user