Updated on 2026-08-14
This commit is contained in:
parent
1b179aa1b8
commit
28d3694b73
8 changed files with 78 additions and 63 deletions
|
|
@ -62,14 +62,14 @@ public class BalanceValidator {
|
|||
if (card.getBalanceUnconfirmed() != 0) {
|
||||
score = 0;
|
||||
firstLine = "Transaction in progress";
|
||||
secondLine = "Wait for full confirmation in blockchain. ";
|
||||
secondLine = "Wait for confirmation in blockchain";
|
||||
return;
|
||||
}
|
||||
|
||||
if (card.isBalanceReceived() && card.isBalanceEqual()) {
|
||||
score = 100;
|
||||
firstLine = "Verified balance";
|
||||
secondLine = "Balance confirmed in blockchain. ";
|
||||
secondLine = "Balance confirmed in blockchain";
|
||||
if (card.getBalance() == 0) {
|
||||
firstLine = "Empty wallet";
|
||||
secondLine = "";
|
||||
|
|
@ -117,14 +117,14 @@ public class BalanceValidator {
|
|||
if (!card.getUnconfirmedTXCount().equals(card.getConfirmedTXCount())) {
|
||||
score = 0;
|
||||
firstLine = "Unguaranteed balance";
|
||||
secondLine = "Transaction is in progress. Wait for confirmation in blockchain. ";
|
||||
secondLine = "Transaction is in progress. Wait for confirmation in blockchain.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (card.isBalanceReceived()) {
|
||||
score = 100;
|
||||
firstLine = "Verified balance";
|
||||
secondLine = "Balance confirmed in blockchain. ";
|
||||
secondLine = "Balance confirmed in blockchain";
|
||||
if (card.getBalance() == 0) {
|
||||
firstLine = "Empty wallet";
|
||||
secondLine = "";
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ public class TangemCard {
|
|||
balanceDecimal = null;
|
||||
balanceDecimalAlter = null;
|
||||
setIsBalanceEqual(false);
|
||||
if (tokenSymbol.length() > 1) blockchainID = Blockchain.Token.getID(); // Reset blockchain to Token from ETH for token cards with zero token balance on it
|
||||
}
|
||||
|
||||
public Date getPersonalizationDateTime() {
|
||||
|
|
|
|||
|
|
@ -850,51 +850,56 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
}
|
||||
|
||||
private fun refresh() {
|
||||
// clear all card data and request again
|
||||
srl!!.isRefreshing = true
|
||||
card!!.clearInfo()
|
||||
card!!.error = null
|
||||
card!!.message = null
|
||||
requestCounter = 0
|
||||
if ((srl == null) || (card == null)) return;
|
||||
try {
|
||||
// clear all card data and request again
|
||||
srl!!.isRefreshing = true
|
||||
card!!.clearInfo()
|
||||
card!!.error = null
|
||||
card!!.message = null
|
||||
requestCounter = 0
|
||||
|
||||
updateViews()
|
||||
updateViews()
|
||||
|
||||
val engine = CoinEngineFactory.create(card!!.blockchain)
|
||||
val engine = CoinEngineFactory.create(card!!.blockchain)
|
||||
|
||||
requestCardVerify()
|
||||
requestCardVerify()
|
||||
|
||||
// Bitcoin
|
||||
if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet) {
|
||||
card!!.setIsBalanceEqual(true)
|
||||
// Bitcoin
|
||||
if (card!!.blockchain == Blockchain.Bitcoin || card!!.blockchain == Blockchain.BitcoinTestNet) {
|
||||
card!!.setIsBalanceEqual(true)
|
||||
|
||||
requestElectrum(card!!, ElectrumRequest.checkBalance(card!!.wallet))
|
||||
requestElectrum(card!!, ElectrumRequest.listUnspent(card!!.wallet))
|
||||
requestRateInfo("bitcoin")
|
||||
}
|
||||
requestElectrum(card!!, ElectrumRequest.checkBalance(card!!.wallet))
|
||||
requestElectrum(card!!, ElectrumRequest.listUnspent(card!!.wallet))
|
||||
requestRateInfo("bitcoin")
|
||||
}
|
||||
|
||||
// BitcoinCash
|
||||
else if (card!!.blockchain == Blockchain.BitcoinCash || card!!.blockchain == Blockchain.BitcoinCashTestNet) {
|
||||
card!!.setIsBalanceEqual(true)
|
||||
// BitcoinCash
|
||||
else if (card!!.blockchain == Blockchain.BitcoinCash || card!!.blockchain == Blockchain.BitcoinCashTestNet) {
|
||||
card!!.setIsBalanceEqual(true)
|
||||
|
||||
requestElectrum(card!!, ElectrumRequest.checkBalance(card!!.wallet))
|
||||
requestElectrum(card!!, ElectrumRequest.listUnspent(card!!.wallet))
|
||||
requestRateInfo("bitcoin-cash")
|
||||
}
|
||||
requestElectrum(card!!, ElectrumRequest.checkBalance(card!!.wallet))
|
||||
requestElectrum(card!!, ElectrumRequest.listUnspent(card!!.wallet))
|
||||
requestRateInfo("bitcoin-cash")
|
||||
}
|
||||
|
||||
// Ethereum
|
||||
else if (card!!.blockchain == Blockchain.Ethereum || card!!.blockchain == Blockchain.EthereumTestNet) {
|
||||
// Ethereum
|
||||
else if (card!!.blockchain == Blockchain.Ethereum || card!!.blockchain == Blockchain.EthereumTestNet) {
|
||||
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
|
||||
requestRateInfo("ethereum")
|
||||
}
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
|
||||
requestRateInfo("ethereum")
|
||||
}
|
||||
|
||||
// Token
|
||||
else if (card!!.blockchain == Blockchain.Token) {
|
||||
// Token
|
||||
else if (card!!.blockchain == Blockchain.Token) {
|
||||
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_CALL, engine.getContractAddress(card))
|
||||
requestRateInfo("ethereum")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_CALL, engine.getContractAddress(card))
|
||||
requestRateInfo("ethereum")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -985,13 +990,14 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
var showTime: Date = Date()
|
||||
|
||||
private fun showSingleToast(text: Int) {
|
||||
if (singleToast == null || !singleToast!!.view.isShown || showTime.time + 2000 < Date().time) {
|
||||
if (singleToast != null)
|
||||
singleToast!!.cancel()
|
||||
singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
|
||||
singleToast!!.show()
|
||||
showTime = Date()
|
||||
}
|
||||
// if (singleToast == null || !singleToast!!.view.isShown || showTime.time + 2000 < Date().time) {
|
||||
// if (singleToast != null)
|
||||
// singleToast!!.cancel()
|
||||
// singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
|
||||
// singleToast!!.show()
|
||||
// showTime = Date()
|
||||
// }
|
||||
singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue