Updated on 2026-08-14
This commit is contained in:
parent
324f365771
commit
b91efa6730
10 changed files with 29 additions and 31 deletions
|
|
@ -33,7 +33,6 @@ sealed class TokenDetailsNotification(
|
|||
|
||||
data class ExistentialDeposit(
|
||||
private val existentialInfo: CryptoCurrencyWarning.ExistentialDeposit,
|
||||
private val onCloseClick: () -> Unit,
|
||||
) : TokenDetailsNotification(
|
||||
config = NotificationConfig(
|
||||
title = TextReference.Str("Existential Deposit"),
|
||||
|
|
@ -42,7 +41,6 @@ sealed class TokenDetailsNotification(
|
|||
formatArgs = wrappedList(existentialInfo.currencyName, existentialInfo.edStringValueWithSymbol),
|
||||
),
|
||||
iconResId = R.drawable.img_attention_20,
|
||||
onCloseClick = onCloseClick,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDeta
|
|||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.components.TokenDetailsNotification
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.viewmodels.TokenDetailsClickIntents
|
||||
import com.tangem.utils.converter.Converter
|
||||
import com.tangem.utils.extensions.removeBy
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
|
|
@ -18,12 +17,6 @@ internal class TokenDetailsNotificationConverter(
|
|||
return value.map(::mapToNotification).toImmutableList()
|
||||
}
|
||||
|
||||
fun removeExistentialDeposit(currentState: TokenDetailsState): ImmutableList<TokenDetailsNotification> {
|
||||
val newNotifications = currentState.notifications.toMutableList()
|
||||
newNotifications.removeBy { it is TokenDetailsNotification.ExistentialDeposit }
|
||||
return newNotifications.toImmutableList()
|
||||
}
|
||||
|
||||
fun getStateRentInfoVisibility(
|
||||
currentState: TokenDetailsState,
|
||||
isVisible: Boolean,
|
||||
|
|
@ -44,7 +37,6 @@ internal class TokenDetailsNotificationConverter(
|
|||
)
|
||||
is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.ExistentialDeposit(
|
||||
existentialInfo = warning,
|
||||
onCloseClick = clickIntents::onCloseExistentialDepositNotification,
|
||||
)
|
||||
is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.RentInfo(
|
||||
rentInfo = warning,
|
||||
|
|
|
|||
|
|
@ -210,11 +210,6 @@ internal class TokenDetailsStateFactory(
|
|||
return state.copy(notifications = notificationConverter.convert(warnings))
|
||||
}
|
||||
|
||||
fun getStateWithRemovedExistentialNotification(): TokenDetailsState {
|
||||
val state = currentStateProvider()
|
||||
return state.copy(notifications = notificationConverter.removeExistentialDeposit(state))
|
||||
}
|
||||
|
||||
fun getStateWithRemovedRentNotification(): TokenDetailsState {
|
||||
val state = currentStateProvider()
|
||||
return state.copy(notifications = notificationConverter.getStateRentInfoVisibility(state, false))
|
||||
|
|
|
|||
|
|
@ -29,6 +29,4 @@ interface TokenDetailsClickIntents {
|
|||
fun onDismissBottomSheet()
|
||||
|
||||
fun onCloseRentInfoNotification()
|
||||
|
||||
fun onCloseExistentialDepositNotification()
|
||||
}
|
||||
|
|
@ -148,6 +148,7 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
getCurrencyStatusUpdatesUseCase(
|
||||
userWalletId = selectedWallet.walletId,
|
||||
currencyId = cryptoCurrency.id,
|
||||
refresh = true,
|
||||
)
|
||||
.distinctUntilChanged()
|
||||
.onEach { either ->
|
||||
|
|
@ -373,10 +374,6 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
uiState = stateFactory.getStateWithClosedBottomSheet()
|
||||
}
|
||||
|
||||
override fun onCloseExistentialDepositNotification() {
|
||||
uiState = stateFactory.getStateWithRemovedExistentialNotification()
|
||||
}
|
||||
|
||||
override fun onCloseRentInfoNotification() {
|
||||
uiState = stateFactory.getStateWithRemovedRentNotification()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue