Skip to content

Commit

Permalink
Merge branch 'volume-currency'
Browse files Browse the repository at this point in the history
  • Loading branch information
shorthouse committed Mar 27, 2024
2 parents 6467d37 + c2d061b commit a0ac4cb
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -170,8 +170,8 @@ class DetailsScreenTest {
onNodeWithText("2").assertIsDisplayed()
onNodeWithText("Market Cap").assertIsDisplayed()
onNodeWithText("$225,722,901,094.00").assertIsDisplayed()
onNodeWithText("Volume 24h").assertIsDisplayed()
onNodeWithText("6,627,669,115").assertIsDisplayed()
onNodeWithText("Volume (24h)").assertIsDisplayed()
onNodeWithText("$6,627,669,115.00").assertIsDisplayed()
onNodeWithText("Circulating Supply").assertIsDisplayed()
onNodeWithText("120,186,525").assertIsDisplayed()
onNodeWithText("All Time High").assertIsDisplayed()
Expand All @@ -196,7 +196,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -250,7 +250,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -306,7 +306,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -366,7 +366,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -409,7 +409,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -454,7 +454,7 @@ class DetailsScreenTest {
currentPrice = Price("1879.14", currency = currency),
marketCap = Price("225722901094", currency = currency),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6627669115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -519,8 +519,8 @@ class DetailsScreenTest {
onNodeWithText("2").assertIsDisplayed()
onNodeWithText("Market Cap").assertIsDisplayed()
onNodeWithText("£225,722,901,094.00").assertIsDisplayed()
onNodeWithText("Volume 24h").assertIsDisplayed()
onNodeWithText("6,627,669,115").assertIsDisplayed()
onNodeWithText("Volume (24h)").assertIsDisplayed()
onNodeWithText("$6,627,669,115.00").assertIsDisplayed()
onNodeWithText("Circulating Supply").assertIsDisplayed()
onNodeWithText("120,186,525").assertIsDisplayed()
onNodeWithText("All Time High ($)").assertIsDisplayed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class CoinDetailsMapper @Inject constructor() {
currentPrice = Price(coinDetails?.currentPrice, currency = currency),
marketCap = Price(coinDetails?.marketCap, currency = currency),
marketCapRank = coinDetails?.marketCapRank.orEmpty(),
volume24h = formatNumberOrEmpty(coinDetails?.volume24h),
volume24h = Price(coinDetails?.volume24h, currency = currency),
circulatingSupply = formatNumberOrEmpty(coinDetails?.supply?.circulatingSupply),
// API only support ATH in USD
// API only supports ATH in USD
allTimeHigh = Price(coinDetails?.allTimeHigh?.price, currency = Currency.USD),
allTimeHighDate = epochToDateOrEmpty(coinDetails?.allTimeHigh?.timestamp),
listedDate = epochToDateOrEmpty(coinDetails?.listedAt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data class CoinDetails(
val currentPrice: Price,
val marketCap: Price,
val marketCapRank: String,
val volume24h: String,
val volume24h: Price,
val circulatingSupply: String,
val allTimeHigh: Price,
val allTimeHighDate: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import dev.shorthouse.coinwatch.model.Percentage
import dev.shorthouse.coinwatch.model.Price
import dev.shorthouse.coinwatch.ui.model.ChartPeriod
import dev.shorthouse.coinwatch.ui.screen.details.DetailsUiState
import java.math.BigDecimal
import kotlinx.collections.immutable.persistentListOf
import java.math.BigDecimal

class DetailsUiStatePreviewProvider : PreviewParameterProvider<DetailsUiState> {
override val values = sequenceOf(
Expand All @@ -21,7 +21,7 @@ class DetailsUiStatePreviewProvider : PreviewParameterProvider<DetailsUiState> {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6,627,669,115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -159,7 +159,7 @@ class DetailsUiStatePreviewProvider : PreviewParameterProvider<DetailsUiState> {
BigDecimal("1737.76"),
BigDecimal("1739.52"),
BigDecimal("1742.98"),
BigDecimal("1738.36") // ktlint-disable argument-list-wrapping
BigDecimal("1738.36")
),
minPrice = Price("1632.46"),
maxPrice = Price("1922.83"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun MarketStatsCard(
),
CoinDetailsListItem(
nameId = R.string.list_item_volume_24h,
value = coinDetails.volume24h
value = coinDetails.volume24h.formattedAmount
),
CoinDetailsListItem(
nameId = R.string.list_item_circulating_supply,
Expand Down Expand Up @@ -115,7 +115,7 @@ private fun MarketStatsCardPreview() {
currentPrice = Price("1879.14"),
marketCap = Price("225722901094"),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6,627,669,115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26"),
allTimeHighDate = "10 Nov 2021",
Expand All @@ -138,7 +138,7 @@ private fun MarketStatsCardPreviewNotDollar() {
currentPrice = Price("1879.14", currency = Currency.GBP),
marketCap = Price("225722901094", currency = Currency.GBP),
marketCapRank = "2",
volume24h = "6,627,669,115",
volume24h = Price("6,627,669,115"),
circulatingSupply = "120,186,525",
allTimeHigh = Price("4878.26", currency = Currency.USD),
allTimeHighDate = "10 Nov 2021",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<string name="list_item_ath">All Time High</string>
<string name="list_item_ath_dollar_only">All Time High ($)</string>
<string name="list_item_ath_date">All Time High Date</string>
<string name="list_item_volume_24h">Volume 24h</string>
<string name="list_item_volume_24h">Volume (24h)</string>
<string name="list_item_listed_date">Listed Date</string>
<string name="empty_state_favourite_coins_title">No favourite coins</string>
<string name="empty_state_favourite_coins_subtitle_start">Tap the</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CoinDetailsMapperTest {
currentPrice = Price(null),
marketCap = Price(null),
marketCapRank = "",
volume24h = "",
volume24h = Price(null),
circulatingSupply = "",
allTimeHigh = Price(null),
allTimeHighDate = "",
Expand Down Expand Up @@ -67,7 +67,7 @@ class CoinDetailsMapperTest {
currentPrice = Price(null),
marketCap = Price(null),
marketCapRank = "",
volume24h = "",
volume24h = Price(null),
circulatingSupply = "",
allTimeHigh = Price(null),
allTimeHighDate = "",
Expand Down Expand Up @@ -113,7 +113,7 @@ class CoinDetailsMapperTest {
currentPrice = Price(null),
marketCap = Price(null),
marketCapRank = "",
volume24h = "",
volume24h = Price(null),
circulatingSupply = "",
allTimeHigh = Price(null),
allTimeHighDate = "",
Expand Down Expand Up @@ -164,7 +164,7 @@ class CoinDetailsMapperTest {
currentPrice = Price("29490.954785191607"),
marketCap = Price("515076089546.27606"),
marketCapRank = "1",
volume24h = "",
volume24h = Price("abcdefg"),
circulatingSupply = "",
allTimeHigh = Price("68763.41083248306"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -215,7 +215,7 @@ class CoinDetailsMapperTest {
currentPrice = Price("29490.954785191607"),
marketCap = Price("515076089546.27606"),
marketCapRank = "1",
volume24h = "9,294,621,082.274",
volume24h = Price("9294621082.273935"),
circulatingSupply = "19,508,368",
allTimeHigh = Price("68763.41083248306"),
allTimeHighDate = "",
Expand Down Expand Up @@ -266,7 +266,7 @@ class CoinDetailsMapperTest {
currentPrice = Price("29490.954785191607"),
marketCap = Price("515076089546.27606"),
marketCapRank = "1",
volume24h = "9,294,621,082.274",
volume24h = Price("9294621082.273935"),
circulatingSupply = "19,508,368",
allTimeHigh = Price("68763.41083248306"),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -319,7 +319,7 @@ class CoinDetailsMapperTest {
currentPrice = Price("29490.954785191607", currency = currency),
marketCap = Price("515076089546.27606", currency = currency),
marketCapRank = "1",
volume24h = "9,294,621,082.274",
volume24h = Price("9294621082.273935", currency = currency),
circulatingSupply = "19,508,368",
allTimeHigh = Price("68763.41083248306", currency = Currency.USD),
allTimeHighDate = "10 Nov 2021",
Expand Down Expand Up @@ -372,7 +372,7 @@ class CoinDetailsMapperTest {
currentPrice = Price("29490.954785191607", currency = currency),
marketCap = Price("515076089546.27606", currency = currency),
marketCapRank = "1",
volume24h = "9,294,621,082.274",
volume24h = Price("9294621082.273935", currency = currency),
circulatingSupply = "19,508,368",
allTimeHigh = Price("68763.41083248306", currency = Currency.USD),
allTimeHighDate = "10 Nov 2021",
Expand Down

0 comments on commit a0ac4cb

Please sign in to comment.