Skip to content

Commit

Permalink
Show sync state for wallets on Balance Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Sep 29, 2023
1 parent 229b30b commit 0b43f6d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ data class BalanceViewItem2(
val secondaryValue: DeemedValue<String>,
val sendEnabled: Boolean = false,
val syncingProgress: SyncingProgress,
val syncingTextValue: String?,
val syncedUntilTextValue: String?,
val failedIconVisible: Boolean,
val badge: String?,
val swapEnabled: Boolean = false,
Expand Down Expand Up @@ -296,6 +298,8 @@ class BalanceViewItemFactory {
diff = item.coinPrice?.diff,
sendEnabled = state is AdapterState.Synced,
syncingProgress = getSyncingProgress(state, wallet.token.blockchainType),
syncingTextValue = getSyncingText(state),
syncedUntilTextValue = getSyncedUntilText(state),
failedIconVisible = state is AdapterState.NotSynced,
badge = wallet.badge,
swapEnabled = state is AdapterState.Synced,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,35 +198,48 @@ fun BalanceCardInner(
Box(
modifier = Modifier.weight(1f),
) {
when (type) {
BalanceCardSubtitleType.Rate -> {
if (viewItem.exchangeValue.visible) {
Row {
Text(
text = viewItem.exchangeValue.value,
color = if (viewItem.exchangeValue.dimmed) ComposeAppTheme.colors.grey50 else ComposeAppTheme.colors.grey,
style = ComposeAppTheme.typography.subhead2,
maxLines = 1,
)
Text(
modifier = Modifier.padding(start = 4.dp),
text = RateText(viewItem.diff),
color = RateColor(viewItem.diff),
style = ComposeAppTheme.typography.subhead2,
maxLines = 1,
)
if (viewItem.syncingTextValue != null) {
subhead2_grey(
text = viewItem.syncingTextValue,
maxLines = 1,
)
} else {
when (type) {
BalanceCardSubtitleType.Rate -> {
if (viewItem.exchangeValue.visible) {
Row {
Text(
text = viewItem.exchangeValue.value,
color = if (viewItem.exchangeValue.dimmed) ComposeAppTheme.colors.grey50 else ComposeAppTheme.colors.grey,
style = ComposeAppTheme.typography.subhead2,
maxLines = 1,
)
Text(
modifier = Modifier.padding(start = 4.dp),
text = RateText(viewItem.diff),
color = RateColor(viewItem.diff),
style = ComposeAppTheme.typography.subhead2,
maxLines = 1,
)
}
}
}
}
BalanceCardSubtitleType.CoinName -> {
subhead2_grey(text = viewItem.coinTitle)

BalanceCardSubtitleType.CoinName -> {
subhead2_grey(text = viewItem.coinTitle)
}
}
}
}
Box(
modifier = Modifier.padding(start = 16.dp),
) {
if (viewItem.secondaryValue.visible) {
if (viewItem.syncedUntilTextValue != null) {
subhead2_grey(
text = viewItem.syncedUntilTextValue,
maxLines = 1,
)
} else if (viewItem.secondaryValue.visible) {
Text(
text = viewItem.secondaryValue.value,
color = if (viewItem.secondaryValue.dimmed) ComposeAppTheme.colors.grey50 else ComposeAppTheme.colors.grey,
Expand Down

0 comments on commit 0b43f6d

Please sign in to comment.