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 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 {
|
derivedStateOf {
|
||||||
if (receiverName.isNotBlank() && iban.isNotBlank()) {
|
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 {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
@ -152,6 +154,15 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) {
|
||||||
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),
|
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),
|
||||||
keyboardOptions = KeyboardOptions.ImeNext
|
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 {
|
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()
|
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