Updated on 2026-08-14
This commit is contained in:
commit
a7171caff3
6 changed files with 43 additions and 10 deletions
9
app/src/external/res/xml/network_security_config.xml
vendored
Normal file
9
app/src/external/res/xml/network_security_config.xml
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true">
|
||||
<trust-anchors>
|
||||
<certificates src="user" />
|
||||
<certificates src="system" />
|
||||
</trust-anchors>
|
||||
</base-config>
|
||||
</network-security-config>
|
||||
|
|
@ -50,7 +50,7 @@ internal class DefaultTotalFiatBalanceCalculator : TotalFiatBalanceCalculator {
|
|||
is WalletDataModel.SameCurrencyTransactionInProgress,
|
||||
is WalletDataModel.TransactionInProgress,
|
||||
is WalletDataModel.NoAccount,
|
||||
-> if (walletData.isCustom || walletData.fiatRate == null) {
|
||||
-> if (walletData.isCustom && walletData.fiatRate == null) {
|
||||
TotalFiatBalanceStatus.Error
|
||||
} else {
|
||||
TotalFiatBalanceStatus.Loaded
|
||||
|
|
@ -65,7 +65,7 @@ internal class DefaultTotalFiatBalanceCalculator : TotalFiatBalanceCalculator {
|
|||
|
||||
private fun Sequence<WalletDataModel>.calculateTotalFiatAmount(): BigDecimal? {
|
||||
return this
|
||||
.filterNot { it.isCustom }
|
||||
.filterNot { it.isCustom && it.fiatRate == null }
|
||||
.map { walletData ->
|
||||
walletData.fiatRate
|
||||
?.takeUnless { walletData.status.isErrorStatus }
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ platform :android do
|
|||
})
|
||||
end
|
||||
|
||||
desc "Build internal and release APKs"
|
||||
desc "Build external and release APKs"
|
||||
lane :build do |options|
|
||||
gradle(
|
||||
task: "clean assemble",
|
||||
build_type: "Internal",
|
||||
build_type: "External",
|
||||
properties: {
|
||||
'versionCode' => options[:versionCode],
|
||||
'versionName' => options[:versionName],
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
return repository.getTangemFee()
|
||||
}
|
||||
|
||||
fun getTokenDecimals(token: Currency): Int {
|
||||
private fun getTokenDecimals(token: Currency): Int {
|
||||
return if (token is Currency.NonNativeToken) {
|
||||
token.decimalCount
|
||||
} else {
|
||||
|
|
@ -355,15 +355,15 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
swapStateData = null,
|
||||
formattedFee = null,
|
||||
)
|
||||
return updatePermissionState(
|
||||
val quotesState = updatePermissionState(
|
||||
networkId = networkId,
|
||||
fromToken = fromToken,
|
||||
quotesLoadedState = swapState,
|
||||
).copy(
|
||||
preparedSwapConfigState = PreparedSwapConfigState(
|
||||
)
|
||||
return quotesState.copy(
|
||||
preparedSwapConfigState = quotesState.preparedSwapConfigState.copy(
|
||||
isAllowedToSpend = isAllowedToSpend,
|
||||
isBalanceEnough = isBalanceWithoutFeeEnough,
|
||||
isFeeEnough = true,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
|
|
@ -540,7 +540,14 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
decimals = transactionManager.getNativeTokenDecimals(networkId),
|
||||
currency = userWalletManager.getNetworkCurrency(networkId),
|
||||
) + feeFiat
|
||||
val isFeeEnough = checkFeeIsEnough(
|
||||
fee = feeData.fee.value,
|
||||
spendAmount = SwapAmount.zeroSwapAmount(),
|
||||
networkId = networkId,
|
||||
fromToken = fromToken,
|
||||
)
|
||||
return quotesLoadedState.copy(
|
||||
fee = formattedFee,
|
||||
permissionState = PermissionDataState.PermissionReadyForRequest(
|
||||
currency = fromToken.symbol,
|
||||
amount = INFINITY_SYMBOL,
|
||||
|
|
@ -553,6 +560,9 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
approveModel = transactionData,
|
||||
),
|
||||
),
|
||||
preparedSwapConfigState = quotesLoadedState.preparedSwapConfigState.copy(
|
||||
isFeeEnough = isFeeEnough,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,14 @@ import java.math.BigDecimal
|
|||
data class SwapAmount(
|
||||
val value: BigDecimal,
|
||||
val decimals: Int,
|
||||
)
|
||||
) {
|
||||
|
||||
companion object {
|
||||
fun zeroSwapAmount(): SwapAmount {
|
||||
return SwapAmount(BigDecimal.ZERO, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun SwapAmount.formatToUIRepresentation(): String {
|
||||
return value.toFormattedString(decimals = decimals)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
package com.tangem.feature.swap.domain.models.domain
|
||||
|
||||
/**
|
||||
* Prepared swap config state that contains flags to determine
|
||||
*
|
||||
* @property isAllowedToSpend shows is token allowed to spend
|
||||
* @property isBalanceEnough shows is balance of token enough
|
||||
* @property isFeeEnough shows is amount of main coin enough for fee
|
||||
*/
|
||||
data class PreparedSwapConfigState(
|
||||
val isAllowedToSpend: Boolean,
|
||||
val isBalanceEnough: Boolean,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue