diff --git a/app/src/external/res/xml/network_security_config.xml b/app/src/external/res/xml/network_security_config.xml
new file mode 100644
index 0000000000..894912ac61
--- /dev/null
+++ b/app/src/external/res/xml/network_security_config.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/tangem/tap/domain/totalBalance/implementation/DefaultTotalFiatBalanceCalculator.kt b/app/src/main/java/com/tangem/tap/domain/totalBalance/implementation/DefaultTotalFiatBalanceCalculator.kt
index 9136094e8b..fd5bf29aa9 100644
--- a/app/src/main/java/com/tangem/tap/domain/totalBalance/implementation/DefaultTotalFiatBalanceCalculator.kt
+++ b/app/src/main/java/com/tangem/tap/domain/totalBalance/implementation/DefaultTotalFiatBalanceCalculator.kt
@@ -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.calculateTotalFiatAmount(): BigDecimal? {
return this
- .filterNot { it.isCustom }
+ .filterNot { it.isCustom && it.fiatRate == null }
.map { walletData ->
walletData.fiatRate
?.takeUnless { walletData.status.isErrorStatus }
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index d1867f7c33..67b386e4e9 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -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],
diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt
index 2bb5569c19..60fcbfece5 100644
--- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt
+++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt
@@ -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,
+ ),
)
}
diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/SwapAmount.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/SwapAmount.kt
index 342ce251e7..c37e6fbc96 100644
--- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/SwapAmount.kt
+++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/SwapAmount.kt
@@ -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)
diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/domain/PreparedSwapConfigState.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/domain/PreparedSwapConfigState.kt
index 29515eef16..8b9f1c963b 100644
--- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/domain/PreparedSwapConfigState.kt
+++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/models/domain/PreparedSwapConfigState.kt
@@ -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,