Connect YubiKey URL to OpenKeychain

This commit is contained in:
Dominik Schürmann
2015-06-29 21:17:12 +02:00
parent a9c606d49b
commit 7009e504b9
3 changed files with 35 additions and 15 deletions

View File

@@ -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) {

View File

@@ -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);