mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-09-19 10:09:17 -04:00
fix(ui): request HIGH error correction for generated QR codes (#6730)
This commit is contained in:
1 parent
ae7eaa6710
commit
cea2c3a015
1 file changed
+5
-1
@@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.compose.ui.unit.LayoutDirection
|
||||
import qrcode.QRCode
|
||||
import qrcode.raw.ErrorCorrectionLevel
|
||||
|
||||
/**
|
||||
* Generates a QR code painter directly using the Skia/Compose canvas API in pure Kotlin.
|
||||
@@ -37,7 +38,10 @@ import qrcode.QRCode
|
||||
@Suppress("MagicNumber")
|
||||
@Composable
|
||||
fun rememberQrCodePainter(text: String, size: Int = 512): Painter {
|
||||
val qrCode = androidx.compose.runtime.remember(text) { QRCode.ofSquares().build(text) }
|
||||
val qrCode =
|
||||
androidx.compose.runtime.remember(text) {
|
||||
QRCode.ofSquares().withErrorCorrectionLevel(ErrorCorrectionLevel.HIGH).build(text)
|
||||
}
|
||||
val rawMatrix = androidx.compose.runtime.remember(qrCode) { qrCode.rawData }
|
||||
val matrixSize = androidx.compose.runtime.remember(qrCode) { rawMatrix.size }
|
||||
val quietZone = 4 // QR standard quiet zone is 4 modules on all sides
|
||||
|
||||
Reference in new issue
Block a user