capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 172 forks source link

update: Reset lastScanResult on resumeScanning #114

Closed PierreB40 closed 2 years ago

PierreB40 commented 2 years ago

I want to scan several barcodes in a row including two same barcodes in a row. But the plugin prevents to scan twice the same barcode. Removing this condition creates more problems than anything else, returns the value many times and there is no notion of scan frequency to remedy this. So for my need I decide to pause the scan and by user interaction to resume it. This way the scan is always open and I can scan several barcodes including several times the same one and the user controls what he scans

PaintedShepherd commented 2 years ago

This is a function that i would really appreaciate . Why this is not merged? Its mandatory for many i guess.

thegnuu commented 2 years ago

It's not merged right now because I need to check the behaviour on iOS once I merge this PR so the two implementation behave in the same way and I simply have not found time to do so.

I will have a look at it this weekend!

silviogutierrez commented 2 years ago

@PierreB40 how are you preventing the scanner from closing after the first scan? I can't seem to find anything in the APIs. And it is auto destroyed.

PierreB40 commented 2 years ago

@silviogutierrez You can use startScanning() to scan multiple barcode in a row. But if you want the capabilities to scan the same barcode twice you have to use pauseScanning() after scan and resumeScanning() to scan another (with an user interaction). Like this the lastScanned value will be reset

silviogutierrez commented 2 years ago

Oh interesting, I'll have to check it out. I see startScanning listed in the API, but no mention of the differences between the regular startScan.

There is one issue does mention it though: https://github.com/capacitor-community/barcode-scanner/pull/93

I'll try it out at some point and try to document it.