Updated on 2026-08-14
This commit is contained in:
parent
5e42e64172
commit
55eb45a3a2
3 changed files with 7 additions and 5 deletions
|
|
@ -36,7 +36,7 @@ class UserTokensRepository(
|
|||
|
||||
return when (val networkResult = networkService.getUserTokens(userId)) {
|
||||
is Result.Success -> {
|
||||
val tokens = networkResult.data.tokens.map { Currency.fromTokenResponse(it) }
|
||||
val tokens = networkResult.data.tokens.mapNotNull { Currency.fromTokenResponse(it) }
|
||||
storageService.saveUserTokens(card.getUserId(), tokens.toUserTokensResponse())
|
||||
tokens
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class UserTokensStorageService(
|
|||
fun getUserTokens(userId: String): List<Currency>? {
|
||||
return try {
|
||||
val json = fileReader.readFile(getFileNameForUserTokens(userId))
|
||||
userTokensAdapter.fromJson(json)?.tokens?.map { Currency.fromTokenResponse(it) }
|
||||
userTokensAdapter.fromJson(json)?.tokens?.mapNotNull { Currency.fromTokenResponse(it) }
|
||||
} catch (exception: Exception) {
|
||||
Log.error { exception.stackTraceToString() }
|
||||
null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue