mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 08:28:50 -05:00
nicer handling of nfc errors
This commit is contained in:
parent
5227b45af8
commit
3bb194fc08
@ -28,7 +28,6 @@ import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
|
||||
import org.sufficientlysecure.keychain.ui.ViewKeyActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.ActionListener;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
import org.sufficientlysecure.keychain.util.Iso7816TLV;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@ -68,14 +67,18 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
||||
try {
|
||||
handleNdefDiscoveredIntent(intent);
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "Connection error!", e);
|
||||
toast("Connection Error: " + e.getMessage());
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
handleNfcError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleNfcError(IOException e) {
|
||||
|
||||
Log.e(Constants.TAG, "nfc error", e);
|
||||
Notify.create(this, getString(R.string.error_nfc, e.getMessage()), Style.WARN).show();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the system is about to start resuming a previous activity,
|
||||
* disables NFC Foreground Dispatch
|
||||
|
@ -1278,5 +1278,6 @@
|
||||
<string name="yubikey_status_partly">"Yubikey matches, partly bound to key"</string>
|
||||
<string name="btn_import">"Import"</string>
|
||||
<string name="snack_yubi_other">Different key stored on Yubikey!</string>
|
||||
<string name="error_nfc">"NFC Error: %s"</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user