Updated on 2026-08-14
This commit is contained in:
commit
7e93e65aca
6 changed files with 28 additions and 23 deletions
|
|
@ -147,6 +147,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
if (height != -1) {
|
||||
String nodeAddress = engine.getNode(loadedWallet.getCard());
|
||||
int nodePort = engine.getNodePort(loadedWallet.getCard());
|
||||
engine.switchNode(loadedWallet.getCard());
|
||||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(loadedWallet, nodeAddress, nodePort);
|
||||
// loadedWallet.updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.getHeader(mWalletAddress, String.valueOf(height)), ElectrumRequest.getTransaction(mWalletAddress, hash));
|
||||
|
|
@ -184,6 +185,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
if (height != -1) {
|
||||
String nodeAddress = engine.getNode(loadedWallet.getCard());
|
||||
int nodePort = engine.getNodePort(loadedWallet.getCard());
|
||||
engine.switchNode(loadedWallet.getCard());
|
||||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(loadedWallet, nodeAddress, nodePort);
|
||||
// loadedWallet.updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.getHeader(mWalletAddress, String.valueOf(height)), ElectrumRequest.getTransaction(mWalletAddress, hash));
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class BalanceValidator {
|
|||
firstLine = "Verification failed";
|
||||
secondLine = "";
|
||||
|
||||
if (card.getBlockchain() == Blockchain.Bitcoin) {
|
||||
if (card.getBlockchain() == Blockchain.Bitcoin || card.getBlockchain() == Blockchain.BitcoinTestNet) {
|
||||
|
||||
if (((card.getOfflineBalance() == null) && !card.isBalanceReceived()) || (!card.isBalanceReceived() && (card.getRemainingSignatures() != card.getMaxSignatures()))) {
|
||||
score = 0;
|
||||
|
|
@ -61,8 +61,8 @@ public class BalanceValidator {
|
|||
|
||||
if (card.getBalanceUnconfirmed() != 0) {
|
||||
score = 0;
|
||||
firstLine = "Unguaranted balance";
|
||||
secondLine = "Loading in progress. Wait for full confirmation in blockchain. ";
|
||||
firstLine = "Transaction in progress";
|
||||
secondLine = "Wait for full confirmation in blockchain. ";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ import java.util.Random;
|
|||
|
||||
import static com.tangem.util.FormatUtil.stringToBigDecimal;
|
||||
|
||||
/**
|
||||
* Created by Ilia on 15.02.2018.
|
||||
*/
|
||||
|
||||
public class BtcEngine extends CoinEngine {
|
||||
|
||||
private static String[] getBitcoinServiceHosts() {
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,7 @@ public class TangemCard {
|
|||
return balanceReceived;
|
||||
}
|
||||
|
||||
private boolean balanceReceived;
|
||||
private boolean balanceReceived = false;
|
||||
|
||||
public void setBalanceReceived(boolean value) {
|
||||
balanceReceived = value;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import android.content.res.ColorStateList
|
|||
import android.nfc.NfcAdapter
|
||||
import android.nfc.Tag
|
||||
import android.nfc.tech.IsoDep
|
||||
import android.os.AsyncTask
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.support.v4.app.Fragment
|
||||
|
|
@ -24,6 +25,7 @@ import com.google.zxing.WriterException
|
|||
import com.tangem.data.network.ServerApiHelper
|
||||
import com.tangem.data.network.model.InfuraResponse
|
||||
import com.tangem.data.network.request.ElectrumRequest
|
||||
import com.tangem.data.network.task.loaded_wallet.UpdateWalletInfoTask
|
||||
import com.tangem.data.nfc.VerifyCardTask
|
||||
import com.tangem.domain.cardReader.CardProtocol
|
||||
import com.tangem.domain.cardReader.NfcManager
|
||||
|
|
@ -32,7 +34,6 @@ import com.tangem.presentation.activity.*
|
|||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
|
||||
import com.tangem.presentation.dialog.PINSwapWarningDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
|
||||
import com.tangem.util.BTCUtils
|
||||
import com.tangem.util.Util
|
||||
import com.tangem.util.UtilHelper
|
||||
import com.tangem.wallet.BuildConfig
|
||||
|
|
@ -345,6 +346,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
// request card verify listener
|
||||
serverApiHelper!!.setCardVerifyAndGetInfoListener {
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
updateViews()
|
||||
val result = it.results!![0]
|
||||
if (result.error != null) {
|
||||
// Log.e(TAG, "Can't verify card: ${result.error}")
|
||||
|
|
@ -386,7 +388,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
card!!.rate = rate
|
||||
card!!.rateAlter = rate
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
|
||||
updateViews()
|
||||
// Log.i(TAG, "setRateInfoData $rate")
|
||||
}
|
||||
|
||||
|
|
@ -438,9 +440,8 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
if (l.compareTo(BigInteger.ZERO) == 0) {
|
||||
card!!.blockchainID = Blockchain.Ethereum.id
|
||||
card!!.addTokenToBlockchainName()
|
||||
updateViews()
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
// refresh()
|
||||
updateViews()
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_BALANCE, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_TRANSACTION_COUNT, "")
|
||||
requestInfura(ServerApiHelper.INFURA_ETH_GET_PENDING_COUNT, "")
|
||||
|
|
@ -508,6 +509,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
|
||||
override fun onInfuraFail(method: String, message: String) {
|
||||
srlLoadedWallet!!.isRefreshing = false
|
||||
updateViews()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -830,11 +832,17 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
|
||||
val engine = CoinEngineFactory.create(card!!.blockchain)
|
||||
|
||||
val validator = BalanceValidator()
|
||||
validator.Check(card, false)
|
||||
tvBalanceLine1.text = validator.firstLine
|
||||
tvBalanceLine2.text = validator.getSecondLine(false)
|
||||
tvBalanceLine1.setTextColor(ContextCompat.getColor(context!!, validator.color))
|
||||
if (srlLoadedWallet!!.isRefreshing) {
|
||||
tvBalanceLine1.setTextColor(getResources().getColor(R.color.primary))
|
||||
tvBalanceLine1.text = "Verifying in blockchain..."
|
||||
tvBalanceLine2.text = ""
|
||||
} else {
|
||||
val validator = BalanceValidator()
|
||||
validator.Check(card, false)
|
||||
tvBalanceLine1.setTextColor(ContextCompat.getColor(context!!, validator.color))
|
||||
tvBalanceLine1.text = validator.firstLine
|
||||
tvBalanceLine2.text = validator.getSecondLine(false)
|
||||
}
|
||||
|
||||
if (engine!!.hasBalanceInfo(card) || card!!.offlineBalance == null) {
|
||||
if (card!!.blockchain == Blockchain.Token) {
|
||||
|
|
@ -876,6 +884,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
card!!.clearInfo()
|
||||
card!!.error = null
|
||||
card!!.message = null
|
||||
card!!.isBalanceReceived = false
|
||||
|
||||
val needResendTX = LastSignStorage.getNeedTxSend(card!!.wallet)
|
||||
|
||||
|
|
@ -989,8 +998,8 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
requestRateInfo("ethereum")
|
||||
}
|
||||
|
||||
if (needResendTX)
|
||||
sendTransaction(LastSignStorage.getTxForSend(card!!.wallet))
|
||||
//if (needResendTX)
|
||||
//sendTransaction(LastSignStorage.getTxForSend(card!!.wallet))
|
||||
|
||||
// if (btnExtract.isEnabled)
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/maaxmedium"
|
||||
android:textAlignment="center"
|
||||
android:visibility="invisible" />
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBalanceLine2"
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone" />
|
||||
android:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -238,7 +238,6 @@
|
|||
android:elevation="2dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:padding="4dp"
|
||||
android:text="@string/message"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="normal|bold"
|
||||
|
|
@ -256,7 +255,6 @@
|
|||
android:fontFamily="@font/maax"
|
||||
android:padding="4dp"
|
||||
android:shadowColor="@color/cardview_shadow_start_color"
|
||||
android:text="@string/error"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue