Connect YubiKey URL to OpenKeychain
This commit is contained in:
@@ -95,15 +95,15 @@
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.MainActivity" />
|
||||
<!-- Connect with YubiKeys. This Activity will automatically show/import/create key -->
|
||||
<!--<intent-filter>-->
|
||||
<!--<action android:name="android.nfc.action.NDEF_DISCOVERED"/>-->
|
||||
<!--<category android:name="android.intent.category.DEFAULT"/>-->
|
||||
<!--<data-->
|
||||
<!--android:scheme="https"-->
|
||||
<!--android:host="my.yubico.com"-->
|
||||
<!--android:pathPrefix="/neo"/>-->
|
||||
<!--</intent-filter>-->
|
||||
<!-- Connect with YubiKeys. This Activity will automatically show/import/create YubiKeys -->
|
||||
<intent-filter android:label="@string/app_name">
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="my.yubico.com"
|
||||
android:pathPrefix="/neo"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.EditKeyActivity"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
@@ -62,6 +63,23 @@ public class CreateKeyActivity extends BaseNfcActivity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// React on NDEF_DISCOVERED from Manifest
|
||||
// NOTE: ACTION_NDEF_DISCOVERED and not ACTION_TAG_DISCOVERED like in BaseNfcActivity
|
||||
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {
|
||||
try {
|
||||
handleTagDiscoveredIntent(getIntent());
|
||||
} catch (CardException e) {
|
||||
handleNfcError(e);
|
||||
} catch (IOException e) {
|
||||
handleNfcError(e);
|
||||
}
|
||||
|
||||
setTitle(R.string.title_manage_my_keys);
|
||||
|
||||
// done
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether we're recreating a previously destroyed instance
|
||||
if (savedInstanceState != null) {
|
||||
// Restore value of members from saved state
|
||||
@@ -96,14 +114,16 @@ public class CreateKeyActivity extends BaseNfcActivity {
|
||||
} else {
|
||||
Fragment frag = CreateKeyYubiKeyBlankFragment.newInstance();
|
||||
loadFragment(frag, FragAction.START);
|
||||
setTitle(R.string.title_manage_my_keys);
|
||||
}
|
||||
|
||||
// done
|
||||
return;
|
||||
} else {
|
||||
// normal key creation
|
||||
CreateKeyStartFragment frag = CreateKeyStartFragment.newInstance();
|
||||
loadFragment(frag, FragAction.START);
|
||||
}
|
||||
|
||||
// normal key creation
|
||||
CreateKeyStartFragment frag = CreateKeyStartFragment.newInstance();
|
||||
loadFragment(frag, FragAction.START);
|
||||
}
|
||||
|
||||
if (mFirstTime) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
||||
public void onNewIntent(Intent intent) {
|
||||
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
|
||||
try {
|
||||
handleNdefDiscoveredIntent(intent);
|
||||
handleTagDiscoveredIntent(intent);
|
||||
} catch (CardException e) {
|
||||
handleNfcError(e);
|
||||
} catch (IOException e) {
|
||||
@@ -278,7 +278,7 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
||||
* on ISO SmartCard Systems specification.
|
||||
*
|
||||
*/
|
||||
protected void handleNdefDiscoveredIntent(Intent intent) throws IOException {
|
||||
protected void handleTagDiscoveredIntent(Intent intent) throws IOException {
|
||||
|
||||
Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user