From bca9472ab8d973d8079da89144f7b58a0321f5ec Mon Sep 17 00:00:00 2001 From: Jonas Thuresson Date: Mon, 26 Feb 2024 09:16:54 +0100 Subject: [PATCH] fix: Fix Boolean.parse string values from gradle properties (#2599) * parse string booleans from gradle properties * Define separate safeExtGetBool function --------- Co-authored-by: Jonas Thuresson --- package/android/build.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package/android/build.gradle b/package/android/build.gradle index 8a79120017..88ea6a5b7b 100644 --- a/package/android/build.gradle +++ b/package/android/build.gradle @@ -46,6 +46,10 @@ def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } +def safeExtGetBool(prop, fallback) { + Boolean.parseBoolean("${safeExtGet(prop, fallback)}") +} + def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] @@ -68,10 +72,10 @@ static def findNodeModules(baseDir) { def nodeModules = findNodeModules(projectDir) -def hasWorklets = !safeExtGet("VisionCamera_disableFrameProcessors", false) && findProject(":react-native-worklets-core") != null +def hasWorklets = !safeExtGetBool('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) +def enableCodeScanner = safeExtGetBool('VisionCamera_enableCodeScanner', false) repositories { google()