feat: Add new enableCodeScanner
prop to build.gradle
to make sure CodeScanner
always works (#2355)
* feat: Always download model instead of relying on Google Play Services * feat: Use `VisionCamera_enableCodeScanner` flag instead of unsafely replacing * Update CODE_SCANNING.mdx
This commit is contained in:
@@ -71,6 +71,8 @@ def nodeModules = findNodeModules(projectDir)
|
||||
def hasWorklets = !safeExtGet("VisionCamera_disableFrameProcessors", false) && findProject(":react-native-worklets-core") != null
|
||||
logger.warn("[VisionCamera] react-native-worklets-core ${hasWorklets ? "found" : "not found"}, Frame Processors ${hasWorklets ? "enabled" : "disabled"}!")
|
||||
|
||||
def enableCodeScanner = safeExtGet("VisionCamera_enableCodeScanner", false)
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
@@ -162,7 +164,15 @@ dependencies {
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation "com.facebook.react:react-android:+"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
|
||||
implementation "com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.0"
|
||||
|
||||
if (enableCodeScanner) {
|
||||
// User enabled code-scanner, so we bundle the 2.4 MB model in the app.
|
||||
implementation 'com.google.mlkit:barcode-scanning:17.2.0'
|
||||
} else {
|
||||
// Fall-back to just including the code for the CodeScanner to avoid the 2.4 MB bundle in the app.
|
||||
// On devices with Google Play Services, this can also download the CodeScanner model on-demand.
|
||||
implementation "com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.0"
|
||||
}
|
||||
|
||||
if (hasWorklets) {
|
||||
// Frame Processor integration (optional)
|
||||
|
Reference in New Issue
Block a user