Updated on 2026-08-14

This commit is contained in:
Tangem 2018-08-08 16:20:27 +03:00
parent 2b6b129096
commit 57a20d3cfc
15 changed files with 128 additions and 130 deletions

View file

@ -15,7 +15,7 @@ android {
applicationId "com.tangem.wallet"
minSdkVersion 21
targetSdkVersion 27
versionCode 53
versionCode 54
versionName "0.88.1." + generateVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -40,19 +40,19 @@ import javax.crypto.KeyAgreement;
public class CardProtocol {
public interface Notifications {
void OnReadStart(CardProtocol cardProtocol);
void onReadStart(CardProtocol cardProtocol);
void OnReadProgress(CardProtocol cardProtocol, int progress);
void onReadProgress(CardProtocol cardProtocol, int progress);
void OnReadFinish(CardProtocol cardProtocol);
void onReadFinish(CardProtocol cardProtocol);
void OnReadCancel();
void onReadCancel();
void OnReadWait(int msec);
void onReadWait(int msec);
void OnReadBeforeRequest(int timeout);
void onReadBeforeRequest(int timeout);
void OnReadAfterRequest();
void onReadAfterRequest();
}
public void setError(Exception error) {
@ -137,7 +137,6 @@ public class CardProtocol {
}
}
public byte[] GetUID() {
if (mIsoDep == null || mIsoDep.getTag() == null) return null;
return mIsoDep.getTag().getId();
@ -296,11 +295,11 @@ public class CardProtocol {
// try {
// do {
// try {
// mNotifications.OnReadBeforeRequest(mIsoDep.getTimeout());
// mNotifications.onReadBeforeRequest(mIsoDep.getTimeout());
// try {
// rsp = mIsoDep.transceive(cmdBytes);
// } finally {
// mNotifications.OnReadAfterRequest();
// mNotifications.onReadAfterRequest();
// }
// } catch (IOException e) {
// if (e.getMessage().contains("length exceeds supported maximum") && mIsoDep.isExtendedLengthApduSupported()) {
@ -323,14 +322,14 @@ public class CardProtocol {
// if (breakOnNeedPause) {
// break;
// } else {
// mNotifications.OnReadWait(remainingPause);
// mNotifications.onReadWait(remainingPause);
// }
// } else {
// Log.v("NFC", String.format(">> [%s]: %s", cmdApdu.getCommandName(), Util.bytesToHex(rsp)));
// }
// } while (rspApdu.getSW1SW2() == SW.NEED_PAUSE);
// } finally {
// mNotifications.OnReadWait(0);
// mNotifications.onReadWait(0);
// }
//
// return rspApdu;
@ -352,11 +351,11 @@ public class CardProtocol {
try {
do {
try {
mNotifications.OnReadBeforeRequest(mIsoDep.getTimeout());
mNotifications.onReadBeforeRequest(mIsoDep.getTimeout());
try {
rsp = mIsoDep.transceive(cmdBytes);
} finally {
mNotifications.OnReadAfterRequest();
mNotifications.onReadAfterRequest();
}
} catch (IOException e) {
if (e.getMessage().contains("length exceeds supported maximum") && mIsoDep.isExtendedLengthApduSupported()) {
@ -384,14 +383,14 @@ public class CardProtocol {
if (breakOnNeedPause) {
break;
} else {
mNotifications.OnReadWait(remainingPause);
mNotifications.onReadWait(remainingPause);
}
} else {
Log.v("NFC", String.format(">> [%s]: %s", cmdApdu.getCommandName(), Util.bytesToHex(rsp)));
}
} while (rspApdu.getSW1SW2() == SW.NEED_PAUSE);
} finally {
mNotifications.OnReadWait(0);
mNotifications.onReadWait(0);
}
return rspApdu;
@ -410,6 +409,7 @@ public class CardProtocol {
public void run_Read() throws Exception {
run_Read(true);
}
public void run_Read(boolean parseResult) throws Exception {
CommandApdu rqApdu = StartPrepareCommand(INS.Read);
Log.i(logTag, String.format("[%s]\n%s", rqApdu.getCommandName(), rqApdu.getTLVs().getParsedTLVs(" ")));
@ -424,10 +424,10 @@ public class CardProtocol {
readResult = rspApdu.getTLVs();
if( parseResult ){
if (parseResult) {
parseReadResult();
run_ReadWriteIssuerData();
}else{
} else {
//TODO: проверить что карта та же
}
@ -470,9 +470,9 @@ public class CardProtocol {
// try read denomination
if (tlvIssuerData != null && tlvIssuerData.getTLV(TLV.Tag.TAG_Denomination) != null) {
if(tlvIssuerData.getTLV(TLV.Tag.TAG_DenominationText) != null) {
if (tlvIssuerData.getTLV(TLV.Tag.TAG_DenominationText) != null) {
mCard.setDenomination(tlvIssuerData.getTLV(TLV.Tag.TAG_Denomination).Value, tlvIssuerData.getTLV(TLV.Tag.TAG_DenominationText).getAsString());
}else{
} else {
mCard.setDenomination(tlvIssuerData.getTLV(TLV.Tag.TAG_Denomination).Value);
}
} else {
@ -625,7 +625,6 @@ public class CardProtocol {
}
}
public TLVList run_VerifyCard() throws Exception {
if (mCard.getCardPublicKey() == null || readResult == null) {
run_Read();
@ -986,7 +985,7 @@ public class CardProtocol {
TLV issuerDataSignature = rspApdu.getTLVs().getTLV(TLV.Tag.TAG_Issuer_Data_Signature);
TLV issuerDataCounter = rspApdu.getTLVs().getTLV(TLV.Tag.TAG_Issuer_Data_Counter);
boolean protectIssuerDataAgainstReplay=(readResult.getTagAsInt(TLV.Tag.TAG_SettingsMask)&SettingsMask.ProtectIssuerDataAgainstReplay)!=0;
boolean protectIssuerDataAgainstReplay = (readResult.getTagAsInt(TLV.Tag.TAG_SettingsMask) & SettingsMask.ProtectIssuerDataAgainstReplay) != 0;
if (issuerData == null || issuerDataSignature == null)
throw new TangemException("Invalid answer format (GetIssuerData)");
@ -994,7 +993,7 @@ public class CardProtocol {
ByteArrayOutputStream bsDataToVerify = new ByteArrayOutputStream();
bsDataToVerify.write(mCard.getCID());
bsDataToVerify.write(issuerData.Value);
if( protectIssuerDataAgainstReplay ) {
if (protectIssuerDataAgainstReplay) {
bsDataToVerify.write(issuerDataCounter.Value);
}
try {
@ -1040,4 +1039,4 @@ public class CardProtocol {
} while (true);
}
}
}

View file

@ -103,14 +103,14 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
super.onStop()
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
}
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadFinish(cardProtocol: CardProtocol?) {
createNewWalletTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
@ -172,11 +172,11 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
}, 500)
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
}
override fun OnReadCancel() {
override fun onReadCancel() {
createNewWalletTask = null
@ -191,15 +191,15 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
}, 500)
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(this, msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(this)
}

View file

@ -167,14 +167,14 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
}
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadFinish(cardProtocol: CardProtocol?) {
verifyCardTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
@ -215,11 +215,11 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}, 500)
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
}
override fun OnReadCancel() {
override fun onReadCancel() {
verifyCardTask = null
progressBar!!.postDelayed({
try {
@ -232,15 +232,15 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}, 500)
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(this, msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(this)
}

View file

@ -265,15 +265,15 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
super.onStop()
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
rlProgressBar.post { rlProgressBar.visibility = View.VISIBLE }
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadFinish(cardProtocol: CardProtocol?) {
readCardInfoTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
@ -341,7 +341,7 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
}, 500)
}
override fun OnReadCancel() {
override fun onReadCancel() {
readCardInfoTask = null
ReadCardInfoTask.resetLastReadInfo()
rlProgressBar.postDelayed({
@ -353,15 +353,15 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
}, 500)
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(Objects.requireNonNull(this), msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(Objects.requireNonNull(this), timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(Objects.requireNonNull(this))
}

View file

@ -104,14 +104,14 @@ class PinSwapActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProt
super.onStop()
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
}
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadFinish(cardProtocol: CardProtocol?) {
swapPinTask = null
if (cardProtocol != null) {
@ -171,11 +171,11 @@ class PinSwapActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProt
}
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
}
override fun OnReadCancel() {
override fun onReadCancel() {
swapPinTask = null
progressBar!!.postDelayed({
@ -189,15 +189,15 @@ class PinSwapActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProt
}, 500)
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(this, msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(this)
}

View file

@ -96,26 +96,26 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
}
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(this, msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(this)
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
}
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadFinish(cardProtocol: CardProtocol?) {
purgeTask = null
if (cardProtocol != null) {
@ -176,11 +176,11 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
}, 500)
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
}
override fun OnReadCancel() {
override fun onReadCancel() {
purgeTask = null
progressBar!!.postDelayed({
try {

View file

@ -135,14 +135,18 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
return super.onKeyDown(keyCode, event)
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
}
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
}
override fun onReadFinish(cardProtocol: CardProtocol?) {
signPaymentTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
@ -199,11 +203,7 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}, 500)
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
}
override fun OnReadCancel() {
override fun onReadCancel() {
signPaymentTask = null
progressBar!!.postDelayed({
@ -217,15 +217,15 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}, 500)
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(this, msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(this)
}

View file

@ -516,11 +516,15 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
return data
}
override fun OnReadStart(cardProtocol: CardProtocol) {
override fun onReadStart(cardProtocol: CardProtocol) {
rlProgressBar.post { rlProgressBar.visibility = View.VISIBLE }
}
override fun OnReadFinish(cardProtocol: CardProtocol?) {
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
}
override fun onReadFinish(cardProtocol: CardProtocol?) {
verifyCardTask = null
if (cardProtocol != null) {
@ -552,11 +556,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}, 500)
}
override fun OnReadProgress(protocol: CardProtocol, progress: Int) {
}
override fun OnReadCancel() {
override fun onReadCancel() {
verifyCardTask = null
rlProgressBar.postDelayed({
try {
@ -567,15 +567,15 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}, 500)
}
override fun OnReadWait(msec: Int) {
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.OnReadWait(activity!!, msec)
}
override fun OnReadBeforeRequest(timeout: Int) {
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(activity!!, timeout)
}
override fun OnReadAfterRequest() {
override fun onReadAfterRequest() {
WaitSecurityDelayDialog.onReadAfterRequest(activity!!)
}