Updated on 2026-08-14

This commit is contained in:
Tangem 2022-05-31 17:58:50 +04:00
parent fb7aa02b29
commit a2fb7e2ce1
2 changed files with 17 additions and 2 deletions

View file

@ -21,7 +21,7 @@ class LoadAvailableCoinsService(
if (isTestNet) {
return Result.Success(
LoadedCoins(
currencies = currenciesRepository.getTestnetCoins(),
currencies = currenciesRepository.getTestnetCoins().filter(searchInput),
moreAvailable = false,
)
)
@ -59,6 +59,15 @@ class LoadAvailableCoinsService(
)
}
private fun List<Currency>.filter(searchInput: String?): List<Currency> {
if (searchInput.isNullOrBlank()) return this
return filter{
it.symbol.contains(searchInput, ignoreCase = true) ||
it.name.contains(searchInput, ignoreCase = true)
}
}
companion object {
const val LOAD_PER_PAGE = 100
}

View file

@ -84,7 +84,13 @@ class AddTokensFragment : Fragment(R.layout.fragment_add_tokens),
}
val onLoadMore = {
store.dispatch(TokensAction.LoadCurrencies(scanResponse = store.state.globalState.scanResponse))
if (store.state.tokensState.needToLoadMore) {
store.dispatch(
TokensAction.LoadCurrencies(
scanResponse = store.state.globalState.scanResponse
)
)
}
}
cvCurrencies.setContent {