Skip to content

Commit f109aea

Browse files
committed
Update fee info
1 parent 11d5478 commit f109aea

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

app/src/main/java/one/mixin/android/compose/theme/Theme.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,20 @@ import androidx.compose.runtime.compositionLocalOf
1616
import androidx.compose.ui.graphics.Color
1717
import androidx.compose.ui.graphics.colorspace.ColorSpaces
1818
import androidx.compose.ui.platform.LocalContext
19+
import androidx.compose.ui.platform.LocalInspectionMode
1920
import one.mixin.android.MixinApplication
2021
import one.mixin.android.extension.isNightMode
2122
import one.mixin.android.extension.isScreenWideColorGamut
2223
import one.mixin.android.util.isCurrChinese
2324

24-
val isP3Supported = MixinApplication.appContext.isScreenWideColorGamut()
25+
val isP3Supported by lazy {
26+
if (isP3Enabled) {
27+
MixinApplication.appContext.isScreenWideColorGamut()
28+
} else {
29+
false
30+
}
31+
}
32+
private var isP3Enabled = true
2533

2634
class AppColors(
2735
val primary: Color,
@@ -151,9 +159,10 @@ private val LocalColors = compositionLocalOf { LightColorPalette }
151159

152160
@Composable
153161
fun MixinAppTheme(
154-
darkTheme: Boolean = MixinApplication.get().isNightMode(),
162+
darkTheme: Boolean = if (LocalInspectionMode.current) false else MixinApplication.get().isNightMode(),
155163
content: @Composable () -> Unit,
156164
) {
165+
isP3Enabled = !LocalInspectionMode.current
157166
val colors =
158167
if (darkTheme) {
159168
DarkColorPalette

app/src/main/java/one/mixin/android/ui/home/web3/BrowserPage.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,17 @@ fun BrowserPage(
328328
Box(modifier = Modifier.height(10.dp))
329329
}
330330
val fee = tipGas?.displayValue(transaction?.maxFeePerGas) ?: solanaFee?.stripTrailingZeros() ?: BigDecimal.ZERO
331+
val feeSymbol = asset?.symbol ?: chain.symbol
331332
if (fee == BigDecimal.ZERO) {
332333
FeeInfo(
333-
amount = "$fee",
334+
amount = "$fee $feeSymbol",
334335
fee = fee.multiply(asset.priceUSD()),
335336
isFree = isFeeWaived,
336337
onFreeClick = onFreeClick,
337338
)
338339
} else {
339340
FeeInfo(
340-
amount = "$fee ${asset?.symbol ?: ""}",
341+
amount = "$fee $feeSymbol",
341342
fee = fee.multiply(asset.priceUSD()),
342343
gasPrice = tipGas?.displayGas(transaction?.maxFeePerGas)?.toPlainString(),
343344
isFree = isFeeWaived,

app/src/main/java/one/mixin/android/ui/home/web3/components/Component.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,10 @@ fun ParsedTxPreview(
204204
if (parsedTx == null) {
205205
BalanceChangeHead()
206206
CircularProgressIndicator(
207-
modifier = Modifier.size(32.dp),
207+
modifier = Modifier.size(48.dp),
208208
color = MixinAppTheme.colors.accent,
209209
)
210+
Box(modifier = Modifier.height(14.dp))
210211
} else if (parsedTx.instructions?.isEmpty() == true) {
211212
BalanceChangeHead()
212213
Row(
@@ -521,6 +522,13 @@ private fun SingleBalanceChangeItem(
521522
maxLines = 1,
522523
fontSize = 12.sp,
523524
)
525+
} else {
526+
Text(
527+
text = " ", //holder
528+
color = MixinAppTheme.colors.textAssist,
529+
maxLines = 1,
530+
fontSize = 12.sp,
531+
)
524532
}
525533
}
526534

@@ -558,6 +566,13 @@ private fun BalanceChangeItem(
558566
maxLines = 1,
559567
fontSize = 12.sp,
560568
)
569+
} else {
570+
Text(
571+
text = " ", //holder
572+
color = MixinAppTheme.colors.textAssist,
573+
maxLines = 1,
574+
fontSize = 12.sp,
575+
)
561576
}
562577
}
563578
}

app/src/main/java/one/mixin/android/ui/tip/wc/sessionrequest/SessionRequestPage.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,17 @@ fun SessionRequestPage(
326326
}
327327
Box(modifier = Modifier.height(20.dp))
328328

329+
val feeSymbol = asset?.symbol ?: chain.symbol
329330
if (fee == BigDecimal.ZERO) {
330331
FeeInfo(
331-
amount = "$fee",
332+
amount = "$fee $feeSymbol",
332333
fee = fee.multiply(asset.priceUSD()),
333334
isFree = isFeeWaived,
334335
onFreeClick = onFreeClick,
335336
)
336337
} else {
337338
FeeInfo(
338-
amount = "$fee ${asset?.symbol}",
339+
amount = "$fee $feeSymbol",
339340
fee = fee.multiply(asset.priceUSD()),
340341
gasPrice = tipGas?.displayGas(
341342
if (sessionRequestUI.data is WCEthereumTransaction) {

0 commit comments

Comments
 (0)