ekreutz / react-native-barcode-scanner-google

Barcode scanner for react native, which implements barcode detection from Google's Vision API.
MIT License
113 stars 68 forks source link

Torch mode implementation #22

Closed jqn closed 6 years ago

jqn commented 6 years ago

@ekreutz could you please look into merging this pull request. This is the torch mode implementation only, I've removed everything else. The original author of this pull request doesn't seem to be active and it would be really useful to have this functionality included in this package.

jqn commented 6 years ago

@avshenuk correct me if I'm wrong but if FLASH_MODE_TORCH isn't available there is already a logic handling this case in CameraSource.java line 840.

if (mFlashMode != null) {
            if (parameters.getSupportedFlashModes() != null) {
                if (parameters.getSupportedFlashModes().contains(
                        mFlashMode)) {
                    parameters.setFlashMode(mFlashMode);
                } else {
                    Log.i(TAG, "Camera flash mode: " + mFlashMode + " is not supported on this device.");
                }
            }
        }

and setting the flash mode to ON doesn't act like torch mode anyways since it is not continuously enabled. For that I believe we would need to add a flashmode property.

TheCodeTalker commented 6 years ago

hey this pr what implmented is working??

jqn commented 6 years ago

@TheCodeTalker it is working just not getting a lot of traction with the repo owner to merge it.

TheCodeTalker commented 6 years ago

@ekreutz FLASH not working i have tested with android phone