Updated on 2026-08-14
This commit is contained in:
commit
2554d98487
8 changed files with 54 additions and 13 deletions
|
|
@ -39,6 +39,7 @@ fun ExpressProvider(
|
|||
val hapticFeedback = LocalHapticFeedback.current
|
||||
val context = LocalContext.current
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||
modifier = Modifier
|
||||
.clip(TangemTheme.shapes.roundedCornersXMedium)
|
||||
.background(TangemTheme.colors.background.action),
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.common.ui.R
|
||||
import com.tangem.common.ui.expressStatus.state.ExpressLinkUM
|
||||
import com.tangem.common.ui.expressStatus.state.ExpressStatusItemState
|
||||
import com.tangem.common.ui.expressStatus.state.ExpressStatusItemUM
|
||||
import com.tangem.common.ui.expressStatus.state.ExpressStatusUM
|
||||
import com.tangem.core.ui.components.SpacerWMax
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
|
@ -53,6 +53,7 @@ fun ExpressStatusBlock(state: ExpressStatusUM, modifier: Modifier = Modifier) {
|
|||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = Modifier
|
||||
.padding(bottom = TangemTheme.dimens.spacing16),
|
||||
) {
|
||||
|
|
@ -77,8 +78,14 @@ fun ExpressStatusBlock(state: ExpressStatusUM, modifier: Modifier = Modifier) {
|
|||
.padding(end = TangemTheme.dimens.spacing2),
|
||||
)
|
||||
Text(
|
||||
text = link.text.resolveReference(),
|
||||
style = TangemTheme.typography.body2,
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
text = resourceReference(
|
||||
id = R.string.express_transaction_id,
|
||||
formatArgs = wrappedList(link.text),
|
||||
).resolveReference(),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.SpacerWMax
|
||||
import com.tangem.core.ui.components.inputrow.inner.DividerContainer
|
||||
|
|
@ -76,7 +77,7 @@ fun InputRowBestRate(
|
|||
text = subtitle.resolveReference(),
|
||||
style = TangemTheme.typography.body2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
modifier = Modifier.padding(top = TangemTheme.dimens.spacing8),
|
||||
modifier = Modifier.padding(top = 2.dp),
|
||||
)
|
||||
}
|
||||
SpacerWMax()
|
||||
|
|
|
|||
|
|
@ -5,21 +5,38 @@ import androidx.compose.foundation.isSystemInDarkTheme
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.arkivanov.essenty.lifecycle.subscribe
|
||||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
import com.tangem.core.decompose.model.getOrCreateModel
|
||||
import com.tangem.features.onramp.redirect.model.OnrampRedirectModel
|
||||
import com.tangem.features.onramp.redirect.ui.OnrampRedirectContent
|
||||
import com.tangem.features.onramp.success.OnrampSuccessScreenTrigger
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
internal class DefaultOnrampRedirectComponent @AssistedInject constructor(
|
||||
@Assisted appComponentContext: AppComponentContext,
|
||||
@Assisted private val params: OnrampRedirectComponent.Params,
|
||||
private val onrampSuccessScreenTrigger: OnrampSuccessScreenTrigger,
|
||||
) : OnrampRedirectComponent, AppComponentContext by appComponentContext {
|
||||
|
||||
private val model: OnrampRedirectModel = getOrCreateModel(params)
|
||||
|
||||
init {
|
||||
lifecycle.subscribe(
|
||||
onResume = {
|
||||
// On reopen check if redirect happened. If so trigger close action
|
||||
if (model.latestOnrampTransaction != null) {
|
||||
componentScope.launch {
|
||||
onrampSuccessScreenTrigger.triggerOnrampSuccess(false)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun Content(modifier: Modifier) {
|
||||
BackHandler(onBack = params.onBack)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ internal class OnrampRedirectModel @Inject constructor(
|
|||
private val params: OnrampRedirectComponent.Params = paramsContainer.require()
|
||||
private val selectedUserWallet = getWalletsUseCase.invokeSync().first { it.walletId == params.userWalletId }
|
||||
|
||||
private var latestOnrampTransaction: OnrampTransaction? = null
|
||||
var latestOnrampTransaction: OnrampTransaction? = null
|
||||
|
||||
val state = OnrampRedirectUM(
|
||||
topBarConfig = OnrampRedirectTopBarUM(
|
||||
|
|
@ -100,10 +100,12 @@ internal class OnrampRedirectModel @Inject constructor(
|
|||
val replaceOnrampScreens = appRouter.stack
|
||||
.filterNot { it is AppRoute.Onramp }
|
||||
.toMutableList()
|
||||
latestOnrampTransaction = null
|
||||
replaceOnrampScreens.add(AppRoute.OnrampSuccess(latestTxId))
|
||||
appRouter.replaceAll(*replaceOnrampScreens.toTypedArray())
|
||||
} else {
|
||||
// Close redirect screen and show last onramp state
|
||||
latestOnrampTransaction = null
|
||||
params.onBack()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,11 @@ internal class TokenDetailsOnrampTransactionStateConverter(
|
|||
resourceReference(R.string.express_status_bought, wrappedList(cryptoCurrency.name))
|
||||
}
|
||||
},
|
||||
state = getStatusState(OnrampStatus.Status.Paid),
|
||||
state = when {
|
||||
this == OnrampStatus.Status.RefundInProgress ||
|
||||
this == OnrampStatus.Status.Refunded -> ExpressStatusItemState.Error
|
||||
else -> getStatusState(OnrampStatus.Status.Paid)
|
||||
},
|
||||
)
|
||||
|
||||
private fun OnrampStatus.Status.getSendingItem() = ExpressStatusItemUM(
|
||||
|
|
@ -251,7 +255,7 @@ internal class TokenDetailsOnrampTransactionStateConverter(
|
|||
},
|
||||
state = when {
|
||||
this == OnrampStatus.Status.RefundInProgress -> ExpressStatusItemState.Active
|
||||
this == OnrampStatus.Status.Refunded -> ExpressStatusItemState.Error
|
||||
this == OnrampStatus.Status.Refunded -> ExpressStatusItemState.Done
|
||||
else -> getStatusState(OnrampStatus.Status.Sending)
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import com.tangem.feature.swap.domain.models.domain.ExchangeStatus.Companion.isF
|
|||
import com.tangem.feature.swap.domain.models.domain.ExchangeStatusModel
|
||||
import com.tangem.feature.swap.domain.models.domain.SavedSwapTransactionListModel
|
||||
import com.tangem.feature.swap.domain.models.domain.SavedSwapTransactionModel
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.components.ExchangeStatusNotification
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.express.ExchangeStatusState
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.express.ExchangeUM
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents
|
||||
import com.tangem.features.tokendetails.impl.R
|
||||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.converter.Converter
|
||||
|
|
@ -131,7 +131,10 @@ internal class TokenDetailsSwapTransactionsStateConverter(
|
|||
notification = notification,
|
||||
statuses = getStatuses(statusModel.status, hasFailed),
|
||||
showProviderLink = showProviderLink,
|
||||
info = tx.info.copy(txExternalUrl = statusModel.txExternalUrl),
|
||||
info = tx.info.copy(
|
||||
txExternalId = statusModel.txExternalId,
|
||||
txExternalUrl = statusModel.txExternalUrl,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import com.tangem.domain.onramp.model.OnrampStatus.Status.*
|
|||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||
import com.tangem.domain.tokens.model.analytics.TokenOnrampAnalyticsEvent
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents
|
||||
import com.tangem.domain.wallets.models.UserWallet
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.factory.TokenDetailsOnrampTransactionStateConverter
|
||||
import com.tangem.utils.Provider
|
||||
|
|
@ -89,7 +89,13 @@ internal class OnrampStatusFactory @AssistedInject constructor(
|
|||
},
|
||||
ifRight = { statusModel ->
|
||||
sendStatusUpdateAnalytics(onrampTx, statusModel)
|
||||
onrampTx.copy(activeStatus = statusModel.status)
|
||||
onrampTx.copy(
|
||||
activeStatus = statusModel.status,
|
||||
info = onrampTx.info.copy(
|
||||
txExternalId = statusModel.externalTxId,
|
||||
txExternalUrl = statusModel.externalTxUrl,
|
||||
),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue