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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -107,6 +107,7 @@
|
|||
android:alpha="1"
|
||||
android:text="@string/reading"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ProgressBar
|
||||
|
|
@ -123,18 +124,22 @@
|
|||
<TextView
|
||||
android:id="@+id/tvNFCHint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@color/primary_dark"
|
||||
android:fontFamily="@font/maax"
|
||||
android:gravity="top"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:minHeight="200dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:text="@string/tap_tangem_card"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="@color/primary_dark"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/text_size_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -27,21 +27,23 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loCard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:maxHeight="200dp"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/loBalance"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintHeight_max="200dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivTangemCard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="5dp"
|
||||
tools:src="@drawable/card_default" />
|
||||
|
||||
<RelativeLayout
|
||||
|
|
@ -69,7 +71,7 @@
|
|||
android:fontFamily="@font/maaxmedium"
|
||||
android:text="@string/verifying"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/text_size_small"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ProgressBar
|
||||
|
|
@ -88,13 +90,14 @@
|
|||
android:id="@+id/loBalance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/loWallet"
|
||||
tools:layout_editor_absoluteX="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
|
@ -113,7 +116,7 @@
|
|||
<TextView
|
||||
android:id="@+id/tvBlockchain"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/maax"
|
||||
|
|
@ -129,6 +132,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/maaxmedium"
|
||||
android:text=" "
|
||||
android:textAlignment="center"
|
||||
android:visibility="visible" />
|
||||
|
||||
|
|
@ -140,6 +144,7 @@
|
|||
android:fontFamily="@font/maax"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:text=" "
|
||||
android:textAlignment="center"
|
||||
android:visibility="visible" />
|
||||
|
||||
|
|
@ -151,7 +156,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<ImageView
|
||||
|
|
@ -173,7 +177,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@android:color/black"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
<color name="msg_err">#BFFF4444</color>
|
||||
<color name="msg_start">#4a086e</color>
|
||||
<color name="msg_action">#0c15c1</color>
|
||||
<color name="btn_light">#FFE3E3E3</color>
|
||||
<color name="btn_dark">#FFC3C3C3</color>
|
||||
<color name="btn_light">#e3e3e3</color>
|
||||
<color name="btn_dark">#c3c3c3</color>
|
||||
<color name="bg_material_dark">#303030</color>
|
||||
<color name="actionbar_text">@color/white</color>
|
||||
<color name="card_state_error">#edcdcc</color>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<dimen name="text_size_large">26sp</dimen>
|
||||
<dimen name="text_size_pin">34sp</dimen>
|
||||
|
||||
<dimen name="size_qr_image">200dp</dimen>
|
||||
<dimen name="size_qr_image">180dp</dimen>
|
||||
<dimen name="size_explore_image">30dp</dimen>
|
||||
<dimen name="size_progress_bar_big">135dp</dimen>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="no_connection">Отсутствует подключение к сети</string>
|
||||
<string name="no_connection">No connection with blockchain nodes</string>
|
||||
<string name="contin">Continue</string>
|
||||
<string name="not_found">Not found</string>
|
||||
<string name="wrong_tag_err">Not ISO tag!</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue