Updated on 2026-08-14
This commit is contained in:
parent
2b6b129096
commit
57a20d3cfc
15 changed files with 128 additions and 130 deletions
|
|
@ -33,7 +33,7 @@ public class CreateNewWalletTask extends Thread {
|
|||
return;
|
||||
}
|
||||
CardProtocol protocol = new CardProtocol(mContext, mIsoDep, mCard, mNotifications);
|
||||
mNotifications.OnReadStart(protocol);
|
||||
mNotifications.onReadStart(protocol);
|
||||
try {
|
||||
// for Samsung's bugs -
|
||||
// Workaround for the Samsung Galaxy S5 (since the
|
||||
|
|
@ -44,7 +44,7 @@ public class CreateNewWalletTask extends Thread {
|
|||
mIsoDep.connect();
|
||||
mIsoDep.setTimeout(timeout);
|
||||
try {
|
||||
mNotifications.OnReadProgress(protocol, 5);
|
||||
mNotifications.onReadProgress(protocol, 5);
|
||||
|
||||
Log.i(TAG, "[-- Start create new wallet --]");
|
||||
|
||||
|
|
@ -53,18 +53,18 @@ public class CreateNewWalletTask extends Thread {
|
|||
|
||||
Log.i(TAG, "Manufacturer: " + protocol.getCard().getManufacturer().getOfficialName());
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 30);
|
||||
mNotifications.onReadProgress(protocol, 30);
|
||||
if (isCancelled) return;
|
||||
|
||||
// if (mCard.getPauseBeforePIN2() > 0) {
|
||||
// mNotifications.OnReadWait(mCard.getPauseBeforePIN2());
|
||||
// mNotifications.onReadWait(mCard.getPauseBeforePIN2());
|
||||
// }
|
||||
// try {
|
||||
protocol.run_CreateWallet(PINStorage.getPIN2());
|
||||
// } finally {
|
||||
// mNotifications.OnReadWait(0);
|
||||
// mNotifications.onReadWait(0);
|
||||
// }
|
||||
mNotifications.OnReadProgress(protocol, 60);
|
||||
mNotifications.onReadProgress(protocol, 60);
|
||||
if (isCancelled) return;
|
||||
|
||||
protocol.run_Read();
|
||||
|
|
@ -78,7 +78,7 @@ public class CreateNewWalletTask extends Thread {
|
|||
|
||||
} finally {
|
||||
Log.i(TAG, "[-- Finish create new wallet --]");
|
||||
mNotifications.OnReadFinish(protocol);
|
||||
mNotifications.onReadFinish(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public class CreateNewWalletTask extends Thread {
|
|||
}
|
||||
if (isAlive() && AllowInterrupt) {
|
||||
interrupt();
|
||||
mNotifications.OnReadCancel();
|
||||
mNotifications.onReadCancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class PurgeTask extends Thread {
|
|||
}
|
||||
CardProtocol protocol = new CardProtocol(mContext, mIsoDep, mCard, mNotifications);
|
||||
|
||||
mNotifications.OnReadStart(protocol);
|
||||
mNotifications.onReadStart(protocol);
|
||||
try {
|
||||
|
||||
// for Samsung's bugs - Workaround for the Samsung Galaxy S5 (since the first connection always hangs on transceive).
|
||||
|
|
@ -45,34 +45,34 @@ public class PurgeTask extends Thread {
|
|||
mIsoDep.connect();
|
||||
mIsoDep.setTimeout(timeout);
|
||||
try {
|
||||
mNotifications.OnReadProgress(protocol, 5);
|
||||
mNotifications.onReadProgress(protocol, 5);
|
||||
|
||||
Log.i(TAG, "[-- Start purge --]");
|
||||
|
||||
if (isCancelled) return;
|
||||
|
||||
if (mCard.getPauseBeforePIN2() > 0) {
|
||||
mNotifications.OnReadWait(mCard.getPauseBeforePIN2());
|
||||
mNotifications.onReadWait(mCard.getPauseBeforePIN2());
|
||||
}
|
||||
|
||||
// try {
|
||||
protocol.run_PurgeWallet(PINStorage.getPIN2());
|
||||
// } finally {
|
||||
// mNotifications.OnReadWait(0);
|
||||
// mNotifications.onReadWait(0);
|
||||
// }
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 50);
|
||||
mNotifications.onReadProgress(protocol, 50);
|
||||
|
||||
protocol.run_Read();
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 100);
|
||||
mNotifications.onReadProgress(protocol, 100);
|
||||
|
||||
if (isCancelled)
|
||||
return;
|
||||
|
||||
} finally {
|
||||
mNfcManager.ignoreTag(mIsoDep.getTag());
|
||||
mNotifications.OnReadWait(0);
|
||||
mNotifications.onReadWait(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -80,7 +80,7 @@ public class PurgeTask extends Thread {
|
|||
|
||||
} finally {
|
||||
Log.i(TAG, "[-- Finish purge --]");
|
||||
mNotifications.OnReadFinish(protocol);
|
||||
mNotifications.onReadFinish(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ public class PurgeTask extends Thread {
|
|||
}
|
||||
if (isAlive() && AllowInterrupt) {
|
||||
interrupt();
|
||||
mNotifications.OnReadCancel();
|
||||
mNotifications.onReadCancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ public class ReadCardInfoTask extends Thread {
|
|||
mIsoDep.setTimeout(timeout);
|
||||
try {
|
||||
CardProtocol protocol = new CardProtocol(mContext, mIsoDep, mNotifications);
|
||||
mNotifications.OnReadStart(protocol);
|
||||
mNotifications.onReadStart(protocol);
|
||||
try {
|
||||
mNotifications.OnReadProgress(protocol, 5);
|
||||
mNotifications.onReadProgress(protocol, 5);
|
||||
|
||||
byte[] UID = mIsoDep.getTag().getId();
|
||||
String sUID = Util.byteArrayToHexString(UID);
|
||||
|
|
@ -85,7 +85,7 @@ public class ReadCardInfoTask extends Thread {
|
|||
//already have read result (obtained while get supported encryption), only read issuer data and define offline balance
|
||||
protocol.parseReadResult();
|
||||
protocol.run_ReadWriteIssuerData();
|
||||
mNotifications.OnReadProgress(protocol, 60);
|
||||
mNotifications.onReadProgress(protocol, 60);
|
||||
PINStorage.setLastUsedPIN(protocol.getCard().getPIN());
|
||||
} else {
|
||||
//don't have read result - may be don't get supported encryption on this try, need encryption or need another PIN
|
||||
|
|
@ -121,7 +121,7 @@ public class ReadCardInfoTask extends Thread {
|
|||
protocol.CreateProtocolKey();
|
||||
}
|
||||
protocol.run_Read();
|
||||
mNotifications.OnReadProgress(protocol, 60);
|
||||
mNotifications.onReadProgress(protocol, 60);
|
||||
PINStorage.setLastUsedPIN(PIN);
|
||||
pinFound = true;
|
||||
protocol.getCard().setPIN(PIN);
|
||||
|
|
@ -144,7 +144,7 @@ public class ReadCardInfoTask extends Thread {
|
|||
|
||||
} finally {
|
||||
Log.i(TAG, "[-- Finish read card info --]");
|
||||
mNotifications.OnReadFinish(protocol);
|
||||
mNotifications.onReadFinish(protocol);
|
||||
}
|
||||
} finally {
|
||||
mNfcManager.ignoreTag(mIsoDep.getTag());
|
||||
|
|
@ -163,7 +163,7 @@ public class ReadCardInfoTask extends Thread {
|
|||
}
|
||||
if (isAlive() && AllowInterrupt) {
|
||||
interrupt();
|
||||
mNotifications.OnReadCancel();
|
||||
mNotifications.onReadCancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.tangem.domain.cardReader.NfcManager;
|
|||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.domain.wallet.LastSignStorage;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.presentation.activity.SendTransactionActivity;
|
||||
import com.tangem.presentation.activity.SignPaymentActivity;
|
||||
|
|
@ -52,7 +51,7 @@ public class SignPaymentTask extends Thread {
|
|||
}
|
||||
CardProtocol protocol = new CardProtocol(mContext, mIsoDep, mCard, mNotifications);
|
||||
|
||||
mNotifications.OnReadStart(protocol);
|
||||
mNotifications.onReadStart(protocol);
|
||||
try {
|
||||
|
||||
// for Samsung's bugs -
|
||||
|
|
@ -64,7 +63,7 @@ public class SignPaymentTask extends Thread {
|
|||
mIsoDep.connect();
|
||||
mIsoDep.setTimeout(timeout);
|
||||
try {
|
||||
mNotifications.OnReadProgress(protocol, 5);
|
||||
mNotifications.onReadProgress(protocol, 5);
|
||||
|
||||
Log.i(TAG, "[-- Start sign payment --]");
|
||||
|
||||
|
|
@ -74,7 +73,7 @@ public class SignPaymentTask extends Thread {
|
|||
|
||||
Log.i(TAG, "Manufacturer: " + protocol.getCard().getManufacturer().getOfficialName());
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 30);
|
||||
mNotifications.onReadProgress(protocol, 30);
|
||||
if (isCancelled) return;
|
||||
//
|
||||
// if (mCard.getBlockchain() == Blockchain.Ethereum) {
|
||||
|
|
@ -86,7 +85,7 @@ public class SignPaymentTask extends Thread {
|
|||
CoinEngine engine = CoinEngineFactory.Create(mCard.getBlockchain());
|
||||
if (engine != null) {
|
||||
if (mCard.getPauseBeforePIN2() > 0) {
|
||||
mNotifications.OnReadWait(mCard.getPauseBeforePIN2());
|
||||
mNotifications.onReadWait(mCard.getPauseBeforePIN2());
|
||||
}
|
||||
|
||||
byte[] tx;
|
||||
|
|
@ -94,7 +93,7 @@ public class SignPaymentTask extends Thread {
|
|||
tx = engine.Sign(txFee, txAmount, txOutAddress, mCard, protocol);
|
||||
// }
|
||||
// finally {
|
||||
// mNotifications.OnReadWait(0);
|
||||
// mNotifications.onReadWait(0);
|
||||
// }
|
||||
|
||||
if (tx != null) {
|
||||
|
|
@ -112,14 +111,14 @@ public class SignPaymentTask extends Thread {
|
|||
mContext.startActivityForResult(intent, SignPaymentActivity.REQUEST_CODE_SEND_PAYMENT);
|
||||
}
|
||||
}
|
||||
mNotifications.OnReadProgress(protocol, 100);
|
||||
mNotifications.onReadProgress(protocol, 100);
|
||||
|
||||
|
||||
if (isCancelled) return;
|
||||
|
||||
} finally {
|
||||
mNfcManager.ignoreTag(mIsoDep.getTag());
|
||||
mNotifications.OnReadWait(0);
|
||||
mNotifications.onReadWait(0);
|
||||
}
|
||||
} catch (CardProtocol.TangemException_InvalidPIN e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -130,7 +129,7 @@ public class SignPaymentTask extends Thread {
|
|||
|
||||
} finally {
|
||||
Log.i(TAG, "[-- Finish sign payment --]");
|
||||
mNotifications.OnReadFinish(protocol);
|
||||
mNotifications.onReadFinish(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +141,7 @@ public class SignPaymentTask extends Thread {
|
|||
}
|
||||
if (isAlive() && AllowInterrupt) {
|
||||
interrupt();
|
||||
mNotifications.OnReadCancel();
|
||||
mNotifications.onReadCancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class SwapPINTask extends Thread {
|
|||
}
|
||||
CardProtocol protocol = new CardProtocol(mContext, mIsoDep, mCard, mNotifications);
|
||||
|
||||
mNotifications.OnReadStart(protocol);
|
||||
mNotifications.onReadStart(protocol);
|
||||
try {
|
||||
|
||||
// for Samsung's bugs -
|
||||
|
|
@ -50,14 +50,14 @@ public class SwapPINTask extends Thread {
|
|||
mIsoDep.setTimeout(timeout);
|
||||
try {
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 5);
|
||||
mNotifications.onReadProgress(protocol, 5);
|
||||
|
||||
Log.i(TAG, "[-- Start swap pin --]");
|
||||
|
||||
if (isCancelled) return;
|
||||
|
||||
if (mCard.getPauseBeforePIN2() > 0) {
|
||||
mNotifications.OnReadWait(mCard.getPauseBeforePIN2());
|
||||
mNotifications.onReadWait(mCard.getPauseBeforePIN2());
|
||||
}
|
||||
|
||||
// try {
|
||||
|
|
@ -65,18 +65,18 @@ public class SwapPINTask extends Thread {
|
|||
protocol.setPIN(newPIN);
|
||||
mCard.setPIN(newPIN);
|
||||
// } finally {
|
||||
// mNotifications.OnReadWait(0);
|
||||
// mNotifications.onReadWait(0);
|
||||
// }
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 50);
|
||||
mNotifications.onReadProgress(protocol, 50);
|
||||
|
||||
protocol.run_Read();
|
||||
|
||||
mNotifications.OnReadProgress(protocol, 100);
|
||||
mNotifications.onReadProgress(protocol, 100);
|
||||
|
||||
} finally {
|
||||
mNfcManager.ignoreTag(mIsoDep.getTag());
|
||||
mNotifications.OnReadWait(0);
|
||||
mNotifications.onReadWait(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -84,7 +84,7 @@ public class SwapPINTask extends Thread {
|
|||
|
||||
} finally {
|
||||
Log.i(TAG, "[-- Finish purge --]");
|
||||
mNotifications.OnReadFinish(protocol);
|
||||
mNotifications.onReadFinish(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ public class SwapPINTask extends Thread {
|
|||
}
|
||||
if (isAlive() && AllowInterrupt) {
|
||||
interrupt();
|
||||
mNotifications.OnReadCancel();
|
||||
mNotifications.onReadCancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ public class VerifyCardTask extends Thread {
|
|||
mIsoDep.setTimeout(timeout);
|
||||
try {
|
||||
CardProtocol protocol = new CardProtocol(mContext, mIsoDep, mCard, mNotifications);
|
||||
mNotifications.OnReadStart(protocol);
|
||||
mNotifications.onReadStart(protocol);
|
||||
try {
|
||||
mNotifications.OnReadProgress(protocol, 5);
|
||||
mNotifications.onReadProgress(protocol, 5);
|
||||
|
||||
Log.i(TAG, "[-- Start verify card --]");
|
||||
|
||||
|
|
@ -62,15 +62,15 @@ public class VerifyCardTask extends Thread {
|
|||
protocol.setPIN(PIN);
|
||||
protocol.run_Read(false);
|
||||
PINStorage.setLastUsedPIN(PIN);
|
||||
mNotifications.OnReadProgress(protocol, 20);
|
||||
mNotifications.onReadProgress(protocol, 20);
|
||||
if (isCancelled) return;
|
||||
protocol.run_VerifyCard();
|
||||
mNotifications.OnReadProgress(protocol, 50);
|
||||
mNotifications.onReadProgress(protocol, 50);
|
||||
Log.i(TAG, "Manufacturer: " + protocol.getCard().getManufacturer().getOfficialName());
|
||||
if (isCancelled) return;
|
||||
if (protocol.getCard().getStatus() == TangemCard.Status.Loaded) {
|
||||
protocol.run_CheckWalletWithSignatureVerify();
|
||||
mNotifications.OnReadProgress(protocol, 80);
|
||||
mNotifications.onReadProgress(protocol, 80);
|
||||
}
|
||||
if (isCancelled) return;
|
||||
FW.VerifyCodeRecord record=FW.selectRandomVerifyCodeBlock(mCard.getFirmwareVersion());
|
||||
|
|
@ -81,14 +81,14 @@ public class VerifyCardTask extends Thread {
|
|||
}else{
|
||||
mCard.setCodeConfirmed(null);
|
||||
}
|
||||
mNotifications.OnReadProgress(protocol, 90);
|
||||
mNotifications.onReadProgress(protocol, 90);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
protocol.setError(e);
|
||||
|
||||
} finally {
|
||||
Log.i(TAG, "[-- Finish verify card --]");
|
||||
mNotifications.OnReadFinish(protocol);
|
||||
mNotifications.onReadFinish(protocol);
|
||||
}
|
||||
} finally {
|
||||
mNfcManager.ignoreTag(mIsoDep.getTag());
|
||||
|
|
@ -106,7 +106,7 @@ public class VerifyCardTask extends Thread {
|
|||
}
|
||||
if (isAlive() && AllowInterrupt) {
|
||||
interrupt();
|
||||
mNotifications.OnReadCancel();
|
||||
mNotifications.onReadCancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue