Fixes the zap options available for the Zap the Devs button.

This commit is contained in:
Vitor Pamplona
2024-09-06 11:36:01 -04:00
parent c19e1fc56d
commit bbb548fe21
@@ -90,6 +90,7 @@ import com.vitorpamplona.amethyst.ui.theme.imageModifier
import com.vitorpamplona.quartz.events.Event import com.vitorpamplona.quartz.events.Event
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -289,7 +290,7 @@ fun ZapDonationButton(
animationSize: Dp = 14.dp, animationSize: Dp = 14.dp,
nav: INav, nav: INav,
) { ) {
var wantsToZap by remember { mutableStateOf<List<Long>?>(null) } var wantsToZap by remember { mutableStateOf<ImmutableList<Long>?>(null) }
var showErrorMessageDialog by remember { mutableStateOf<String?>(null) } var showErrorMessageDialog by remember { mutableStateOf<String?>(null) }
var wantsToPay by var wantsToPay by
remember(baseNote) { remember(baseNote) {
@@ -313,7 +314,7 @@ fun ZapDonationButton(
onZappingProgress = { progress: Float -> onZappingProgress = { progress: Float ->
scope.launch { zappingProgress = progress } scope.launch { zappingProgress = progress }
}, },
onMultipleChoices = { options -> wantsToZap = options }, onMultipleChoices = { options -> wantsToZap = options.toImmutableList() },
onError = { _, message -> onError = { _, message ->
scope.launch { scope.launch {
zappingProgress = 0f zappingProgress = 0f
@@ -325,9 +326,10 @@ fun ZapDonationButton(
}, },
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
) { ) {
if (wantsToZap != null) { wantsToZap?.let {
ZapAmountChoicePopup( ZapAmountChoicePopup(
baseNote = baseNote, baseNote = baseNote,
zapAmountChoices = it,
popupYOffset = iconSize, popupYOffset = iconSize,
accountViewModel = accountViewModel, accountViewModel = accountViewModel,
onDismiss = { onDismiss = {