Updated on 2026-08-14
This commit is contained in:
parent
b166701147
commit
ea37cec21f
12 changed files with 100 additions and 64 deletions
|
|
@ -31,7 +31,7 @@ class SwapFragment : Fragment() {
|
|||
viewModel.setRouter(
|
||||
SwapRouter(
|
||||
fragmentManager = WeakReference(parentFragmentManager),
|
||||
customTabsManager = CustomTabsManager(WeakReference(activity?.application)),
|
||||
customTabsManager = CustomTabsManager(WeakReference(context)),
|
||||
),
|
||||
)
|
||||
viewModel.onScreenOpened()
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ class CustomTabsManager(private val context: WeakReference<Context>) {
|
|||
fun openUrl(url: String) {
|
||||
val customTabsIntent = CustomTabsIntent.Builder()
|
||||
.setDefaultColorSchemeParams(
|
||||
CustomTabColorSchemeParams.Builder()
|
||||
.build(),
|
||||
CustomTabColorSchemeParams.Builder().build(),
|
||||
)
|
||||
.build()
|
||||
context.get()?.let { customTabsIntent.launchUrl(it, Uri.parse(url)) }
|
||||
|
|
|
|||
|
|
@ -259,12 +259,16 @@ internal class StateBuilder(val actions: UiActions) {
|
|||
)
|
||||
}
|
||||
|
||||
fun createSuccessState(uiState: SwapStateHolder, txState: TxState.TxSent): SwapStateHolder {
|
||||
fun createSuccessState(
|
||||
uiState: SwapStateHolder,
|
||||
txState: TxState.TxSent,
|
||||
onSecondaryBtnClick: () -> Unit,
|
||||
): SwapStateHolder {
|
||||
return uiState.copy(
|
||||
successState = SwapSuccessStateHolder(
|
||||
fromTokenAmount = txState.fromAmount ?: "",
|
||||
toTokenAmount = txState.toAmount ?: "",
|
||||
onSecondaryButtonClick = {},
|
||||
onSecondaryButtonClick = onSecondaryBtnClick,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,7 +223,17 @@ internal class SwapViewModel @Inject constructor(
|
|||
.onSuccess {
|
||||
when (it) {
|
||||
is TxState.TxSent -> {
|
||||
uiState = stateBuilder.createSuccessState(uiState, it)
|
||||
uiState = stateBuilder.createSuccessState(uiState, it) {
|
||||
val txHash = it.txAddress
|
||||
if (txHash.isNotEmpty()) {
|
||||
swapRouter.openUrl(
|
||||
blockchainInteractor.getExplorerTransactionLink(
|
||||
networkId = dataState.networkId,
|
||||
txAddress = it.txAddress,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
analyticsEventHandler.send(SwapEvents.SwapInProgressScreen)
|
||||
swapRouter.openScreen(SwapScreen.Success)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue