Added informationForUser, but not exposing it to user as it may causes overflow exception of used QR code library
This commit is contained in:
parent
1520d19625
commit
e3f9c78b95
|
@ -54,11 +54,13 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) {
|
|||
|
||||
var reference by remember { mutableStateOf("") }
|
||||
|
||||
var informationForUser by remember { mutableStateOf("") }
|
||||
|
||||
val epcQrCodeBytes by remember(receiverName, iban, bic, amount, reference) {
|
||||
|
||||
val epcQrCodeBytes by remember(receiverName, iban, bic, amount, reference, informationForUser) {
|
||||
derivedStateOf {
|
||||
if (receiverName.isNotBlank() && iban.isNotBlank()) {
|
||||
epcQrCodeService.generateEpcQrCode(receiverName, iban, bic.takeUnless { it.isBlank() }, amount.takeUnless { it.isBlank() }, reference.takeUnless { it.isBlank() })
|
||||
epcQrCodeService.generateEpcQrCode(receiverName, iban, bic.takeUnless { it.isBlank() }, amount.takeUnless { it.isBlank() }, reference.takeUnless { it.isBlank() }, informationForUser.takeUnless { it.isBlank() })
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
@ -152,6 +154,15 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) {
|
|||
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),
|
||||
keyboardOptions = KeyboardOptions.ImeNext
|
||||
)
|
||||
|
||||
// not exposing it to user as it's a) not displayed by most apps and b) may causes overflow of used QR code library
|
||||
// OutlinedTextField(
|
||||
// label = { Text("Information für den Nutzer (optional)") },
|
||||
// value = informationForUser,
|
||||
// onValueChange = { informationForUser = it },
|
||||
// modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),
|
||||
// keyboardOptions = KeyboardOptions.ImeNext
|
||||
// )
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,10 +6,10 @@ import net.codinux.banking.epcqrcode.EpcQrCodeGenerator
|
|||
|
||||
class EpcQrCodeService {
|
||||
|
||||
fun generateEpcQrCode(receiverName: String, iban: String, bic: String?, amount: String?, reference: String?, heightAndWidth: Int = EpcQrCode.DefaultHeightAndWidth): ByteArray {
|
||||
fun generateEpcQrCode(receiverName: String, iban: String, bic: String?, amount: String?, reference: String?, informationForUser: String? = null, heightAndWidth: Int = EpcQrCode.DefaultHeightAndWidth): ByteArray {
|
||||
val generator = EpcQrCodeGenerator()
|
||||
|
||||
return generator.generateEpcQrCode(EpcQrCodeConfig(receiverName, iban, bic, amount, reference, qrCodeHeightAndWidth = heightAndWidth)).bytes
|
||||
return generator.generateEpcQrCode(EpcQrCodeConfig(receiverName, iban, bic, amount, reference, informationForUser, qrCodeHeightAndWidth = heightAndWidth)).bytes
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue