Calculating ZapAmount and converting to the screen before exiting the IO thread

This commit is contained in:
Vitor Pamplona 2023-05-06 22:27:00 -04:00
parent b093873eb0
commit dea35552d5

View File

@ -318,7 +318,7 @@ fun ZapReaction(
var zappingProgress by remember { mutableStateOf(0f) }
var wasZappedByLoggedInUser by remember { mutableStateOf(false) }
var zapAmount by remember { mutableStateOf<BigDecimal?>(null) }
var zapAmountTxt by remember { mutableStateOf<String>("") }
LaunchedEffect(key1 = zapsState) {
scope.launch(Dispatchers.IO) {
@ -326,7 +326,7 @@ fun ZapReaction(
wasZappedByLoggedInUser = accountViewModel.calculateIfNoteWasZappedByAccount(zappedNote)
}
zapAmount = account.calculateZappedAmount(zappedNote)
zapAmountTxt = showAmount(account.calculateZappedAmount(zappedNote))
}
}
@ -456,7 +456,7 @@ fun ZapReaction(
}
Text(
showAmount(zapAmount),
zapAmountTxt,
fontSize = 14.sp,
color = grayTint,
modifier = textModifier