diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/tonconnect/TonConnectSendRequestScreen.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/tonconnect/TonConnectSendRequestScreen.kt index 6427e3263c..7a96fa3127 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/tonconnect/TonConnectSendRequestScreen.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/tonconnect/TonConnectSendRequestScreen.kt @@ -24,16 +24,16 @@ import io.horizontalsystems.bankwallet.core.adapters.TonTransactionRecord import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.modules.confirm.ConfirmTransactionScreen import io.horizontalsystems.bankwallet.modules.main.MainActivityViewModel -import io.horizontalsystems.bankwallet.modules.xtransaction.TransactionInfoHelper -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxBurnSection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxContractCallSection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxContractDeploySection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxFeeSection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxMintSection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxReceiveCoinSection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxSectionHeaderCell -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxSendCoinSection -import io.horizontalsystems.bankwallet.modules.xtransaction.XxxSwapSection +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.HeaderCell +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.BurnSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.FeeSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.MintSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.ReceiveCoinSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.SendCoinSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.SwapSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.ton.ContractCallSection +import io.horizontalsystems.bankwallet.modules.xtransaction.sections.ton.ContractDeploySection import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryDefault import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantError @@ -138,7 +138,7 @@ fun TonConnectSendRequestScreen(navController: NavController) { } VSpacer(12.dp) - XxxFeeSection( + FeeSection( transactionInfoHelper = transactionInfoHelper, fee = record.fee, navController = navController @@ -157,7 +157,7 @@ fun TonConnectRequestActionSection( ) { when (val actionType = action.type) { is TonTransactionRecord.Action.Type.Burn -> { - XxxBurnSection( + BurnSection( transactionValue = actionType.value, transactionInfoHelper = transactionInfoHelper, navController = navController @@ -165,23 +165,24 @@ fun TonConnectRequestActionSection( } is TonTransactionRecord.Action.Type.ContractCall -> { - XxxContractCallSection( + ContractCallSection( navController = navController, operation = actionType.operation, address = actionType.address, transactionValue = actionType.value, - transactionInfoHelper = transactionInfoHelper + transactionInfoHelper = transactionInfoHelper, + blockchainType = BlockchainType.Ton ) } is TonTransactionRecord.Action.Type.ContractDeploy -> { - XxxContractDeploySection( + ContractDeploySection( interfaces = actionType.interfaces ) } is TonTransactionRecord.Action.Type.Mint -> { - XxxMintSection( + MintSection( transactionValue = actionType.value, transactionInfoHelper = transactionInfoHelper, navController = navController @@ -189,7 +190,7 @@ fun TonConnectRequestActionSection( } is TonTransactionRecord.Action.Type.Receive -> { - XxxReceiveCoinSection( + ReceiveCoinSection( transactionValue = actionType.value, address = actionType.from, comment = actionType.comment, @@ -201,7 +202,7 @@ fun TonConnectRequestActionSection( } is TonTransactionRecord.Action.Type.Send -> { - XxxSendCoinSection( + SendCoinSection( transactionValue = actionType.value, address = actionType.to, comment = actionType.comment, @@ -214,7 +215,7 @@ fun TonConnectRequestActionSection( } is TonTransactionRecord.Action.Type.Swap -> { - XxxSwapSection( + SwapSection( transactionInfoHelper = transactionInfoHelper, navController = navController, transactionValueIn = actionType.valueIn, @@ -224,7 +225,7 @@ fun TonConnectRequestActionSection( is TonTransactionRecord.Action.Type.Unsupported -> { SectionUniversalLawrence { - XxxSectionHeaderCell( + HeaderCell( title = stringResource(R.string.Send_Confirmation_Action), value = actionType.type, painter = null diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxAddressCell.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/AddressCell.kt similarity index 98% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxAddressCell.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/AddressCell.kt index 97d962f5e8..0a149cbb29 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxAddressCell.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/AddressCell.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.cells import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -33,7 +33,7 @@ import io.horizontalsystems.core.helpers.HudHelper import io.horizontalsystems.marketkit.models.BlockchainType @Composable -fun XxxAddressCell( +fun AddressCell( title: String, value: String, showAddContactButton: Boolean, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxAmountCell.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/AmountCell.kt similarity index 89% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxAmountCell.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/AmountCell.kt index 7f53d9d9e6..55857da43e 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxAmountCell.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/AmountCell.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.cells import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Column @@ -20,6 +20,10 @@ import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.core.stats.stat import io.horizontalsystems.bankwallet.entities.TransactionValue import io.horizontalsystems.bankwallet.modules.coin.CoinFragment +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.coinAmountString +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.coinIconPainter +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.fiatAmountString import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.components.HFillSpacer import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer @@ -30,7 +34,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_leah @Composable -fun XxxAmountCell( +fun AmountCell( title: String, coinIcon: Painter, coinProtocolType: String, @@ -75,7 +79,7 @@ fun XxxAmountCell( } @Composable -fun XxxAmountCellTV( +fun AmountCellTV( title: String, transactionValue: TransactionValue, coinAmountColor: AmountColor, @@ -85,7 +89,7 @@ fun XxxAmountCellTV( statPage: StatPage, borderTop: Boolean = true ) { - XxxAmountCell( + AmountCell( title = title, coinIcon = coinIconPainter( url = transactionValue.coinIconUrl, @@ -94,13 +98,13 @@ fun XxxAmountCellTV( ), coinProtocolType = transactionValue.badge ?: stringResource(id = R.string.CoinPlatforms_Native), - coinAmount = xxxCoinAmount( + coinAmount = coinAmountString( value = transactionValue.decimalValue?.abs(), coinCode = transactionValue.coinCode, sign = coinAmountSign.sign() ), coinAmountColor = coinAmountColor.color(), - fiatAmount = xxxFiatAmount( + fiatAmount = fiatAmountString( value = transactionInfoHelper.getXRate(transactionValue.coinUid) ?.let { transactionValue.decimalValue?.abs() diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/TransactionCells.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/HeaderCell.kt similarity index 52% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/TransactionCells.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/HeaderCell.kt index 8f98d8b832..89ff313996 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/TransactionCells.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/HeaderCell.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.cells import androidx.compose.foundation.layout.padding import androidx.compose.material.Icon @@ -8,18 +8,13 @@ import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import io.horizontalsystems.bankwallet.core.App import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme -import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_leah import io.horizontalsystems.bankwallet.ui.compose.components.cell.CellUniversal import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_grey -import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_leah -import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey -import java.math.BigDecimal @Composable -fun XxxSectionHeaderCell( +fun HeaderCell( title: String, value: String, borderTop: Boolean = true, @@ -47,37 +42,4 @@ fun XxxSectionHeaderCell( overflow = TextOverflow.Ellipsis ) } -} - -@Composable -fun XxxTitleAndValueCell( - title: String, - value: String, - borderTop: Boolean = true -) { - CellUniversal(borderTop = borderTop) { - subhead2_grey(text = title, modifier = Modifier.padding(end = 16.dp)) - HSpacer(16.dp) - subhead1_leah( - modifier = Modifier.weight(1f), - text = value, - textAlign = TextAlign.Right - ) - } -} - -@Composable -fun xxxCoinAmount(value: BigDecimal?, coinCode: String, sign: String): String { -// if (hideAmount) return "*****" - if (value == null) return "---" - - return sign + App.numberFormatter.formatCoinFull(value, coinCode, 8) -} - -@Composable -fun xxxFiatAmount(value: BigDecimal?, fiatSymbol: String): String { -// if (hideAmount) return "*****" - if (value == null) return "---" - - return App.numberFormatter.formatFiatFull(value, fiatSymbol) } \ No newline at end of file diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/TitleAndValueCell.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/TitleAndValueCell.kt new file mode 100644 index 0000000000..cff7870ce1 --- /dev/null +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/cells/TitleAndValueCell.kt @@ -0,0 +1,28 @@ +package io.horizontalsystems.bankwallet.modules.xtransaction.cells + +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer +import io.horizontalsystems.bankwallet.ui.compose.components.cell.CellUniversal +import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_leah +import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey + +@Composable +fun TitleAndValueCell( + title: String, + value: String, + borderTop: Boolean = true +) { + CellUniversal(borderTop = borderTop) { + subhead2_grey(text = title, modifier = Modifier.padding(end = 16.dp)) + HSpacer(16.dp) + subhead1_leah( + modifier = Modifier.weight(1f), + text = value, + textAlign = TextAlign.Right + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/AmountString.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/AmountString.kt new file mode 100644 index 0000000000..733602146d --- /dev/null +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/AmountString.kt @@ -0,0 +1,21 @@ +package io.horizontalsystems.bankwallet.modules.xtransaction.helpers + +import androidx.compose.runtime.Composable +import io.horizontalsystems.bankwallet.core.App +import java.math.BigDecimal + +@Composable +fun coinAmountString(value: BigDecimal?, coinCode: String, sign: String): String { +// if (hideAmount) return "*****" + if (value == null) return "---" + + return sign + App.numberFormatter.formatCoinFull(value, coinCode, 8) +} + +@Composable +fun fiatAmountString(value: BigDecimal?, fiatSymbol: String): String { +// if (hideAmount) return "*****" + if (value == null) return "---" + + return App.numberFormatter.formatFiatFull(value, fiatSymbol) +} \ No newline at end of file diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/CoinIconPainter.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/CoinIconPainter.kt similarity index 89% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/CoinIconPainter.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/CoinIconPainter.kt index 60e60a3f12..7658c89c20 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/CoinIconPainter.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/CoinIconPainter.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.helpers import androidx.compose.runtime.Composable import androidx.compose.ui.res.painterResource diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/TransactionInfoHelper.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/TransactionInfoHelper.kt similarity index 93% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/TransactionInfoHelper.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/TransactionInfoHelper.kt index c8640da967..08d8e13cdf 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/TransactionInfoHelper.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/helpers/TransactionInfoHelper.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.helpers import io.horizontalsystems.bankwallet.core.App import io.horizontalsystems.bankwallet.entities.Currency diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxBurnSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/BurnSection.kt similarity index 69% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxBurnSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/BurnSection.kt index 97a6c720b7..be3752ab02 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxBurnSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/BurnSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -6,16 +6,20 @@ import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.entities.TransactionValue +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountCellTV +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence @Composable -fun XxxBurnSection( +fun BurnSection( transactionValue: TransactionValue, transactionInfoHelper: TransactionInfoHelper, navController: NavController, ) { SectionUniversalLawrence { - XxxAmountCellTV( + AmountCellTV( title = stringResource(R.string.Send_Confirmation_Burn), transactionValue = transactionValue, coinAmountColor = AmountColor.Negative, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxFeeSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/FeeSection.kt similarity index 86% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxFeeSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/FeeSection.kt index a26d1bc182..b3f215279b 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxFeeSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/FeeSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.navigation.NavController @@ -6,10 +6,11 @@ import io.horizontalsystems.bankwallet.entities.CurrencyValue import io.horizontalsystems.bankwallet.entities.TransactionValue import io.horizontalsystems.bankwallet.modules.amount.AmountInputType import io.horizontalsystems.bankwallet.modules.fee.HSFeeRaw +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence @Composable -fun XxxFeeSection( +fun FeeSection( transactionInfoHelper: TransactionInfoHelper, fee: TransactionValue.CoinValue, navController: NavController, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxMintSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/MintSection.kt similarity index 69% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxMintSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/MintSection.kt index f58af0568c..7dc66897a5 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxMintSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/MintSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -6,16 +6,20 @@ import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.entities.TransactionValue +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountCellTV +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence @Composable -fun XxxMintSection( +fun MintSection( transactionValue: TransactionValue, transactionInfoHelper: TransactionInfoHelper, navController: NavController, ) { SectionUniversalLawrence { - XxxAmountCellTV( + AmountCellTV( title = stringResource(R.string.Send_Confirmation_Mint), transactionValue = transactionValue, coinAmountColor = AmountColor.Positive, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxReceiveCoinSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ReceiveCoinSection.kt similarity index 77% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxReceiveCoinSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ReceiveCoinSection.kt index 6b922ccda6..99b35bfab0 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxReceiveCoinSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ReceiveCoinSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -7,10 +7,13 @@ import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.core.stats.StatSection import io.horizontalsystems.bankwallet.entities.TransactionValue +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.marketkit.models.BlockchainType @Composable -fun XxxReceiveCoinSection( +fun ReceiveCoinSection( transactionValue: TransactionValue, address: String, comment: String?, @@ -19,7 +22,7 @@ fun XxxReceiveCoinSection( transactionInfoHelper: TransactionInfoHelper, blockchainType: BlockchainType, ) { - XxxTransferCoinSection( + TransferCoinSection( amountTitle = stringResource(R.string.Send_Confirmation_YouReceive), transactionValue = transactionValue, coinAmountColor = AmountColor.Positive, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxSendCoinSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/SendCoinSection.kt similarity index 77% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxSendCoinSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/SendCoinSection.kt index e00aa8a9fe..7c68b87b80 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxSendCoinSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/SendCoinSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -7,10 +7,13 @@ import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.core.stats.StatSection import io.horizontalsystems.bankwallet.entities.TransactionValue +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.marketkit.models.BlockchainType @Composable -fun XxxSendCoinSection( +fun SendCoinSection( transactionValue: TransactionValue, address: String, comment: String?, @@ -20,7 +23,7 @@ fun XxxSendCoinSection( transactionInfoHelper: TransactionInfoHelper, blockchainType: BlockchainType ) { - XxxTransferCoinSection( + TransferCoinSection( amountTitle = stringResource(R.string.Send_Confirmation_YouSend), transactionValue = transactionValue, coinAmountColor = AmountColor.Negative, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxSwapSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/SwapSection.kt similarity index 75% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxSwapSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/SwapSection.kt index 2c7baa7a96..e3fa8e9f4e 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxSwapSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/SwapSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -6,17 +6,21 @@ import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.entities.TransactionValue +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountCellTV +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence @Composable -fun XxxSwapSection( +fun SwapSection( transactionInfoHelper: TransactionInfoHelper, navController: NavController, transactionValueIn: TransactionValue, transactionValueOut: TransactionValue, ) { SectionUniversalLawrence { - XxxAmountCellTV( + AmountCellTV( title = stringResource(R.string.Send_Confirmation_YouSend), transactionValue = transactionValueIn, coinAmountColor = AmountColor.Negative, @@ -27,7 +31,7 @@ fun XxxSwapSection( borderTop = false, ) - XxxAmountCellTV( + AmountCellTV( title = stringResource(R.string.Swap_YouGet), transactionValue = transactionValueOut, coinAmountColor = AmountColor.Positive, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxTransferCoinSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/TransferCoinSection.kt similarity index 74% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxTransferCoinSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/TransferCoinSection.kt index 92e9fb8730..00e0378891 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxTransferCoinSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/TransferCoinSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -7,11 +7,17 @@ import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.core.stats.StatSection import io.horizontalsystems.bankwallet.entities.TransactionValue +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AddressCell +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountCellTV +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.TitleAndValueCell +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence import io.horizontalsystems.marketkit.models.BlockchainType @Composable -fun XxxTransferCoinSection( +fun TransferCoinSection( amountTitle: String, transactionValue: TransactionValue, coinAmountColor: AmountColor, @@ -26,7 +32,7 @@ fun XxxTransferCoinSection( blockchainType: BlockchainType, ) { SectionUniversalLawrence { - XxxAmountCellTV( + AmountCellTV( title = amountTitle, transactionValue = transactionValue, coinAmountColor = coinAmountColor, @@ -39,7 +45,7 @@ fun XxxTransferCoinSection( val contact = transactionInfoHelper.getContact(address, blockchainType) - XxxAddressCell( + AddressCell( title = addressTitle, value = address, showAddContactButton = contact == null, @@ -49,13 +55,13 @@ fun XxxTransferCoinSection( navController = navController ) contact?.let { - XxxTitleAndValueCell( + TitleAndValueCell( title = stringResource(R.string.TransactionInfo_ContactName), value = it.name ) } comment?.let { - XxxTitleAndValueCell( + TitleAndValueCell( title = stringResource(R.string.TransactionInfo_Memo), value = it ) diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxContractCallSection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ton/ContractCallSection.kt similarity index 67% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxContractCallSection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ton/ContractCallSection.kt index 004d22cee9..cb269da3af 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxContractCallSection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ton/ContractCallSection.kt @@ -1,4 +1,4 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections.ton import androidx.compose.runtime.Composable import androidx.compose.ui.res.painterResource @@ -9,37 +9,44 @@ import io.horizontalsystems.bankwallet.core.stats.StatPage import io.horizontalsystems.bankwallet.core.stats.StatSection import io.horizontalsystems.bankwallet.entities.TransactionValue import io.horizontalsystems.bankwallet.modules.transactions.TransactionViewItem +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AddressCell +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountCellTV +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountColor +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.AmountSign +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.HeaderCell +import io.horizontalsystems.bankwallet.modules.xtransaction.helpers.TransactionInfoHelper import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence import io.horizontalsystems.marketkit.models.BlockchainType @Composable -fun XxxContractCallSection( +fun ContractCallSection( navController: NavController, operation: String, address: String, transactionValue: TransactionValue, transactionInfoHelper: TransactionInfoHelper, + blockchainType: BlockchainType, ) { SectionUniversalLawrence { - XxxSectionHeaderCell( + HeaderCell( title = stringResource(R.string.Transactions_ContractCall), value = operation, - painter = TransactionViewItem.Icon.Platform(BlockchainType.Ton).iconRes?.let { + painter = TransactionViewItem.Icon.Platform(blockchainType).iconRes?.let { painterResource(it) } ) - val contact = transactionInfoHelper.getContact(address, BlockchainType.Ton) - XxxAddressCell( + val contact = transactionInfoHelper.getContact(address, blockchainType) + AddressCell( title = stringResource(R.string.TransactionInfo_To), value = address, showAddContactButton = contact == null, - blockchainType = BlockchainType.Ton, + blockchainType = blockchainType, statPage = StatPage.TonConnect, statSection = StatSection.AddressTo, navController = navController ) - XxxAmountCellTV( + AmountCellTV( title = stringResource(R.string.Send_Confirmation_YouSend), transactionValue = transactionValue, coinAmountColor = AmountColor.Negative, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxContractDeploySection.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ton/ContractDeploySection.kt similarity index 70% rename from app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxContractDeploySection.kt rename to app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ton/ContractDeploySection.kt index 6f27da8ecb..5f9479adb9 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/XxxContractDeploySection.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/xtransaction/sections/ton/ContractDeploySection.kt @@ -1,16 +1,17 @@ -package io.horizontalsystems.bankwallet.modules.xtransaction +package io.horizontalsystems.bankwallet.modules.xtransaction.sections.ton import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import io.horizontalsystems.bankwallet.R +import io.horizontalsystems.bankwallet.modules.xtransaction.cells.HeaderCell import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence @Composable -fun XxxContractDeploySection( +fun ContractDeploySection( interfaces: List, ) { SectionUniversalLawrence { - XxxSectionHeaderCell( + HeaderCell( title = stringResource(R.string.Transactions_ContractDeploy), value = interfaces.joinToString(), painter = null