Skip to content

Commit a3d1df8

Browse files
authored
fix(wallet): match iOS token order and card-stack spacing (#1222)
Sort balances descending by exact native value, tiebreaking on token name instead of mint address, so equal-value tokens (e.g. LaunchIt / Teddies) order the same as iOS Session.balances. Add a top inset and extra bottom content padding to the wallet list and trim the header spacer so the token-card stack fully collapses, with the spacing above the stack and below the last recent row matching iOS.
1 parent 8c3d545 commit a3d1df8

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/flipcash/features/balance/src/main/kotlin/com/flipcash/app/balance/internal/WalletScreenContent.kt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import androidx.compose.ui.Alignment
2626
import androidx.compose.ui.Modifier
2727
import androidx.compose.ui.graphics.vector.rememberVectorPainter
2828
import androidx.compose.ui.res.stringResource
29+
import androidx.compose.ui.unit.dp
2930
import androidx.lifecycle.compose.collectAsStateWithLifecycle
3031
import com.flipcash.app.core.AppRoute
3132
import com.flipcash.app.core.ui.TokenCardStack
@@ -73,13 +74,14 @@ internal fun WalletScreenContent(
7374
state = listState,
7475
modifier = Modifier.fillMaxSize(),
7576
contentPadding = PaddingValues(
77+
top = CodeTheme.dimens.inset,
7678
start = CodeTheme.dimens.inset,
7779
end = CodeTheme.dimens.inset,
78-
bottom = LocalTabBarPadding.current.calculateBottomPadding(),
80+
bottom = LocalTabBarPadding.current.calculateBottomPadding() + CodeTheme.dimens.grid.x12,
7981
)
8082
) {
8183
item {
82-
Spacer(Modifier.height(CodeTheme.dimens.grid.x20))
84+
Spacer(Modifier.height(CodeTheme.dimens.grid.x15))
8385
}
8486

8587
item {

‎apps/flipcash/shared/tokens/src/main/kotlin/com/flipcash/app/tokens/ui/SelectTokenViewModel.kt‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,11 @@ class SelectTokenViewModel @Inject constructor(
163163
)
164164
}
165165
.sortedWith(
166-
compareByDescending<TokenWithLocalizedBalance> { it.balance.nativeAmount.rounded() }
167-
.thenBy { it.token.address.base58() }
166+
// Match iOS (Session.balances): descending by exact value, then
167+
// alphabetical by name (not by mint address, which reordered equal-value
168+
// tokens like LaunchIt/Teddies differently than iOS).
169+
compareByDescending<TokenWithLocalizedBalance> { it.balance.nativeAmount }
170+
.thenBy { it.token.name }
168171
)
169172
.filter {
170173
val hasBalance = it.balance.nativeAmount.hasDisplayableValue

0 commit comments

Comments
 (0)