Updated on 2026-08-14

This commit is contained in:
Tangem 2018-07-24 13:38:42 +03:00
parent e862424234
commit 44abb99a9f
11 changed files with 18 additions and 103 deletions

View file

@ -158,7 +158,7 @@ public class CreateNewWalletActivity extends AppCompatActivity implements NfcAda
} else {
progressBar.post(() -> {
if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allreadyShowed) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG);
}
} else {

View file

@ -85,7 +85,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter
if (mCard.getPauseBeforePIN2() > 0 && (mCard.useDefaultPIN2() || !mCard.useSmartSecurityDelay())) {
ivPIN2orSecurityDelay.setImageResource(R.drawable.timer);
ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(EmptyWalletActivity.this, String.format("This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code", mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show());
ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(EmptyWalletActivity.this, String.format(getString(R.string.this_banknote_will_enforce), mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show());
} else if (mCard.useDefaultPIN2()) {
ivPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2);
@ -232,7 +232,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter
progressBar.post(() -> {
lastReadSuccess = false;
if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allreadyShowed) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG);
}
} else {

View file

@ -179,7 +179,7 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade
purgeTask = new PurgeTask(this, mCard, mNfcManager, isoDep, this);
purgeTask.start();
} else {
Log.d(TAG, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")");
// Log.d(TAG, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")");
mNfcManager.ignoreTag(isoDep.getTag());
return;
}
@ -252,7 +252,7 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade
} else {
progressBar.post(() -> {
if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allreadyShowed) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG);
}
} else

View file

@ -7,7 +7,6 @@ import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.google.zxing.Result;
@ -22,7 +21,7 @@ public class QRScanActivity extends AppCompatActivity implements ZXingScannerVie
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_qrscan);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
Log.e("QRScanActivity", "User hasn't granted permission to use camera");
// Log.e("QRScanActivity", "User hasn't granted permission to use camera");
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1);
} else {
runScanner();
@ -44,13 +43,13 @@ public class QRScanActivity extends AppCompatActivity implements ZXingScannerVie
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Log.i("QRScanActivity", "permission was granted");
// Log.i("QRScanActivity", "permission was granted");
// permission was granted, yay! Do the
// contacts-related task you need to do.
runScanner();
} else {
Log.e("QRScanActivity", "permission denied");
// Log.e("QRScanActivity", "permission denied");
setResult(Activity.RESULT_CANCELED);
finish();

File diff suppressed because one or more lines are too long

View file

@ -110,91 +110,6 @@ public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.Rea
super.onStop();
}
// private class SwapPINTask extends Thread {
//
// IsoDep mIsoDep;
// CardProtocol.Notifications mNotifications;
// private boolean isCancelled = false;
//
// SwapPINTask(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("SwapTask", "[-- Start swap pin --]");
//
// if (isCancelled) return;
//
// if (mCard.getPauseBeforePIN2() > 0) {
// mNotifications.OnReadWait(mCard.getPauseBeforePIN2());
// }
//
//// try {
// protocol.run_SwapPIN(PINStorage.getPIN2(), newPIN, newPIN2, false);
// protocol.setPIN(newPIN);
// mCard.setPIN(newPIN);
//// } finally {
//// mNotifications.OnReadWait(0);
//// }
//
// mNotifications.OnReadProgress(protocol, 50);
//
// protocol.run_Read();
//
// mNotifications.OnReadProgress(protocol, 100);
//
// } finally {
// mNfcManager.ignoreTag(mIsoDep.getTag());
// }
// } catch (Exception e) {
// e.printStackTrace();
// protocol.setError(e);
//
// } finally {
// Log.i("SwapPINTask", "[-- 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();
// }
// }
//
// }
public void OnReadStart(CardProtocol cardProtocol) {
progressBar.post(() -> {
progressBar.setVisibility(View.VISIBLE);
@ -242,7 +157,7 @@ public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.Rea
progressBar.post(() -> {
if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allreadyShowed) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG);
}
} else {

View file

@ -11,7 +11,7 @@ import com.tangem.wallet.R;
public class NoExtendedLengthSupportDialog extends DialogFragment {
public static final String TAG = NoExtendedLengthSupportDialog.class.getSimpleName();
public static boolean allreadyShowed = false;
public static boolean allReadyShowed = false;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@ -19,7 +19,7 @@ public class NoExtendedLengthSupportDialog extends DialogFragment {
.setIcon(R.drawable.tangem_logo_small_new)
.setTitle(R.string.warning)
.setMessage(R.string.the_nfc_adapter_length_apdu)
.setPositiveButton(R.string.got_it, (dialog, whichButton) -> NoExtendedLengthSupportDialog.allreadyShowed = true)
.setPositiveButton(R.string.got_it, (dialog, whichButton) -> NoExtendedLengthSupportDialog.allReadyShowed = true)
.create();
}

View file

@ -537,7 +537,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
rlProgressBar.post {
lastReadSuccess = false
if (cardProtocol.error is CardProtocol.TangemException_ExtendedLengthNotSupported)
if (!NoExtendedLengthSupportDialog.allreadyShowed)
if (!NoExtendedLengthSupportDialog.allReadyShowed)
NoExtendedLengthSupportDialog().show(activity!!.fragmentManager, NoExtendedLengthSupportDialog.TAG)
else
Toast.makeText(context, R.string.try_to_scan_again, Toast.LENGTH_SHORT).show()
@ -674,7 +674,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
if (mCard!!.pauseBeforePIN2 > 0 && (mCard!!.useDefaultPIN2()!! || !mCard!!.useSmartSecurityDelay())) {
ivPIN2orSecurityDelay.setImageResource(R.drawable.timer)
ivPIN2orSecurityDelay.setOnClickListener { Toast.makeText(context, String.format("This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code", mCard!!.pauseBeforePIN2 / 1000.0), Toast.LENGTH_LONG).show() }
ivPIN2orSecurityDelay.setOnClickListener { Toast.makeText(context, String.format(getString(R.string.this_banknote_will_enforce), mCard!!.pauseBeforePIN2 / 1000.0), Toast.LENGTH_LONG).show()}
} else if (mCard!!.useDefaultPIN2()!!) {
ivPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2)
@ -691,7 +691,6 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
} else
ivDeveloperVersion.visibility = View.INVISIBLE
btnExtract!!.isEnabled = mCard!!.hasBalanceInfo()
tvIssuer.text = mCard!!.issuerDescription

View file

@ -316,7 +316,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
doEnterPIN();
} else {
if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allreadyShowed) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
new NoExtendedLengthSupportDialog().show(Objects.requireNonNull(getActivity()).getFragmentManager(), NoExtendedLengthSupportDialog.TAG);
}
}

View file

@ -436,7 +436,7 @@ public class VerifyCard extends Fragment implements NfcAdapter.ReaderCallback {
if (mCard.getPauseBeforePIN2() > 0 && (mCard.useDefaultPIN2() || !mCard.useSmartSecurityDelay())) {
ivPIN2orSecurityDelay.setImageResource(R.drawable.timer);
ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(getContext(), String.format("This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code", mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show());
ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(getContext(), String.format(getString(R.string.this_banknote_will_enforce), mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show());
} else if (mCard.useDefaultPIN2()) {
ivPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2);
ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(getContext(), R.string.this_banknote_protected_default_PIN2_code, Toast.LENGTH_LONG).show());