Updated on 2026-08-14
This commit is contained in:
commit
f0f0b54cc4
15 changed files with 167 additions and 170 deletions
|
|
@ -26,6 +26,8 @@ public class BalanceValidator {
|
|||
|
||||
public void Check(TangemCard card)
|
||||
{
|
||||
|
||||
|
||||
firstLine = "Verification failed";
|
||||
secondLine = "";
|
||||
|
||||
|
|
@ -36,6 +38,15 @@ public class BalanceValidator {
|
|||
secondLine = "Balance cannot be verified. Swipe down to refresh.";
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround before new back-end
|
||||
// if (!HasEverSigned(card)) {
|
||||
// firstLine = "Verified balance";
|
||||
// secondLine = "Balance confirmed in blockchain. ";
|
||||
// secondLine += "Verified note identity. ";
|
||||
// return;
|
||||
// }
|
||||
|
||||
// rule 2.a
|
||||
if(!VerificationWalletKey(card)) {
|
||||
score = 0;
|
||||
|
|
@ -89,13 +100,14 @@ public class BalanceValidator {
|
|||
}
|
||||
|
||||
// rule 4 TODO: need to check SignedHashed against number of outputs in blockchain
|
||||
if(HasEverSigned(card) && card.getBalance() != 0)
|
||||
{
|
||||
score = 80;
|
||||
firstLine = "Unguaranteed balance";
|
||||
secondLine = "Potential unsent transaction. Redeem immediately if accept. ";
|
||||
return;
|
||||
}
|
||||
// if(HasEverSigned(card) && card.getBalance() != 0)
|
||||
// {
|
||||
// score = 80;
|
||||
// firstLine = "Unguaranteed balance";
|
||||
// secondLine = "Potential unsent transaction. Redeem immediately if accept. ";
|
||||
// return;
|
||||
// }
|
||||
|
||||
// rule 7
|
||||
if(CheckOfflineBalance(card) && !CheckOnlineBalance(card) && !HasEverSigned(card) && card.getBalance() != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1537,26 +1537,36 @@ public class TangemCard {
|
|||
}
|
||||
|
||||
public int getCardImageResource() {
|
||||
switch (getBlockchainID()) {
|
||||
case "BTC":
|
||||
if (bytesToHex(getDenomination()).equals("40420F0000000000"))
|
||||
return R.drawable.card_btc001;
|
||||
else if (bytesToHex(getDenomination()).equals("404B4C0000000000"))
|
||||
return R.drawable.card_btc005;
|
||||
else if (bytesToHex(getDenomination()).equals("0000000000000000"))
|
||||
return R.drawable.card_btc_hk_s;
|
||||
else
|
||||
return R.drawable.card_default;
|
||||
|
||||
case "Token":
|
||||
if (getTokenSymbol().equals("SEED"))
|
||||
return R.drawable.card_seed;
|
||||
else
|
||||
return R.drawable.card_default;
|
||||
|
||||
default:
|
||||
return R.drawable.card_default;
|
||||
switch (getBatch()) {
|
||||
case "0004": case "0006": case "0010": return R.drawable.card_btc001;
|
||||
case "0005": case "0007": case "0011": return R.drawable.card_btc005;
|
||||
case "0012": return R.drawable.card_seed;
|
||||
case "0013": return R.drawable.card_btc_hk_s;
|
||||
case "0015": return R.drawable.card_default; //TODO: new BTC 0.00
|
||||
case "0016": return R.drawable.card_default; // TODO: new ETH 0.00
|
||||
default: return R.drawable.card_default;
|
||||
}
|
||||
// switch (getBlockchainID()) {
|
||||
// case "BTC":
|
||||
// if (bytesToHex(getDenomination()).equals("40420F0000000000"))
|
||||
// return R.drawable.card_btc001;
|
||||
// else if (bytesToHex(getDenomination()).equals("404B4C0000000000"))
|
||||
// return R.drawable.card_btc005;
|
||||
// else if (bytesToHex(getDenomination()).equals("0000000000000000"))
|
||||
// return R.drawable.card_btc_hk_s;
|
||||
// else
|
||||
// return R.drawable.card_default;
|
||||
//
|
||||
// case "Token":
|
||||
// if (getTokenSymbol().equals("SEED"))
|
||||
// return R.drawable.card_seed;
|
||||
// else
|
||||
// return R.drawable.card_default;
|
||||
//
|
||||
// default:
|
||||
// return R.drawable.card_default;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,21 +162,13 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
// set listeners
|
||||
srlLoadedWallet!!.setOnRefreshListener { this.refresh() }
|
||||
|
||||
ivLookup.setOnClickListener {
|
||||
btnLookup.setOnClickListener {
|
||||
val engineClick = CoinEngineFactory.Create(mCard!!.blockchain)
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, engineClick!!.getShareWalletURIExplorer(mCard))
|
||||
startActivity(browserIntent)
|
||||
}
|
||||
|
||||
tvLookup.setOnClickListener {
|
||||
val engineClick = CoinEngineFactory.Create(mCard!!.blockchain)
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, engineClick!!.getShareWalletURIExplorer(mCard))
|
||||
startActivity(browserIntent)
|
||||
}
|
||||
|
||||
ivCopy.setOnClickListener { doShareWallet(false) }
|
||||
|
||||
tvCopy.setOnClickListener { doShareWallet(false) }
|
||||
btnCopy.setOnClickListener { doShareWallet(false) }
|
||||
|
||||
tvWallet.setOnClickListener { doShareWallet(false) }
|
||||
|
||||
|
|
@ -192,26 +184,14 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
}
|
||||
}
|
||||
|
||||
fabInfo.setOnClickListener {
|
||||
btnDetails.setOnClickListener {
|
||||
if (mCardProtocol != null)
|
||||
openVerifyCard(mCardProtocol!!)
|
||||
else
|
||||
showSingleToast(R.string.need_attach_card_again)
|
||||
}
|
||||
|
||||
tvInfo.setOnClickListener {
|
||||
if (mCardProtocol != null)
|
||||
openVerifyCard(mCardProtocol!!)
|
||||
else
|
||||
showSingleToast(R.string.need_attach_card_again)
|
||||
}
|
||||
|
||||
fabNFC.setOnClickListener {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
tvNFC.setOnClickListener {
|
||||
btnScanAgain.setOnClickListener {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ object UtilHelper {
|
|||
|
||||
@Throws(WriterException::class)
|
||||
fun generateQrCode(myCodeText: String): Bitmap {
|
||||
val hintMap = Hashtable<EncodeHintType, ErrorCorrectionLevel>()
|
||||
hintMap[EncodeHintType.ERROR_CORRECTION] = ErrorCorrectionLevel.H // H = 30% damage
|
||||
val hintMap = Hashtable<EncodeHintType, Any>()
|
||||
hintMap[EncodeHintType.ERROR_CORRECTION] = ErrorCorrectionLevel.M // H = 30% damage
|
||||
hintMap[EncodeHintType.MARGIN] = 2
|
||||
|
||||
val qrCodeWriter = QRCodeWriter()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue