mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 14:37:44 +01:00
Simplifying the reaction row zap click.
This commit is contained in:
@@ -861,6 +861,10 @@ fun ZapReaction(
|
|||||||
animationSize: Dp = 14.dp,
|
animationSize: Dp = 14.dp,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
|
val iconButtonModifier = remember {
|
||||||
|
Modifier.size(iconSize)
|
||||||
|
}
|
||||||
|
|
||||||
var wantsToZap by remember { mutableStateOf(false) }
|
var wantsToZap by remember { mutableStateOf(false) }
|
||||||
var wantsToChangeZapAmount by remember { mutableStateOf(false) }
|
var wantsToChangeZapAmount by remember { mutableStateOf(false) }
|
||||||
var wantsToSetCustomZap by remember { mutableStateOf(false) }
|
var wantsToSetCustomZap by remember { mutableStateOf(false) }
|
||||||
@@ -878,43 +882,41 @@ fun ZapReaction(
|
|||||||
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = CenterVertically,
|
verticalAlignment = CenterVertically,
|
||||||
modifier = Modifier
|
modifier = iconButtonModifier.combinedClickable(
|
||||||
.size(iconSize)
|
role = Role.Button,
|
||||||
.combinedClickable(
|
interactionSource = remember { MutableInteractionSource() },
|
||||||
role = Role.Button,
|
indication = rememberRipple(bounded = false, radius = Size24dp),
|
||||||
interactionSource = remember { MutableInteractionSource() },
|
onClick = {
|
||||||
indication = rememberRipple(bounded = false, radius = Size24dp),
|
zapClick(
|
||||||
onClick = {
|
baseNote,
|
||||||
zapClick(
|
accountViewModel,
|
||||||
baseNote,
|
context,
|
||||||
accountViewModel,
|
onZappingProgress = { progress: Float ->
|
||||||
context,
|
scope.launch {
|
||||||
onZappingProgress = { progress: Float ->
|
zappingProgress = progress
|
||||||
scope.launch {
|
|
||||||
zappingProgress = progress
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onMultipleChoices = {
|
|
||||||
wantsToZap = true
|
|
||||||
},
|
|
||||||
onError = { _, message ->
|
|
||||||
scope.launch {
|
|
||||||
zappingProgress = 0f
|
|
||||||
showErrorMessageDialog = message
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onPayViaIntent = {
|
|
||||||
wantsToPay = it
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
},
|
onMultipleChoices = {
|
||||||
onLongClick = {
|
wantsToZap = true
|
||||||
wantsToChangeZapAmount = true
|
},
|
||||||
},
|
onError = { _, message ->
|
||||||
onDoubleClick = {
|
scope.launch {
|
||||||
wantsToSetCustomZap = true
|
zappingProgress = 0f
|
||||||
}
|
showErrorMessageDialog = message
|
||||||
)
|
}
|
||||||
|
},
|
||||||
|
onPayViaIntent = {
|
||||||
|
wantsToPay = it
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onLongClick = {
|
||||||
|
wantsToChangeZapAmount = true
|
||||||
|
},
|
||||||
|
onDoubleClick = {
|
||||||
|
wantsToSetCustomZap = true
|
||||||
|
}
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
if (wantsToZap) {
|
if (wantsToZap) {
|
||||||
ZapAmountChoicePopup(
|
ZapAmountChoicePopup(
|
||||||
@@ -1353,8 +1355,6 @@ fun ZapAmountChoicePopup(
|
|||||||
onPayViaIntent: (ImmutableList<ZapPaymentHandler.Payable>) -> Unit
|
onPayViaIntent: (ImmutableList<ZapPaymentHandler.Payable>) -> Unit
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val accountState by accountViewModel.accountLiveData.observeAsState()
|
|
||||||
val account = accountState?.account ?: return
|
|
||||||
val zapMessage = ""
|
val zapMessage = ""
|
||||||
|
|
||||||
Popup(
|
Popup(
|
||||||
@@ -1363,7 +1363,7 @@ fun ZapAmountChoicePopup(
|
|||||||
onDismissRequest = { onDismiss() }
|
onDismissRequest = { onDismiss() }
|
||||||
) {
|
) {
|
||||||
FlowRow(horizontalArrangement = Arrangement.Center) {
|
FlowRow(horizontalArrangement = Arrangement.Center) {
|
||||||
account.zapAmountChoices.forEach { amountInSats ->
|
accountViewModel.account.zapAmountChoices.forEach { amountInSats ->
|
||||||
Button(
|
Button(
|
||||||
modifier = Modifier.padding(horizontal = 3.dp),
|
modifier = Modifier.padding(horizontal = 3.dp),
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -1376,7 +1376,7 @@ fun ZapAmountChoicePopup(
|
|||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
account.defaultZapType
|
accountViewModel.account.defaultZapType
|
||||||
)
|
)
|
||||||
onDismiss()
|
onDismiss()
|
||||||
},
|
},
|
||||||
@@ -1401,7 +1401,7 @@ fun ZapAmountChoicePopup(
|
|||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
account.defaultZapType
|
accountViewModel.account.defaultZapType
|
||||||
)
|
)
|
||||||
onDismiss()
|
onDismiss()
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user