Updated on 2026-08-14

This commit is contained in:
Tangem 2018-10-18 18:06:54 +03:00
commit 018ee9e91d
8 changed files with 35 additions and 14 deletions

View file

@ -15,6 +15,8 @@ import com.tangem.presentation.activity.SendTransactionActivity;
import com.tangem.presentation.activity.SignPaymentActivity;
import com.tangem.util.BTCUtils;
import java.io.IOException;
public class SignPaymentTask extends Thread {
public static final String TAG = SignPaymentTask.class.getSimpleName();
@ -90,13 +92,16 @@ public class SignPaymentTask extends Thread {
mNotifications.onReadWait(mCard.getPauseBeforePIN2());
}
byte[] tx;
// try {
tx = engine.sign(txFee, txAmount, txIncFee, txOutAddress, mCard, protocol);
// }
// finally {
// mNotifications.onReadWait(0);
// }
byte[] tx = null;
try {
tx = engine.sign(txFee, txAmount, txIncFee, txOutAddress, mCard, protocol);
}
catch (IOException e) {
e.printStackTrace();
protocol.setError(e);
} finally {
mNotifications.onReadWait(0);
}
if (tx != null) {
String txStr = BTCUtils.toHex(tx);

View file

@ -307,7 +307,7 @@ public class CardProtocol {
mNotifications.onReadAfterRequest();
}
} catch (IOException e) {
if (e.getMessage().contains("length exceeds supported maximum") && mIsoDep.isExtendedLengthApduSupported()) {
if (e.getMessage().contains("length")) {
throw new TangemException_ExtendedLengthNotSupported(e.getMessage());
}
throw e;

View file

@ -96,7 +96,7 @@ public class EthEngine extends CoinEngine {
BigDecimal d = convertToEth(dec);
String s = d.toString();
String pattern = "#0.000###############"; // If you like 4 zeros
String pattern = "#0.##################"; // If you like 4 zeros
DecimalFormat myFormatter = new DecimalFormat(pattern);
String output = myFormatter.format(d);
return output;

View file

@ -101,7 +101,7 @@ public class TokenEngine extends CoinEngine {
BigDecimal d = convertToEth(dec);
String s = d.toString();
String pattern = "#0.000###############"; // If you like 4 zeros
String pattern = "#0.##################"; // If you like 4 zeros
DecimalFormat myFormatter = new DecimalFormat(pattern);
String output = myFormatter.format(d);
return output;
@ -128,7 +128,7 @@ public class TokenEngine extends CoinEngine {
p = p.pow(getTokenDecimals(mCard));
BigDecimal l = d.divide(p);
String pattern = "#0.000###############"; // If you like 4 zeros
String pattern = "#0.##################"; // If you like 4 zeros
DecimalFormat myFormatter = new DecimalFormat(pattern);
String output = myFormatter.format(l);
return output;

View file

@ -22,6 +22,8 @@ import com.tangem.presentation.dialog.WaitSecurityDelayDialog
import com.tangem.util.Util
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_sign_payment.*
import kotlinx.android.synthetic.main.notification_template_lines_media.*
import java.io.IOException
class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
@ -194,6 +196,7 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
progressBar!!.post {
if (cardProtocol.error is CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
NoExtendedLengthSupportDialog.message = getText(R.string.the_nfc_adapter_length_apdu).toString() + "\n" + getText(R.string.the_nfc_adapter_length_apdu_advice).toString()
NoExtendedLengthSupportDialog().show(fragmentManager, NoExtendedLengthSupportDialog.TAG)
}
} else {

View file

@ -12,14 +12,15 @@ class NoExtendedLengthSupportDialog : DialogFragment() {
companion object {
val TAG: String = NoExtendedLengthSupportDialog::class.java.simpleName
var allReadyShowed = false
var message = ""// = R.string.the_nfc_adapter_length_apdu
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(activity)
.setIcon(R.drawable.tangem_logo_small_new)
.setTitle(R.string.warning)
.setMessage(R.string.the_nfc_adapter_length_apdu)
.setPositiveButton(R.string.got_it) { _, _ -> NoExtendedLengthSupportDialog.allReadyShowed = true }
.setMessage(message)
.setPositiveButton(R.string.got_it) { _, _ -> NoExtendedLengthSupportDialog.allReadyShowed = false }
.create()
}

View file

@ -14,6 +14,7 @@ import android.view.ViewGroup
import android.widget.PopupMenu
import android.widget.Toast
import com.tangem.domain.cardReader.NfcManager
import com.tangem.domain.wallet.Blockchain
import com.tangem.domain.wallet.CoinEngineFactory
import com.tangem.domain.wallet.PINStorage
import com.tangem.domain.wallet.TangemCard
@ -297,6 +298,16 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
tvValidationNode.text = card!!.validationNodeDescription
if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet || card!!.blockchain == Blockchain.BitcoinCash || card!!.blockchain == Blockchain.BitcoinCashTestNet) {
var gatheredUnspents = 0
for (i in 0 until card!!.unspentTransactions.size) {
if (card!!.unspentTransactions[i].Raw.length > 1) gatheredUnspents++
}
tvInputs.text = card!!.unspentTransactions.size.toString() + " unspents (" + gatheredUnspents.toString() + " recieved)"
}
else
tvInputs.text = ""
ivBlockchain.setImageResource(card!!.blockchain.getLogoImageResource(card!!.blockchainID, card!!.tokenSymbol))
if (card!!.isReusable!!)