Updated on 2026-08-14

This commit is contained in:
Tangem 2018-07-27 14:33:04 +03:00
parent 6578d7c8c2
commit 89a6e55bab
16 changed files with 259 additions and 359 deletions

View file

@ -34,89 +34,6 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade
private ProgressBar progressBar;
private PurgeTask purgeTask;
// private class PurgeTask extends Thread {
// private String txOutAddress;
//
// IsoDep mIsoDep;
// CardProtocol.Notifications mNotifications;
// private boolean isCancelled = false;
//
// PurgeTask(IsoDep isoDep, CardProtocol.Notifications notifications) {
// mIsoDep = isoDep;
// mNotifications = notifications;
// }
//
// @Override
// public void run() {
// if (mIsoDep == null) {
// return;
// }
// CardProtocol protocol = new CardProtocol(getBaseContext(), mIsoDep, mCard, mNotifications);
//
// mNotifications.OnReadStart(protocol);
// try {
//
// // for Samsung's bugs - Workaround for the Samsung Galaxy S5 (since the first connection always hangs on transceive).
// int timeout = mIsoDep.getTimeout();
// mIsoDep.connect();
// mIsoDep.close();
// mIsoDep.connect();
// mIsoDep.setTimeout(timeout);
// try {
// mNotifications.OnReadProgress(protocol, 5);
//
// Log.i(TAG, "[-- Start purge --]");
//
// if (isCancelled) return;
//
// if (mCard.getPauseBeforePIN2() > 0) {
// mNotifications.OnReadWait(mCard.getPauseBeforePIN2());
// }
//
//// try {
// protocol.run_PurgeWallet(PINStorage.getPIN2());
//// } finally {
//// mNotifications.OnReadWait(0);
//// }
//
// mNotifications.OnReadProgress(protocol, 50);
//
// protocol.run_Read();
//
// mNotifications.OnReadProgress(protocol, 100);
//
// if (isCancelled) return;
//
// } finally {
// mNfcManager.ignoreTag(mIsoDep.getTag());
// }
// } catch (Exception e) {
// e.printStackTrace();
// protocol.setError(e);
//
// } finally {
// Log.i(TAG, "[-- Finish purge --]");
// mNotifications.OnReadFinish(protocol);
// }
// }
//
// public void cancel(Boolean AllowInterrupt) {
// try {
// if (this.isAlive()) {
// isCancelled = true;
// join(500);
// }
// if (this.isAlive() && AllowInterrupt) {
// interrupt();
// mNotifications.OnReadCancel();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -181,7 +98,6 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade
} else {
// Log.d(TAG, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")");
mNfcManager.ignoreTag(isoDep.getTag());
return;
}
} catch (Exception e) {
@ -252,8 +168,8 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade
} else {
progressBar.post(() -> {
if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG);
if (!NoExtendedLengthSupportDialog.Companion.getAllReadyShowed()) {
new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.Companion.getTAG());
}
} else
Toast.makeText(getBaseContext(), R.string.try_to_scan_again, Toast.LENGTH_LONG).show();