mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-26 17:56:24 +02:00
show amount for atomic polls before zapping
This commit is contained in:
@@ -150,27 +150,7 @@ fun ZapVote(
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
return@combinedClickable
|
return@combinedClickable
|
||||||
}
|
} else { wantsToZap = true }
|
||||||
accountViewModel.zap(
|
|
||||||
baseNote,
|
|
||||||
pollViewModel.valueMaximum!!.toLong() * 1000,
|
|
||||||
pollOption,
|
|
||||||
"",
|
|
||||||
context,
|
|
||||||
onError = {
|
|
||||||
scope.launch {
|
|
||||||
zappingProgress = 0f
|
|
||||||
Toast
|
|
||||||
.makeText(context, it, Toast.LENGTH_SHORT)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onProgress = {
|
|
||||||
scope.launch(Dispatchers.Main) {
|
|
||||||
zappingProgress = it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
wantsToZap = true
|
wantsToZap = true
|
||||||
}
|
}
|
||||||
@@ -266,27 +246,30 @@ fun ZapVoteAmountChoicePopup(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(10.dp)
|
.padding(10.dp)
|
||||||
) {
|
) {
|
||||||
val amount = pollViewModel.inputVoteAmountLong(inputAmountText)
|
var amount = pollViewModel.inputVoteAmountLong(inputAmountText)
|
||||||
|
|
||||||
OutlinedTextField(
|
// only prompt for input amount if vote is not atomic
|
||||||
value = inputAmountText,
|
if (!pollViewModel.isVoteAmountAtomic()) {
|
||||||
onValueChange = { inputAmountText = it },
|
OutlinedTextField(
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
value = inputAmountText,
|
||||||
modifier = Modifier.width(150.dp),
|
onValueChange = { inputAmountText = it },
|
||||||
colors = if (pollViewModel.isValidInputVoteAmount(amount)) colorValid else colorInValid,
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
label = {
|
modifier = Modifier.width(150.dp),
|
||||||
Text(
|
colors = if (pollViewModel.isValidInputVoteAmount(amount)) colorValid else colorInValid,
|
||||||
text = stringResource(R.string.poll_zap_amount),
|
label = {
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
Text(
|
||||||
)
|
text = stringResource(R.string.poll_zap_amount),
|
||||||
},
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
placeholder = {
|
)
|
||||||
Text(
|
},
|
||||||
text = pollViewModel.voteAmountPlaceHolderText(context.getString(R.string.sats)),
|
placeholder = {
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
Text(
|
||||||
)
|
text = pollViewModel.voteAmountPlaceHolderText(context.getString(R.string.sats)),
|
||||||
}
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else { amount = pollViewModel.valueMaximum?.toLong() }
|
||||||
|
|
||||||
val isValidInputAmount = pollViewModel.isValidInputVoteAmount(amount)
|
val isValidInputAmount = pollViewModel.isValidInputVoteAmount(amount)
|
||||||
Button(
|
Button(
|
||||||
|
Reference in New Issue
Block a user