@@ -76,46 +76,27 @@ fun BalanceHeaderView(
7676 val shouldHideBalance = useSwipeToHide && hideBalance
7777 val allowSwipeToHide = useSwipeToHide && isSwipeToHideEnabled
7878
79- converted?.let { converted ->
80- val btcComponents = converted.bitcoinDisplay(displayUnit)
79+ converted?.let { fiat ->
80+ val btc = fiat.bitcoinDisplay(displayUnit)
81+ val isBitcoinPrimary = primaryDisplay == PrimaryDisplay .BITCOIN
8182
82- if (primaryDisplay == PrimaryDisplay .BITCOIN ) {
83- BalanceHeader (
84- modifier = modifier,
85- smallRowSymbol = converted.symbol,
86- smallRowText = converted.formatted,
87- smallRowModifier = Modifier .testTag(" $testTag -secondary" ),
88- largeRowPrefix = prefix,
89- largeRowText = btcComponents.value,
90- largeRowSymbol = btcComponents.symbol,
91- largeRowModifier = Modifier .testTag(" $testTag -primary" ),
92- showSymbol = showBitcoinSymbol,
93- hideBalance = shouldHideBalance,
94- isSwipeToHideEnabled = allowSwipeToHide,
95- showEyeIcon = showEyeIcon,
96- onClick = onClick ? : { currency.switchUnit() },
97- onToggleHideBalance = { settings.setHideBalance(! hideBalance) },
98- testTag = testTag,
99- )
100- } else {
101- BalanceHeader (
102- modifier = modifier,
103- smallRowSymbol = btcComponents.symbol,
104- smallRowText = btcComponents.value,
105- smallRowModifier = Modifier .testTag(" $testTag -secondary" ),
106- largeRowPrefix = prefix,
107- largeRowText = converted.formatted,
108- largeRowSymbol = converted.symbol,
109- largeRowModifier = Modifier .testTag(" $testTag -primary" ),
110- showSymbol = true ,
111- hideBalance = shouldHideBalance,
112- isSwipeToHideEnabled = allowSwipeToHide,
113- showEyeIcon = showEyeIcon,
114- onClick = { currency.switchUnit() },
115- onToggleHideBalance = { settings.setHideBalance(! hideBalance) },
116- testTag = testTag,
117- )
118- }
83+ BalanceHeader (
84+ modifier = modifier,
85+ smallRowSymbol = if (isBitcoinPrimary) fiat.symbol else btc.symbol,
86+ smallRowText = if (isBitcoinPrimary) fiat.formatted else btc.value,
87+ smallRowModifier = Modifier .testTag(" $testTag -secondary" ),
88+ largeRowPrefix = prefix,
89+ largeRowText = if (isBitcoinPrimary) btc.value else fiat.formatted,
90+ largeRowSymbol = if (isBitcoinPrimary) btc.symbol else fiat.symbol,
91+ largeRowModifier = Modifier .testTag(" $testTag -primary" ),
92+ showSymbol = if (isBitcoinPrimary) showBitcoinSymbol else true ,
93+ hideBalance = shouldHideBalance,
94+ isSwipeToHideEnabled = allowSwipeToHide,
95+ showEyeIcon = showEyeIcon,
96+ onClick = onClick ? : { currency.switchUnit() },
97+ onToggleHideBalance = { settings.setHideBalance(! hideBalance) },
98+ testTag = testTag,
99+ )
119100 }
120101}
121102
0 commit comments