Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
trbutler4 committed Nov 2, 2024
1 parent 1298490 commit 35cae6d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface CoinGeckoApi {
"x-cg-demo-api-key: CG-mRdWfNFoZnKVan4GNdTrhZjL"
)
@GET("coins/list")
suspend fun getTokenIds(@Query("include_platform") include_platform:Boolean):TokenIdsResponse
suspend fun getTokenIds(@Query("include_platform") includePlatform:Boolean):TokenIdsResponse

@Headers("accept: application/json", "x-cg-demo-api-key: CG-mRdWfNFoZnKVan4GNdTrhZjL")
@GET("coins/{id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

@Database(entities = [Token::class], version = 1, exportSchema = false)
@Database(entities = [Token::class], version = 2, exportSchema = false)
@TypeConverters(Converters::class)
abstract class TokenDatabase : RoomDatabase() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.withContext
import java.text.NumberFormat
import java.util.Locale


@Composable
Expand Down Expand Up @@ -183,8 +185,16 @@ fun Wallet(modifier: Modifier, onNewTokenPress: () -> Unit, onReceivePress: () -
}


val totalBalance = balances.flatMap { balanceMap ->
balanceMap.entries.map { (token, balance) ->
val price = coinsPrices[token] ?: 0.0
balance * price
}

}.sum()
val formatter = NumberFormat.getCurrencyInstance(Locale.US)
Text(
text ="$11,625.48",
text = formatter.format(totalBalance),
fontFamily = FontFamily(Font(R.font.publicsans_bold)),
color = Color.White,
fontSize = 24.sp,
Expand Down

0 comments on commit 35cae6d

Please sign in to comment.