diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStrings.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStrings.kt index c95485a8..23d6a1a0 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStrings.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStrings.kt @@ -61,16 +61,16 @@ data class BisqEasyTradeStateStrings( val bisqEasy_tradeState_info_buyer_phase1a_scanQrCode_webcamState_failed: String, val bisqEasy_tradeState_info_buyer_phase1b_headline: String, val bisqEasy_tradeState_info_buyer_phase1b_info: String, - val bisqEasy_tradeState_info_buyer_phase2a_headline: String, + val bisqEasy_tradeState_info_buyer_phase2a_headline: (String) -> String, val bisqEasy_tradeState_info_buyer_phase2a_quoteAmount: String, val bisqEasy_tradeState_info_buyer_phase2a_sellersAccount: String, val bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo: String, - val bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent: String, + val bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent: (String) -> String, val bisqEasy_tradeState_info_buyer_phase2a_tradeLogMessage: String, val bisqEasy_tradeState_info_buyer_phase2b_headline: String, - val bisqEasy_tradeState_info_buyer_phase2b_info: String, + val bisqEasy_tradeState_info_buyer_phase2b_info: (String, String) -> String, val bisqEasy_tradeState_info_buyer_phase3a_headline: String, - val bisqEasy_tradeState_info_buyer_phase3a_info: String, + val bisqEasy_tradeState_info_buyer_phase3a_info: (String) -> String, val bisqEasy_tradeState_info_buyer_phase3b_headline_ln: String, val bisqEasy_tradeState_info_buyer_phase3b_info_ln: String, val bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln: String, @@ -141,4 +141,12 @@ data class BisqEasyTradeStateStrings( val bisqEasy_mediation_request_feedback_msg: String, val bisqEasy_mediation_request_feedback_noMediatorAvailable: String, val bisqEasy_mediation_requester_tradeLogMessage: String, + + // Mobile app specific + val bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message: String, + val bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix: String, + val bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message: String, + val bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message: String, + val bisqEasy_tradeCompleted_body_you_have_receveid: String, + val bisqEasy_tradeCompleted_body_you_have_sold: String, ) diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsEn.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsEn.kt index 42407ce1..99e5ea29 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsEn.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsEn.kt @@ -59,16 +59,16 @@ val EnBisqEasyTradeStateStrings = BisqEasyTradeStateStrings( bisqEasy_tradeState_info_buyer_phase1a_scanQrCode_webcamState_failed = "Connecting to webcam failed", bisqEasy_tradeState_info_buyer_phase1b_headline = "Wait for the seller's payment account data", bisqEasy_tradeState_info_buyer_phase1b_info = "You can use the chat below for getting in touch with the seller.", - bisqEasy_tradeState_info_buyer_phase2a_headline = "Send {0} to the seller''s payment account", + bisqEasy_tradeState_info_buyer_phase2a_headline = { fiat -> "Send $fiat to the seller''s payment account" }, bisqEasy_tradeState_info_buyer_phase2a_quoteAmount = "Amount to transfer", bisqEasy_tradeState_info_buyer_phase2a_sellersAccount = "Payment account of seller", bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo = "Please leave the 'Reason for payment' field empty, in case you make a bank transfer", - bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = "Confirm payment of {0}", + bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = { fiat -> "Confirm payment of $fiat" }, bisqEasy_tradeState_info_buyer_phase2a_tradeLogMessage = "{0} initiated the {1} payment", bisqEasy_tradeState_info_buyer_phase2b_headline = "Wait for the seller to confirm receipt of payment", - bisqEasy_tradeState_info_buyer_phase2b_info = "Once the seller has received your payment of {0}, they will start the Bitcoin transfer to your provided {1}.", + bisqEasy_tradeState_info_buyer_phase2b_info = { fiat, settlement -> "Once the seller has received your payment of $fiat, they will start the Bitcoin transfer to your provided $settlement." }, bisqEasy_tradeState_info_buyer_phase3a_headline = "Wait for the seller's Bitcoin settlement", - bisqEasy_tradeState_info_buyer_phase3a_info = "The seller need to start the Bitcoin transfer to your provided {0}.", + bisqEasy_tradeState_info_buyer_phase3a_info = { method -> "The seller need to start the Bitcoin transfer to your provided $method."}, bisqEasy_tradeState_info_buyer_phase3b_headline_ln = "The seller has sent the Bitcoin via Lightning network", bisqEasy_tradeState_info_buyer_phase3b_info_ln = "Transfers via the Lightning Network are typically near-instant. If you haven't received the payment within one minute, please contact the seller in the trade chat. Occasionally, payments may fail and need to be retried.", bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln = "Confirm receipt", @@ -139,4 +139,11 @@ val EnBisqEasyTradeStateStrings = BisqEasyTradeStateStrings( bisqEasy_mediation_request_feedback_msg = "A request to the registered mediators has been sent.\n\n Please have patience until a mediator is online to join the trade chat and help to resolve any problems.", bisqEasy_mediation_request_feedback_noMediatorAvailable = "There is no mediator available. Please use the support chat instead.", bisqEasy_mediation_requester_tradeLogMessage = "{0} requested mediation", + + bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message= "Waiting for the seller to provide their account information. Meanwhile you can provide your settlement details.", + bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix = "If you don’t have a wallet yet, refer to our", + bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message = "Waiting for the seller to confirm receipt of payment", + bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message = "Waiting for the seller’s Bitcoin settlement", + bisqEasy_tradeCompleted_body_you_have_receveid = "You have received", + bisqEasy_tradeCompleted_body_you_have_sold = "You have sold", ) diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsFr.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsFr.kt index 102cae8d..7c87cd09 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsFr.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/BisqEasyTradeStateStringsFr.kt @@ -59,16 +59,16 @@ val FrBisqEasyTradeStateStrings = BisqEasyTradeStateStrings( bisqEasy_tradeState_info_buyer_phase1a_scanQrCode_webcamState_failed = "[FR] Connecting to webcam failed", bisqEasy_tradeState_info_buyer_phase1b_headline = "[FR] Wait for the seller's payment account data", bisqEasy_tradeState_info_buyer_phase1b_info = "[FR] You can use the chat below for getting in touch with the seller.", - bisqEasy_tradeState_info_buyer_phase2a_headline = "[FR] Send {0} to the seller''s payment account", + bisqEasy_tradeState_info_buyer_phase2a_headline = { fiat -> "[FR] Send $fiat to the seller''s payment account" }, bisqEasy_tradeState_info_buyer_phase2a_quoteAmount = "[FR] Amount to transfer", bisqEasy_tradeState_info_buyer_phase2a_sellersAccount = "[FR] Payment account of seller", bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo = "[FR] Please leave the 'Reason for payment' field empty, in case you make a bank transfer", - bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = "[FR] Confirm payment of {0}", + bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = { fiat -> "[FR] Confirm payment of $fiat" }, bisqEasy_tradeState_info_buyer_phase2a_tradeLogMessage = "[FR] {0} initiated the {1} payment", bisqEasy_tradeState_info_buyer_phase2b_headline = "[FR] Wait for the seller to confirm receipt of payment", - bisqEasy_tradeState_info_buyer_phase2b_info = "[FR] Once the seller has received your payment of {0}, they will start the Bitcoin transfer to your provided {1}.", + bisqEasy_tradeState_info_buyer_phase2b_info = { fiat, settlement -> "[FR] Once the seller has received your payment of $fiat, they will start the Bitcoin transfer to your provided $settlement." }, bisqEasy_tradeState_info_buyer_phase3a_headline = "[FR] Wait for the seller's Bitcoin settlement", - bisqEasy_tradeState_info_buyer_phase3a_info = "[FR] The seller need to start the Bitcoin transfer to your provided {0}.", + bisqEasy_tradeState_info_buyer_phase3a_info = { method -> "[FR] The seller need to start the Bitcoin transfer to your provided $method."}, bisqEasy_tradeState_info_buyer_phase3b_headline_ln = "[FR] The seller has sent the Bitcoin via Lightning network", bisqEasy_tradeState_info_buyer_phase3b_info_ln = "[FR] Transfers via the Lightning Network are typically near-instant. If you haven't received the payment within one minute, please contact the seller in the trade chat. Occasionally, payments may fail and need to be retried.", bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln = "[FR] Confirm receipt", @@ -139,4 +139,11 @@ val FrBisqEasyTradeStateStrings = BisqEasyTradeStateStrings( bisqEasy_mediation_request_feedback_msg = "[FR] A request to the registered mediators has been sent.\n\n Please have patience until a mediator is online to join the trade chat and help to resolve any problems.", bisqEasy_mediation_request_feedback_noMediatorAvailable = "[FR] There is no mediator available. Please use the support chat instead.", bisqEasy_mediation_requester_tradeLogMessage = "[FR] {0} requested mediation", + + bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message= "[FR] Waiting for the seller to provide their account information. Meanwhile you can provide your settlement details.", + bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix = "[FR] If you don’t have a wallet yet, refer to our", + bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message= "[FR] Waiting for the seller to confirm receipt of payment", + bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message = "[FR] Waiting for the seller’s Bitcoin settlement", + bisqEasy_tradeCompleted_body_you_have_receveid = "[FR] You have received", + bisqEasy_tradeCompleted_body_you_have_sold = "[FR] You have sold", ) diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/CommonStringsEn.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/CommonStringsEn.kt index 71867f43..9d8c437e 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/CommonStringsEn.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/i18n/CommonStringsEn.kt @@ -15,5 +15,6 @@ val EnCommonStrings = CommonStrings( offers_list_buy_from = "Buy from", offers_list_sell_to = "Sell to", - take_offer = "Take offer" + take_offer = "Take offer", + ) \ No newline at end of file diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/atoms/TextField.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/atoms/TextField.kt index 4653d500..27809acd 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/atoms/TextField.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/atoms/TextField.kt @@ -28,8 +28,9 @@ fun BisqTextField( onValueChanged: (String) -> Unit, placeholder: String? = null, labelRightSuffix: (@Composable () -> Unit)? = null, + disabled: Boolean = false, modifier: Modifier = Modifier, - ) { +) { var isFocused by remember { mutableStateOf(false) } Column(modifier = modifier) { if (label.isNotEmpty()) { @@ -41,7 +42,7 @@ fun BisqTextField( BisqText.baseRegular( text = label, color = BisqTheme.colors.light2, - ) + ) if (labelRightSuffix != null) { labelRightSuffix() } @@ -59,7 +60,7 @@ fun BisqTextField( modifier = Modifier.fillMaxWidth().clickable { isFocused = true } .onFocusChanged { focusState -> isFocused = focusState.isFocused - }, + }, textStyle = TextStyle(fontSize = 22.sp), onValueChange = onValueChanged, colors = TextFieldDefaults.colors( @@ -76,9 +77,10 @@ fun BisqTextField( BisqText.h5Regular( text = placeholder, color = BisqTheme.colors.secondaryHover, - ) + ) } - } + }, + enabled = !disabled, ) if (isFocused) { Box( diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/molecules/info/InfoBox.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/molecules/info/InfoBox.kt index a0963605..b98ca259 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/molecules/info/InfoBox.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/molecules/info/InfoBox.kt @@ -3,6 +3,7 @@ package network.bisq.mobile.presentation.ui.components.molecules.info import androidx.compose.foundation.layout.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import network.bisq.mobile.presentation.ui.components.atoms.BisqText import network.bisq.mobile.presentation.ui.theme.BisqTheme @@ -31,7 +32,7 @@ fun InfoBox( val valueWidget: @Composable () -> Unit = if (value != null) { { when (valueType) { - InfoBoxValueType.BoldValue -> BisqText.h6Regular(text = value) + InfoBoxValueType.BoldValue -> if (style == InfoBoxStyle.Style1) BisqText.h6Regular(text = value) else (BisqText.baseRegular(text = value)) InfoBoxValueType.SmallValue -> BisqText.baseRegular(text = value) InfoBoxValueType.TitleSmall -> BisqText.h4Regular(text = value) } @@ -59,10 +60,10 @@ fun InfoBox( InfoBoxStyle.Style2 -> { Column( horizontalAlignment = if (rightAlign) Alignment.End else Alignment.Start, - verticalArrangement = Arrangement.spacedBy(2.dp) + verticalArrangement = Arrangement.spacedBy(0.dp) ) { valueWidget() - BisqText.baseRegular(text = label, color = BisqTheme.colors.grey2) + BisqText.smallRegular(text = label, color = BisqTheme.colors.grey2, modifier = Modifier.offset(y = (-4).dp)) } } } diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/StepperSection.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/StepperSection.kt index 8a31013a..beb2f190 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/StepperSection.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/StepperSection.kt @@ -1,6 +1,5 @@ package network.bisq.mobile.presentation.ui.components.organisms.trades -import androidx.compose.animation.* import androidx.compose.foundation.layout.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier @@ -67,7 +66,7 @@ fun StepperSection( BisqText.xsmallRegular( textAlign = TextAlign.Center, text = stepNumber.toString(), - modifier = Modifier.padding(start = 8.dp) + modifier = Modifier.padding(start = 8.dp).offset(x = 1.dp, y = (-4).dp) ) } content( diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow01AccountDetails.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow01AccountDetails.kt index ea09538c..27978a6c 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow01AccountDetails.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow01AccountDetails.kt @@ -1,56 +1,53 @@ package network.bisq.mobile.presentation.ui.components.organisms.trades -import androidx.compose.foundation.background import androidx.compose.foundation.layout.* -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment +import androidx.compose.runtime.collectAsState import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp +import cafe.adriel.lyricist.LocalStrings import network.bisq.mobile.presentation.ui.components.atoms.BisqButton import network.bisq.mobile.presentation.ui.components.atoms.BisqText import network.bisq.mobile.presentation.ui.components.atoms.BisqTextField -import network.bisq.mobile.presentation.ui.theme.BisqTheme +import network.bisq.mobile.presentation.ui.theme.BisqUIConstants +import network.bisq.mobile.presentation.ui.uicases.trades.ITradeFlowPresenter +import org.koin.compose.koinInject @Composable fun TradeFlow01AccountDetails( onNext: () -> Unit ) { + val strings = LocalStrings.current.bisqEasyTradeState + val stringsBisqEasy = LocalStrings.current.bisqEasy + val presenter: ITradeFlowPresenter = koinInject() + Column { - BisqText.smallRegular( - text = "Waiting for the seller to provide their account information. Meanwhile you can provide your settlement details." - ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) + BisqText.baseRegular(text = strings.bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding2X)) BisqText.h6Regular( - text = "Fill in your Lightning invoice" + text = strings.bisqEasy_tradeState_info_buyer_phase1a_bitcoinPayment_headline_LN ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqTextField( - placeholder = "", - value = "lncb21h345t34io", - onValueChanged = {}, - label = "Lightning Invoice" + label = strings.bisqEasy_tradeState_info_buyer_phase1a_bitcoinPayment_description_LN, + value = presenter.receiveAddress.collectAsState().value, + onValueChanged = { presenter.setReceiveAddress(it) }, ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqButton( - text = "Send to seller", + text = strings.bisqEasy_tradeState_info_buyer_phase1a_send, onClick = onNext, padding = PaddingValues( horizontal = 18.dp, vertical = 6.dp ) ) - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp) - ) { - BisqText.xsmallMedium( - text = "If you don’t have a wallet yet, refer to our" - ) - BisqText.xsmallMedium( - text = "Wallet guide", - modifier = Modifier.clip(shape = RoundedCornerShape(4.dp)) - .background(color = BisqTheme.colors.primary) - .padding(vertical = 2.dp, horizontal = 8.dp) - ) - } + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) + BisqText.smallMedium( + text = strings.bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix + ) + // TODO: Make a small variation of the button + BisqButton(text = stringsBisqEasy.bisqEasy_walletGuide_tabs_headline, onClick = {}) } } \ No newline at end of file diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow02FiatPayment.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow02FiatPayment.kt index 972baa4a..73641205 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow02FiatPayment.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow02FiatPayment.kt @@ -10,111 +10,103 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp import bisqapps.shared.presentation.generated.resources.Res import bisqapps.shared.presentation.generated.resources.img_fiat_payment_waiting +import cafe.adriel.lyricist.LocalStrings import kotlinx.coroutines.delay import network.bisq.mobile.presentation.ui.components.atoms.BisqButton import network.bisq.mobile.presentation.ui.components.atoms.BisqText import network.bisq.mobile.presentation.ui.components.atoms.BisqTextField import network.bisq.mobile.presentation.ui.components.atoms.CircularLoadingImage import network.bisq.mobile.presentation.ui.theme.BisqTheme +import network.bisq.mobile.presentation.ui.theme.BisqUIConstants +import network.bisq.mobile.presentation.ui.uicases.trades.ITradeFlowPresenter +import org.koin.compose.koinInject @Composable fun TradeFlow02FiatPayment( onNext: () -> Unit ) { + val strings = LocalStrings.current.bisqEasyTradeState var isLoading by remember { mutableStateOf(false) } + val presenter: ITradeFlowPresenter = koinInject() - if (!isLoading) { - Column { - BisqText.h6Regular( - text = "Send 10000.02 USD to the seller’s payment account" - ) - BisqTextField( - value = "10000.02 USD", - onValueChanged = {}, - label = "Amount to transfer", - placeholder = "" - ) - BisqTextField( - value = "someone@zelle.com", - onValueChanged = {}, - label = "Payment account of seller", - placeholder = "" - ) - BisqText.smallRegular( - text = "Please leave the ‘Reason for payment’ field empty, in case you make a bank transfer", - color = BisqTheme.colors.grey1 - ) - BisqButton( - text = "Confirm payment of 10000.02 USD", - onClick = { - isLoading = true - }, - padding = PaddingValues( - horizontal = 18.dp, - vertical = 6.dp - ) - ) - } - } else { - LaunchedEffect(Unit) { - delay(3000) - isLoading = false - onNext() - } - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(16.dp) - ) { - CircularLoadingImage( - image = Res.drawable.img_fiat_payment_waiting, - isLoading = isLoading - ) + val sendAmount = "1234.56 USD" + val sendID = "someone@zelle.com" - Column( - verticalArrangement = Arrangement.spacedBy( - 12.dp - ) - ) { - BisqText.h6Regular( - text = "Waiting for the seller to confirm receipt of payment" - ) - BisqText.smallRegular( - text = "Once the seller has received the payment of 10000.02 USD, they will start the Bitcoin transfer to your provided Lightning invoice.", - color = BisqTheme.colors.grey1 - ) - } - } + if (presenter.confirmingFiatPayment.collectAsState().value) { + ShowLoaderFiatPayment(onNext) + return } - /* Column { + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqText.h6Regular( - text = "Send 10000.02 USD to the seller’s payment account" + text = strings.bisqEasy_tradeState_info_buyer_phase2a_headline(sendAmount) ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqTextField( - value = "10000.02 USD", + value = sendAmount, onValueChanged = {}, - label = "Amount to transfer", - placeholder = "" + label = strings.bisqEasy_tradeState_info_buyer_phase2a_quoteAmount, + disabled = true, ) BisqTextField( - value = "someone@zelle.com", + value = sendID, onValueChanged = {}, - label = "Payment account of seller", - placeholder = "" + label = strings.bisqEasy_tradeState_info_buyer_phase2a_sellersAccount, + disabled = true, ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqText.smallRegular( - text = "Please leave the ‘Reason for payment’ field empty, in case you make a bank transfer", + text = strings.bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo, color = BisqTheme.colors.grey1 ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqButton( - text = "Confirm payment of 10000.02 USD", - onClick = onNext, + text = strings.bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent(sendAmount), + onClick = { presenter.confirmFiatPayment() }, padding = PaddingValues( horizontal = 18.dp, vertical = 6.dp ) ) } - */ +} + +@Composable +fun ShowLoaderFiatPayment( + onNext: () -> Unit +) { + val strings = LocalStrings.current.bisqEasyTradeState + val sendAmount = "1234.56 USD" + + LaunchedEffect(Unit) { + delay(3000) + // isLoading = false + onNext() + } + + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + CircularLoadingImage( + image = Res.drawable.img_fiat_payment_waiting, + isLoading = true + ) + + Column( + verticalArrangement = Arrangement.spacedBy( + 12.dp + ) + ) { + BisqText.h6Regular( + text = strings.bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message + ) + BisqText.smallRegular( + text = strings.bisqEasy_tradeState_info_buyer_phase2b_info(sendAmount, "Lightning invoice"), + color = BisqTheme.colors.grey1 + ) + } + } } \ No newline at end of file diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow03BtcPayment.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow03BtcPayment.kt index 72c703fe..a2725b45 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow03BtcPayment.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow03BtcPayment.kt @@ -1,79 +1,96 @@ package network.bisq.mobile.presentation.ui.components.organisms.trades + import androidx.compose.foundation.layout.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import bisqapps.shared.presentation.generated.resources.Res import bisqapps.shared.presentation.generated.resources.img_bitcoin_payment_confirmation import bisqapps.shared.presentation.generated.resources.img_bitcoin_payment_waiting +import cafe.adriel.lyricist.LocalStrings import kotlinx.coroutines.delay import network.bisq.mobile.presentation.ui.components.atoms.BisqButton import network.bisq.mobile.presentation.ui.components.atoms.BisqText import network.bisq.mobile.presentation.ui.components.atoms.CircularLoadingImage import network.bisq.mobile.presentation.ui.theme.BisqTheme +import network.bisq.mobile.presentation.ui.theme.BisqUIConstants @Composable fun TradeFlow03BtcPayment( onNext: () -> Unit ) { + val strings = LocalStrings.current.bisqEasyTradeState var isLoading by remember { mutableStateOf(true) } LaunchedEffect(Unit) { delay(3000) isLoading = false } + if (isLoading) { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(16.dp) + ShowLoaderBtcPayment(onNext) + return + } + + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) + CircularLoadingImage( + image = Res.drawable.img_bitcoin_payment_confirmation, + isLoading = !isLoading + ) + + Column( + verticalArrangement = Arrangement.spacedBy( + 12.dp + ) ) { - CircularLoadingImage( - image = Res.drawable.img_bitcoin_payment_waiting, - isLoading = isLoading + BisqText.h6Regular( + text = strings.bisqEasy_tradeState_info_buyer_phase3b_headline_ln, + ) + BisqText.smallRegular( + text = strings.bisqEasy_tradeState_info_buyer_phase3b_info_ln, + color = BisqTheme.colors.grey1 + ) + BisqButton( + text = strings.bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln, + onClick = onNext, + padding = PaddingValues(horizontal = 18.dp, 6.dp) ) - - Column( - verticalArrangement = Arrangement.spacedBy( - 12.dp - ) - ) { - BisqText.h6Regular( - text = "Waiting for the seller’s Bitcoin settlement" - ) - BisqText.smallRegular( - text = "The seller need to start the Bitcoin transfer to your provided Lightning invoice.", - color = BisqTheme.colors.grey1 - ) - } } - } else { + } +} + +@Composable +fun ShowLoaderBtcPayment( + onNext: () -> Unit +) { + val strings = LocalStrings.current.bisqEasyTradeState - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(16.dp) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) + CircularLoadingImage( + image = Res.drawable.img_bitcoin_payment_waiting, + isLoading = true + ) + + Column( + verticalArrangement = Arrangement.spacedBy( + 12.dp + ) ) { - CircularLoadingImage( - image = Res.drawable.img_bitcoin_payment_confirmation, - isLoading = !isLoading + BisqText.h6Regular( + text = strings.bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message + ) + BisqText.smallRegular( + text = strings.bisqEasy_tradeState_info_buyer_phase3a_info("Lightning invoice"), + color = BisqTheme.colors.grey1 ) - - Column( - verticalArrangement = Arrangement.spacedBy( - 12.dp - ) - ) { - BisqText.h6Regular( - text = "The seller has sent the Bitcoin via Lightning network" - ) - BisqText.smallRegular( - text = "Transfers via the Lightning Network are typically near-instant. If you haven't received the payment within one minute, please contact the seller in the trade. Occasionally, payments may fail and need to be retried.", - color = BisqTheme.colors.grey1 - ) - BisqButton( - text = "Confirm receipt", - onClick = onNext, - padding = PaddingValues(horizontal = 18.dp, 6.dp) - ) - } } } } diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow04Completed.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow04Completed.kt index 0c137b7f..abb70dd6 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow04Completed.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeFlow04Completed.kt @@ -1,45 +1,52 @@ package network.bisq.mobile.presentation.ui.components.organisms.trades import androidx.compose.foundation.BorderStroke -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import cafe.adriel.lyricist.LocalStrings import network.bisq.mobile.presentation.ui.components.atoms.BisqButton import network.bisq.mobile.presentation.ui.components.atoms.BisqText import network.bisq.mobile.presentation.ui.components.atoms.BisqTextField import network.bisq.mobile.presentation.ui.theme.BisqTheme +import network.bisq.mobile.presentation.ui.theme.BisqUIConstants @Composable fun TradeFlow04Completed( onNext: () -> Unit ){ + val strings = LocalStrings.current.bisqEasyTradeState + + val sendAmount = "1234.56 USD" + val btcValue = "0.00173399 BTC" + Column { + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqText.h6Regular( - text = "Trade was successfully completed" + text = strings.bisqEasy_tradeCompleted_title ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqTextField( - value = "10000.02 USD", + value = sendAmount, onValueChanged = {}, - label = "You have received" + label = strings.bisqEasy_tradeCompleted_body_you_have_receveid, ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) BisqTextField( - value = "0.00173399 BTC", + value = btcValue, onValueChanged = {}, - label = "You have sold" + label = strings.bisqEasy_tradeCompleted_body_you_have_sold ) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceBetween ) { BisqButton( - text = "Close trade", + text = strings.bisqEasy_tradeState_info_phase4_leaveChannel, color = BisqTheme.colors.primary, onClick = onNext, backgroundColor = BisqTheme.colors.dark5, @@ -53,7 +60,7 @@ fun TradeFlow04Completed( ) ) BisqButton( - text = "Explore trade data", + text = strings.bisqEasy_tradeState_info_phase4_exportTrade, color = BisqTheme.colors.light1, onClick = {}, backgroundColor = BisqTheme.colors.dark5, diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeHeader.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeHeader.kt index 6cbb4ae1..9edf3267 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeHeader.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/organisms/trades/TradeHeader.kt @@ -16,16 +16,11 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import bisqapps.shared.presentation.generated.resources.Res -import bisqapps.shared.presentation.generated.resources.img_bitcoin_payment_confirmation -import bisqapps.shared.presentation.generated.resources.img_bitcoin_payment_waiting -import kotlinx.coroutines.delay +import cafe.adriel.lyricist.LocalStrings import network.bisq.mobile.domain.data.model.OfferListItem import network.bisq.mobile.presentation.ui.components.atoms.BisqButton import network.bisq.mobile.presentation.ui.components.atoms.BisqText -import network.bisq.mobile.presentation.ui.components.atoms.CircularLoadingImage import network.bisq.mobile.presentation.ui.components.atoms.ProfileRating -import network.bisq.mobile.presentation.ui.components.atoms.icons.SwapHArrowIcon import network.bisq.mobile.presentation.ui.components.atoms.icons.UpIcon import network.bisq.mobile.presentation.ui.components.molecules.info.InfoBoxStyle import network.bisq.mobile.presentation.ui.components.molecules.info.InfoRow @@ -36,6 +31,8 @@ import network.bisq.mobile.presentation.ui.theme.BisqUIConstants fun TradeHeader( offer: OfferListItem, ) { + val strings = LocalStrings.current.bisqEasyTradeState + val stringsBisqEasy = LocalStrings.current.bisqEasy val enterTransition = remember { expandVertically( @@ -81,12 +78,11 @@ fun TradeHeader( verticalAlignment = Alignment.CenterVertically ) { ProfileRating(offer) - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp) + Column( + verticalArrangement = Arrangement.spacedBy(2.dp), + horizontalAlignment = Alignment.End ) { BisqText.xsmallRegular(text = "10000.02 USD") - SwapHArrowIcon() BisqText.xsmallRegular(text = "0.00173399 BTC") } } @@ -99,9 +95,9 @@ fun TradeHeader( InfoRow( style = InfoBoxStyle.Style2, - label1 = "Trade ID", + label1 = strings.bisqEasy_tradeState_header_tradeId, value1 = "07b9bab1", - label2 = "Date", + label2 = strings.bisqEasy_tradeCompleted_body_date, value2 = "29 Sep 2024", ) @@ -111,7 +107,7 @@ fun TradeHeader( style = InfoBoxStyle.Style2, label1 = "Floating percentage", value1 = "1.71%", - label2 = "Price", + label2 = stringsBisqEasy.bisqEasy_openTrades_table_price, value2 = "9567056.04 USD/BTC", ) @@ -119,9 +115,9 @@ fun TradeHeader( InfoRow( style = InfoBoxStyle.Style2, - label1 = "Payment method", + label1 = strings.bisqEasy_tradeCompleted_header_paymentMethod, value1 = "CashApp", - label2 = "Settlement method", + label2 = stringsBisqEasy.bisqEasy_offerbook_offerList_table_columns_settlementMethod, value2 = "Lightning", ) @@ -133,8 +129,8 @@ fun TradeHeader( verticalAlignment = Alignment.CenterVertically ) { BisqButton( - text = "Cancel Trade", - color = BisqTheme.colors.primary, + text = stringsBisqEasy.bisqEasy_openTrades_cancelTrade, + color = BisqTheme.colors.grey1, onClick = {}, backgroundColor = Color.Transparent, padding = PaddingValues(horizontal = 70.dp, vertical = 6.dp) diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/MarketListPresenter.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/MarketListPresenter.kt index 8c536d84..8e75defa 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/MarketListPresenter.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/MarketListPresenter.kt @@ -27,8 +27,8 @@ class MarketListPresenter( fun onSelectMarket(marketListItem: MarketListItem) { offerbookServiceFacade.selectMarket(marketListItem) - // rootNavigator.navigate(Routes.OfferList.name) - rootNavigator.navigate(Routes.TradeFlow.name) + rootNavigator.navigate(Routes.OfferList.name) + // rootNavigator.navigate(Routes.TradeFlow.name) } override fun onViewAttached() { diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/PaymentMethodScreen.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/PaymentMethodScreen.kt index 5e8e8d68..855e9b0e 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/PaymentMethodScreen.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/PaymentMethodScreen.kt @@ -15,7 +15,6 @@ import network.bisq.mobile.domain.data.model.OfferListItem import network.bisq.mobile.presentation.ViewPresenter import network.bisq.mobile.presentation.ui.components.atoms.BisqText import network.bisq.mobile.presentation.ui.components.atoms.DynamicImage -import network.bisq.mobile.presentation.ui.components.layout.BisqScrollLayout import network.bisq.mobile.presentation.ui.theme.BisqTheme import network.bisq.mobile.presentation.ui.components.layout.MultiScreenWizardScaffold import network.bisq.mobile.presentation.ui.theme.BisqUIConstants @@ -26,7 +25,7 @@ interface ITakeOfferPaymentMethodPresenter : ViewPresenter { val offerListItems: StateFlow> fun goBack() - fun paymentMethodConfirmed() + fun paymentMethodConfirmed() } @Composable @@ -98,7 +97,7 @@ fun TakeOfferPaymentMethodScreen() { horizontalAlignment = Alignment.CenterHorizontally, ) { BisqText.largeLight( - text = "Choose a settlement method to send Bitcoin", + text = strings.bisqEasy_takeOffer_paymentMethods_subtitle_bitcoin_seller, color = BisqTheme.colors.grey2 ) Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding2X)) @@ -126,9 +125,7 @@ fun TakeOfferPaymentMethodScreen() { modifier = Modifier.size(15.dp) ) - BisqText.baseRegular( - text = settlementMethod - ) + BisqText.baseRegular(text = settlementMethod) } } } diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/ReviewTradePresenter.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/ReviewTradePresenter.kt index 6f182cb9..88c2d9c1 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/ReviewTradePresenter.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/offers/takeOffer/ReviewTradePresenter.kt @@ -30,7 +30,7 @@ open class ReviewTradePresenter( override fun tradeConfirmed() { log.i { "Trade confirmed" } // TODO: Confirmation popup goes here - rootNavigator.navigate(Routes.OfferList.name) + rootNavigator.navigate(Routes.TradeFlow.name) } } diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/MyTrades.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/MyTrades.kt deleted file mode 100644 index c5898ff5..00000000 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/MyTrades.kt +++ /dev/null @@ -1,30 +0,0 @@ - -package network.bisq.mobile.presentation.ui.uicases.trades - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.navigation.NavHostController -import network.bisq.mobile.presentation.ui.components.atoms.BisqText -import network.bisq.mobile.presentation.ui.theme.BisqTheme -import org.jetbrains.compose.resources.ExperimentalResourceApi -import org.koin.compose.koinInject -import org.koin.core.qualifier.named - -@OptIn(ExperimentalResourceApi::class) -@Composable -fun MyTrades() { - val rootNavController: NavHostController = koinInject(named("RootNavController")) - Box( - modifier = Modifier - .fillMaxSize(), - contentAlignment = Alignment.Center // Centers the content within the Box - ) { - BisqText.h2Regular( - text = "My Trades", - color = BisqTheme.colors.light1, - ) - } -} \ No newline at end of file diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowPresenter.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowPresenter.kt index f1c6c4c4..2e121beb 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowPresenter.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowPresenter.kt @@ -1,11 +1,31 @@ package network.bisq.mobile.presentation.ui.uicases.trades +import androidx.compose.runtime.Composable +import cafe.adriel.lyricist.LocalStrings import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.MutableStateFlow import network.bisq.mobile.domain.data.model.OfferListItem import network.bisq.mobile.domain.service.offerbook.OfferbookServiceFacade import network.bisq.mobile.presentation.BasePresenter import network.bisq.mobile.presentation.MainPresenter -import network.bisq.mobile.presentation.ui.navigation.Routes + +enum class TradeFlowScreenSteps(val titleKey: String) { + ACCOUNT_DETAILS(titleKey = "bisqEasy_tradeState_phase1"), + FIAT_PAYMENT(titleKey = "bisqEasy_tradeState_phase2"), + BITCOIN_TRANSFER(titleKey = "bisqEasy_tradeState_phase3"), + TRADE_COMPLETED(titleKey = "bisqEasy_tradeState_phase4") +} + +@Composable +fun TradeFlowScreenSteps.getTranslatedTitle(): String { + val strings = LocalStrings.current.bisqEasyTradeState + return when (this) { + TradeFlowScreenSteps.ACCOUNT_DETAILS -> strings.bisqEasy_tradeState_phase1 + TradeFlowScreenSteps.FIAT_PAYMENT -> strings.bisqEasy_tradeState_phase2 + TradeFlowScreenSteps.BITCOIN_TRANSFER -> strings.bisqEasy_tradeState_phase3 + TradeFlowScreenSteps.TRADE_COMPLETED -> strings.bisqEasy_tradeState_phase4 + } +} // TODO: Should do Interface for this? open class TradeFlowPresenter( @@ -16,12 +36,30 @@ open class TradeFlowPresenter( override val offerListItems: StateFlow> = offerbookServiceFacade.offerListItems override val steps = listOf( - TradeFlowScreenSteps.ACCOUNT_DETAILS.title, - TradeFlowScreenSteps.FIAT_PAYMENT.title, - TradeFlowScreenSteps.BITCOIN_TRANSFER.title, - TradeFlowScreenSteps.TRADE_COMPLETED.title + TradeFlowScreenSteps.ACCOUNT_DETAILS, + TradeFlowScreenSteps.FIAT_PAYMENT, + TradeFlowScreenSteps.BITCOIN_TRANSFER, + TradeFlowScreenSteps.TRADE_COMPLETED ) + // Could be onchain address or LN Invoice + private val _receiveAddress = MutableStateFlow("") + override val receiveAddress: StateFlow get() = _receiveAddress + override fun setReceiveAddress(value: String) { + _receiveAddress.value = value + } + + private val _confirmingFiatPayment = MutableStateFlow(false) + override val confirmingFiatPayment: StateFlow get() = _confirmingFiatPayment + override fun setConfirmingFiatPayment(value: Boolean) { + _confirmingFiatPayment.value = value + } + + override fun confirmFiatPayment() { + setConfirmingFiatPayment(true) + } + + override fun onViewAttached() { } diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowScreen.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowScreen.kt index 5f5653f6..434c1a52 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowScreen.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/trades/TradeFlowScreen.kt @@ -17,18 +17,20 @@ import network.bisq.mobile.presentation.ui.theme.BisqTheme import network.bisq.mobile.presentation.ui.theme.BisqUIConstants import org.koin.compose.koinInject -enum class TradeFlowScreenSteps(val title: String) { - ACCOUNT_DETAILS(title = "ACCOUNT DETAILS"), - FIAT_PAYMENT(title = "FIAT PAYMENT"), - BITCOIN_TRANSFER(title = "BITCOIN TRANSFER"), - TRADE_COMPLETED(title = "TRADE COMPLETED") -} - interface ITradeFlowPresenter : ViewPresenter { // TODO: Update later to refer to a single state specific object val offerListItems: StateFlow> - val steps: List + val steps: List + + val receiveAddress: StateFlow + fun setReceiveAddress(value: String) + + val confirmingFiatPayment: StateFlow + fun setConfirmingFiatPayment(value: Boolean) + + fun confirmFiatPayment() + } @Composable @@ -50,7 +52,7 @@ fun TradeFlowScreen() { TradeHeader(offer) - Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding)) + Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding2X)) TradeFlowStepper() @@ -70,31 +72,31 @@ fun TradeFlowStepper() { StepperSection( stepNumber = index + 1, isActive = expandedStep == index, - isLastIndex = index == step.lastIndex, + isLastIndex = index == step.titleKey.lastIndex, ) { modifier -> Column(modifier = modifier) { BisqText.baseRegular( - text = step, + text = step.getTranslatedTitle().uppercase(), color = if (expandedStep == index) BisqTheme.colors.light1 else BisqTheme.colors.grey2, ) AnimatedVisibility( visible = expandedStep == index, ) { - when (step) { - TradeFlowScreenSteps.ACCOUNT_DETAILS.title -> { + when (step.titleKey) { + TradeFlowScreenSteps.ACCOUNT_DETAILS.titleKey -> { TradeFlow01AccountDetails(onNext = { expandedStep += 1 }) } - TradeFlowScreenSteps.FIAT_PAYMENT.title -> { + TradeFlowScreenSteps.FIAT_PAYMENT.titleKey -> { TradeFlow02FiatPayment(onNext = { expandedStep += 1 }) } - TradeFlowScreenSteps.BITCOIN_TRANSFER.title -> { + TradeFlowScreenSteps.BITCOIN_TRANSFER.titleKey -> { TradeFlow03BtcPayment(onNext = { expandedStep += 1 }) } - TradeFlowScreenSteps.TRADE_COMPLETED.title -> { + TradeFlowScreenSteps.TRADE_COMPLETED.titleKey -> { TradeFlow04Completed(onNext = { expandedStep += 1 }) } }