Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-30 21:18:27 +08:00
parent 404c496cf2
commit 453da7e5b9
5 changed files with 13 additions and 9 deletions

View file

@ -323,7 +323,7 @@ internal object WalletPreviewData {
persistentListOf(
WalletManageButton.Buy(enabled = true, onClick = {}),
WalletManageButton.Send(enabled = true, onClick = {}),
WalletManageButton.Receive(onClick = {}),
WalletManageButton.Receive(enabled = true, onClick = {}),
WalletManageButton.Sell(enabled = true, onClick = {}),
WalletManageButton.Swap(enabled = true, onClick = {}),
)

View file

@ -15,6 +15,9 @@ import com.tangem.feature.wallet.impl.R
@Immutable
internal sealed class WalletManageButton(val config: ActionButtonConfig) {
/** Is click enabled */
abstract val enabled: Boolean
/** Lambda be invoked when manage button is clicked */
abstract val onClick: () -> Unit
@ -24,7 +27,7 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) {
* @property enabled button click availability
* @property onClick lambda be invoked when Buy button is clicked
*/
data class Buy(val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
data class Buy(override val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_buy),
iconResId = R.drawable.ic_plus_24,
@ -39,7 +42,7 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) {
* @property enabled button click availability
* @property onClick lambda be invoked when Send button is clicked
*/
data class Send(val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
data class Send(override val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_send),
iconResId = R.drawable.ic_arrow_up_24,
@ -53,12 +56,12 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) {
*
* @property onClick lambda be invoked when Receive button is clicked
*/
data class Receive(override val onClick: () -> Unit) : WalletManageButton(
data class Receive(override val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_receive),
iconResId = R.drawable.ic_arrow_down_24,
onClick = onClick,
enabled = true,
enabled = enabled,
),
)
@ -68,7 +71,7 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) {
* @property enabled button click availability
* @property onClick lambda be invoked when Sell button is clicked
*/
data class Sell(val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
data class Sell(override val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_sell),
iconResId = R.drawable.ic_currency_24,
@ -83,7 +86,7 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) {
* @property enabled button click availability
* @property onClick lambda be invoked when Swap button is clicked
*/
data class Swap(val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
data class Swap(override val enabled: Boolean, override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_swap),
iconResId = R.drawable.ic_exchange_vertical_24,

View file

@ -42,6 +42,7 @@ internal class WalletCryptoCurrencyActionsConverter(
}
is TokenActionsState.ActionState.Receive -> {
WalletManageButton.Receive(
enabled = action.enabled,
onClick = { clickIntents.onReceiveClick(cryptoCurrencyStatus) },
)
}

View file

@ -72,7 +72,7 @@ internal class WalletLockedConverter(
is WalletManageButton.Sell -> button.copy(enabled = false)
is WalletManageButton.Send -> button.copy(enabled = false)
is WalletManageButton.Swap -> button.copy(enabled = false)
is WalletManageButton.Receive -> button
is WalletManageButton.Receive -> button.copy(enabled = false)
}
}
.toPersistentList()

View file

@ -148,7 +148,7 @@ internal class WalletSkeletonStateConverter(
return persistentListOf(
WalletManageButton.Buy(enabled = false, onClick = {}),
WalletManageButton.Send(enabled = false, onClick = {}),
WalletManageButton.Receive(onClick = {}),
WalletManageButton.Receive(enabled = false, onClick = {}),
WalletManageButton.Sell(enabled = false, onClick = {}),
)
}