Updated on 2026-08-14

This commit is contained in:
Tangem 2020-05-14 09:13:43 +00:00
commit 625e4da667
5 changed files with 31 additions and 16 deletions

View file

@ -105,4 +105,25 @@ public enum Blockchain {
return getImageResource();
}
public String getUriScheme() {
String scheme = null;
switch (this) {
case Bitcoin:
case BitcoinDual:
scheme = "bitcoin";
break;
case Ethereum:
case Token:
case TokenEmv:
scheme = "ethereum";
break;
case Litecoin:
scheme = "litecoin";
break;
case Ripple:
scheme = "ripple";
}
return scheme;
}
}

View file

@ -197,10 +197,11 @@ public abstract class CoinEngine {
public abstract Uri getShareWalletUri();
public Uri getShareWalletUriEx(){
if (ctx.getBlockchain() == Blockchain.BitcoinCash)
return getShareWalletUri();
String scheme = ctx.getBlockchain().getUriScheme();
if (scheme != null)
return Uri.parse(scheme + ":" + getShareWalletUri());
else
return Uri.parse(ctx.getBlockchain().name().toLowerCase() + ":" + getShareWalletUri().toString());
return getShareWalletUri();
}
public abstract boolean checkNewTransactionAmount(Amount amount);

View file

@ -68,7 +68,7 @@ public class TangemContext {
if (blockchain == Blockchain.NftToken) {
return card.getTokenSymbol().substring(4) + "<br><small><small> " + getBlockchain().getOfficialName() + " non-fungible token</small></small>";
}
if (blockchain == Blockchain.StellarAsset) {
if (blockchain == Blockchain.StellarAsset || blockchain == Blockchain.BinanceAsset) {
return card.getTokenSymbol() + "<br><small><small> " + getBlockchain().getOfficialName() + " asset</small></small>";
}
if (blockchain == Blockchain.StellarTag) {

View file

@ -95,7 +95,7 @@ public class BinanceAssetEngine extends CoinEngine {
if (assetBalance != null) {
return assetBalance.toDescriptionString(getDecimals()) + "<br><small><small>+ " + balance.toDescriptionString(getDecimals()) + " for fee</small></small>";
}
return balance.toDescriptionString(getDecimals());
return new Amount(BigDecimal.ZERO, ctx.getCard().tokenSymbol).toDescriptionString(getDecimals()) + "<br><small><small>+ " + balance.toDescriptionString(getDecimals()) + " for fee</small></small>";
} else {
return "";
}
@ -135,6 +135,8 @@ public class BinanceAssetEngine extends CoinEngine {
ctx.setMessage(R.string.general_wallet_empty);
} else if (awaitingConfirmation()) {
ctx.setMessage(R.string.loaded_wallet_message_wait);
} else if (coinData.getBalance() == null || coinData.getBalance().isZero()) {
ctx.setMessage(ctx.getString(R.string.confirm_transaction_error_not_enough_eth_for_fee));
} else {
return true;
}

View file

@ -154,17 +154,8 @@ class PrepareTransactionFragment : BaseFragment(), NavigationResultListener, Nfc
val schemeSplit = code!!.split(":")
when (schemeSplit.size) {
2 -> {
if (ctx.blockchain.officialName.toLowerCase(Locale.ROOT).replace("\\s", "") == schemeSplit[0]) {
val uri = Uri.parse(schemeSplit[1])
etWallet?.setText(uri.path)
// val amount = uri.getQueryParameter("amount") //TODO: enable after redesign
// if (amount != null) {
// etAmount?.setText(amount)
// rgIncFee.check(R.id.rbFeeOut)
// }
} else if (ctx.blockchain == Blockchain.Ripple && schemeSplit[0] == "ripple") {
val uri = Uri.parse(schemeSplit[1])
etWallet?.setText(uri.path)
if (schemeSplit[0] == ctx.blockchain.uriScheme) {
etWallet?.setText(schemeSplit[1])
} else {
etWallet?.setText(code)
}