Updated on 2026-08-14
This commit is contained in:
commit
3e5ab44b4c
35 changed files with 225 additions and 59 deletions
|
|
@ -14,6 +14,7 @@ import com.tangem.utils.converter.Converter
|
|||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.*
|
||||
import java.util.UUID
|
||||
|
||||
internal class TokenDetailsTxHistoryItemFlowConverter(
|
||||
private val currentStateProvider: Provider<TokenDetailsState>,
|
||||
|
|
@ -71,7 +72,10 @@ internal class TokenDetailsTxHistoryItemFlowConverter(
|
|||
// If [afterDate] is the first transaction in the flow, add the group title
|
||||
val afterDate = after.getTimestamp()?.toDateFormat() ?: return@insertSeparators null
|
||||
if (before is TxHistoryItemState.Title) {
|
||||
return@insertSeparators TxHistoryItemState.GroupTitle(afterDate)
|
||||
return@insertSeparators TxHistoryItemState.GroupTitle(
|
||||
title = afterDate,
|
||||
itemKey = UUID.randomUUID().toString(),
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -80,7 +84,10 @@ internal class TokenDetailsTxHistoryItemFlowConverter(
|
|||
*/
|
||||
val beforeDate = before.getTimestamp()?.toDateFormat() ?: return@insertSeparators null
|
||||
return@insertSeparators if (beforeDate != afterDate) {
|
||||
TxHistoryItemState.GroupTitle(afterDate)
|
||||
TxHistoryItemState.GroupTitle(
|
||||
title = afterDate,
|
||||
itemKey = UUID.randomUUID().toString(),
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,7 +418,10 @@ internal object WalletPreviewData {
|
|||
contentItems = MutableStateFlow(
|
||||
PagingData.from(
|
||||
listOf(
|
||||
TxHistoryState.TxHistoryItemState.GroupTitle("Today"),
|
||||
TxHistoryState.TxHistoryItemState.GroupTitle(
|
||||
title = "Today",
|
||||
itemKey = UUID.randomUUID().toString(),
|
||||
),
|
||||
TxHistoryState.TxHistoryItemState.Transaction(
|
||||
TransactionState.Content(
|
||||
txHash = UUID.randomUUID().toString(),
|
||||
|
|
@ -432,7 +435,10 @@ internal object WalletPreviewData {
|
|||
onClick = {},
|
||||
),
|
||||
),
|
||||
TxHistoryState.TxHistoryItemState.GroupTitle("Yesterday"),
|
||||
TxHistoryState.TxHistoryItemState.GroupTitle(
|
||||
title = "Yesterday",
|
||||
itemKey = UUID.randomUUID().toString(),
|
||||
),
|
||||
TxHistoryState.TxHistoryItemState.Transaction(
|
||||
TransactionState.Content(
|
||||
txHash = UUID.randomUUID().toString(),
|
||||
|
|
|
|||
|
|
@ -45,13 +45,18 @@ internal fun TokenItem(
|
|||
.tokenClickable(state = state)
|
||||
.background(color = TangemTheme.colors.background.primary),
|
||||
) {
|
||||
TokenIcon(state = state.iconState, modifier = Modifier.layoutId(layoutId = LayoutId.ICON))
|
||||
TokenIcon(
|
||||
state = state.iconState,
|
||||
modifier = Modifier
|
||||
.layoutId(layoutId = LayoutId.ICON)
|
||||
.padding(end = TangemTheme.dimens.spacing8),
|
||||
)
|
||||
|
||||
TokenTitle(
|
||||
state = state.titleState,
|
||||
modifier = Modifier
|
||||
.layoutId(layoutId = LayoutId.TITLE)
|
||||
.padding(horizontal = TangemTheme.dimens.spacing8)
|
||||
.padding(end = TangemTheme.dimens.spacing8)
|
||||
.padding(bottom = betweenRowsMargin),
|
||||
)
|
||||
|
||||
|
|
@ -67,7 +72,7 @@ internal fun TokenItem(
|
|||
state = state.cryptoPriceState,
|
||||
modifier = Modifier
|
||||
.layoutId(layoutId = LayoutId.CRYPTO_PRICE)
|
||||
.padding(horizontal = TangemTheme.dimens.spacing8),
|
||||
.padding(end = TangemTheme.dimens.spacing8),
|
||||
)
|
||||
|
||||
TokenCryptoAmount(
|
||||
|
|
@ -233,7 +238,10 @@ private fun CustomContainer(state: TokenItemState, modifier: Modifier = Modifier
|
|||
)
|
||||
|
||||
cryptoAmount?.placeRelative(
|
||||
x = layoutWidth - cryptoAmount.width - layoutPadding,
|
||||
x = when (state) {
|
||||
is TokenItemState.Draggable -> layoutPadding + icon.width
|
||||
else -> layoutWidth - cryptoAmount.width - layoutPadding
|
||||
},
|
||||
y = layoutHeight - cryptoAmount.height - layoutPadding,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import kotlinx.coroutines.Dispatchers
|
|||
import kotlinx.coroutines.flow.*
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.DateTimeZone
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* Convert from [Flow] of [TxHistoryItem] to [TxHistoryState]
|
||||
|
|
@ -83,7 +84,10 @@ internal class WalletTxHistoryItemFlowConverter(
|
|||
// If [afterDate] is the first transaction in the flow, add the group title
|
||||
val afterDate = after.getTimestamp()?.toDateFormat() ?: return@insertSeparators null
|
||||
if (before is TxHistoryItemState.Title) {
|
||||
return@insertSeparators TxHistoryItemState.GroupTitle(afterDate)
|
||||
return@insertSeparators TxHistoryItemState.GroupTitle(
|
||||
title = afterDate,
|
||||
itemKey = UUID.randomUUID().toString(),
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -92,7 +96,7 @@ internal class WalletTxHistoryItemFlowConverter(
|
|||
*/
|
||||
val beforeDate = before.getTimestamp()?.toDateFormat() ?: return@insertSeparators null
|
||||
return@insertSeparators if (beforeDate != afterDate) {
|
||||
TxHistoryItemState.GroupTitle(afterDate)
|
||||
TxHistoryItemState.GroupTitle(title = afterDate, itemKey = UUID.randomUUID().toString())
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,6 +431,12 @@ internal class WalletViewModel @Inject constructor(
|
|||
|
||||
override fun onBackupCardClick() {
|
||||
analyticsEventsHandler.send(WalletScreenAnalyticsEvent.MainScreen.NoticeBackupYourWalletTapped)
|
||||
reduxStateHolder.dispatch(
|
||||
LegacyAction.StartOnboardingProcess(
|
||||
scanResponse = getSelectedWallet().scanResponse,
|
||||
canSkipBackup = false,
|
||||
),
|
||||
)
|
||||
router.openOnboardingScreen()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue