Updated on 2026-08-14
This commit is contained in:
commit
018ee9e91d
8 changed files with 35 additions and 14 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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!!)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@
|
|||
<string name="got_it">Got it</string>
|
||||
<string name="warning">Warning</string>
|
||||
<string name="security_delay">Security delay</string>
|
||||
<string name="the_nfc_adapter_length_apdu">The NFC adapter of the device does not support extended length APDU, it\'s possible that some functions will not work!</string>
|
||||
<string name="the_nfc_adapter_length_apdu">Oops.. It seems your smartphone does not support such long NFC packets.</string>
|
||||
<string name="the_nfc_adapter_length_apdu_advice">Try sending smaller amount or use a smartphone with full NFC support.</string>
|
||||
<string name="your_money_is_at_risk">Your money is at risk!</string>
|
||||
<string name="this_banknote_has_enforced_security_delay">This banknote has enforced security delay</string>
|
||||
<string name="please_hold_banknote">Please hold the banknote firmly\n until the operation is completed…</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue