Updated on 2026-08-14
This commit is contained in:
parent
45ab6836ad
commit
5c56f04c38
52 changed files with 228 additions and 72 deletions
|
|
@ -1,12 +1,14 @@
|
|||
package com.tangem.feature.tokendetails.presentation.tokendetails.state.components
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.common.ui.userwallet.ext.walletInterationIcon
|
||||
import com.tangem.core.ui.components.notifications.NotificationConfig
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.networkIconResId
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.wrappedList
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning
|
||||
import com.tangem.features.tokendetails.impl.R
|
||||
import org.joda.time.DateTime
|
||||
|
|
@ -212,6 +214,7 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
|
|||
)
|
||||
|
||||
data class KaspaIncompleteTransactionWarning(
|
||||
private val userWallet: UserWallet,
|
||||
private val currency: CryptoCurrency,
|
||||
private val amount: String,
|
||||
private val currencySymbol: String,
|
||||
|
|
@ -227,7 +230,7 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
|
|||
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
|
||||
text = resourceReference(R.string.alert_button_try_again),
|
||||
onClick = onRetryIncompleteTransactionClick,
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
iconResId = walletInterationIcon(userWallet),
|
||||
),
|
||||
onCloseClick = onDismissIncompleteTransactionClick,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.feature.tokendetails.presentation.tokendetails.state.factory
|
||||
|
||||
import arrow.core.getOrElse
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
|
|
@ -7,9 +8,11 @@ import com.tangem.core.ui.format.bigdecimal.crypto
|
|||
import com.tangem.core.ui.format.bigdecimal.format
|
||||
import com.tangem.core.ui.format.bigdecimal.shorted
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning
|
||||
import com.tangem.domain.tokens.model.warnings.HederaWarnings
|
||||
import com.tangem.domain.tokens.model.warnings.KaspaWarnings
|
||||
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
|
||||
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.components.TokenDetailsNotification
|
||||
|
|
@ -23,6 +26,8 @@ import timber.log.Timber
|
|||
import java.math.BigDecimal
|
||||
|
||||
internal class TokenDetailsNotificationConverter(
|
||||
private val userWalletId: UserWalletId,
|
||||
private val getUserWalletUseCase: GetUserWalletUseCase,
|
||||
private val clickIntents: TokenDetailsClickIntents,
|
||||
) : Converter<Set<CryptoCurrencyWarning>, ImmutableList<TokenDetailsNotification>> {
|
||||
|
||||
|
|
@ -131,6 +136,8 @@ internal class TokenDetailsNotificationConverter(
|
|||
onOpenClick = clickIntents::onOpenTrustlineClick,
|
||||
)
|
||||
is KaspaWarnings.IncompleteTransaction -> KaspaIncompleteTransactionWarning(
|
||||
userWallet = getUserWalletUseCase.invoke(userWalletId)
|
||||
.getOrElse { error("Cannot find user wallet with id: ${userWalletId.stringValue}") },
|
||||
currency = warning.currency,
|
||||
amount = warning.amount.format { crypto(symbol = "", decimals = warning.currencyDecimals) },
|
||||
currencySymbol = warning.currencySymbol,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,11 @@ internal class TokenDetailsStateFactory(
|
|||
}
|
||||
|
||||
private val notificationConverter by lazy {
|
||||
TokenDetailsNotificationConverter(clickIntents = clickIntents)
|
||||
TokenDetailsNotificationConverter(
|
||||
userWalletId = userWalletId,
|
||||
getUserWalletUseCase = getUserWalletUseCase,
|
||||
clickIntents = clickIntents,
|
||||
)
|
||||
}
|
||||
|
||||
private val tokenDetailsLoadedBalanceConverter by lazy {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue