From: Eugene Crosser Date: Fri, 3 May 2013 10:31:06 +0000 (+0400) Subject: cleanup workflow X-Git-Url: http://www.average.org/gitweb/?p=YkNeoCR.git;a=commitdiff_plain;h=eed939e04ff795ee6e5fbfd0297c26c6996a2fd9;hp=28b4d52dc728ff9016890ff3630d1237f1f2650b cleanup workflow --- diff --git a/res/values/strings.xml b/res/values/strings.xml index b13405e..aadb0f4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5,9 +5,11 @@ Select Slot Slot 1 Slot 2 + You must select which slot to use Enrollment result: + Token successfully bound to the device Ready to send challenge - Please touch the token with the phone + Please touch the back of the phone with the NFC token to enroll it Cannot reach the NFC adapter Need to enable NFC in Settings Communitation with the tag lost diff --git a/src/org/average/nfcauthcr/Check.java b/src/org/average/nfcauthcr/Check.java index 1fc5cea..f65ae1b 100644 --- a/src/org/average/nfcauthcr/Check.java +++ b/src/org/average/nfcauthcr/Check.java @@ -101,13 +101,11 @@ public class Check extends Activity { Toast.makeText(this, R.string.no_nfc, Toast.LENGTH_LONG).show(); finish(); - return; } if (! adapter.isEnabled()) { Toast.makeText(this, R.string.nfc_disabled, Toast.LENGTH_LONG).show(); finish(); - return; } adapter.enableForegroundDispatch( this, tagIntent, new IntentFilter[] {iso}, diff --git a/src/org/average/nfcauthcr/Enroll.java b/src/org/average/nfcauthcr/Enroll.java index 5b125fa..190c08f 100644 --- a/src/org/average/nfcauthcr/Enroll.java +++ b/src/org/average/nfcauthcr/Enroll.java @@ -80,7 +80,7 @@ public class Enroll extends Activity { if (slot > 0) { runEnrollment(slot); } else { - showEnrollResult("Must specify which slot to use"); + showEnrollResult(R.string.need_slot); } } @@ -101,15 +101,14 @@ public class Enroll extends Activity { editor.putString("challenge", hex(challenge)); editor.putString("response", hex(response)); editor.commit(); + showEnrollResult(R.string.enroll_success); Log.v(TAG, "stored new challenge and response"); } - private void showEnrollResult(final String msg) { - Log.v(TAG, "Show result: \"" + msg + "\""); - + private void showEnrollResult(int messageid) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.enrollresult); - builder.setMessage(msg); + builder.setMessage(messageid); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { diff --git a/src/org/average/nfcauthcr/YkNeo.java b/src/org/average/nfcauthcr/YkNeo.java index 1537459..26a6853 100644 --- a/src/org/average/nfcauthcr/YkNeo.java +++ b/src/org/average/nfcauthcr/YkNeo.java @@ -54,6 +54,10 @@ public class YkNeo { throw new CRException( "NFC Error code in the response to CR"); } + if (length != 22) { + throw new CRException( + "NFC wrong response size: " + (length-2)); + } return Arrays.copyOf(resp, length-2); } catch (TagLostException e) { throw new CRException("NFC connection lost", e);