Closed BasselAshi closed 8 months ago
Looks good, but fix the Java doc please. The parameter name doesn't match
Done.
can i use this on version 3.5.1 ?
can i use this on version 3.5.1 ?
You can manually create a QR Code consumer that received the QR code as a string that looks something like this:
class QrCodeConsumer(private val continuation: CancellableContinuation<String>) : QrHandler {
override fun accept(qr: String) {
if (continuation.isActive) {
continuation.resume(qr)
} else {
println("New QR generated: ${qr}")
}
}
}
can i use this on version 3.5.1 ?
You can manually create a QR Code consumer that received the QR code as a string that looks something like this:
class QrCodeConsumer(private val continuation: CancellableContinuation<String>) : QrHandler { override fun accept(qr: String) { if (continuation.isActive) { continuation.resume(qr) } else { println("New QR generated: ${qr}") } } }
Whatsapp.webBuilder() .serializer(new DefaultControllerSerializer(Path.of("/Users/edy-kris/Documents/project-java/serializer"))) .newConnection(phone) .name(name) .errorHandler(ErrorHandler.toTerminal()) .autodetectListeners(true) .checkPatchMacks(true) .unregistered(QrHandler.toString(qrCodeConsumer)) .addLoggedInListener(() -> System.out.println("connected"));
i use the consumer like you said but it still return the qrCode matrix
You shouldnt be using the QrHandler
at all after extending it:
.unregistered(qrCodeConsumer)
Problem described in Issue 406. The solution is to make the consumer directly accept the QR plain string without converting it to an ASCII matrix.