Skip to content

Commit

Permalink
fix: missing parenthesis
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopedro735 authored and João Carreira committed Dec 9, 2024
1 parent 7121af1 commit f5c20ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MobileScanner(
private val textureRegistry: TextureRegistry,
private val mobileScannerCallback: MobileScannerCallback,
private val mobileScannerErrorCallback: MobileScannerErrorCallback,
private val barcodeScannerFactory: (options: BarcodeScannerOptions?) -> BarcodeScanner = ::defaultBarcodeScannerFactory,
private val barcodeScannerFactory: (options: BarcodeScannerOptions.Builder?) -> BarcodeScanner = ::defaultBarcodeScannerFactory,
) {

/// Internal variables
Expand All @@ -67,8 +67,8 @@ class MobileScanner(
/**
* Create a barcode scanner from the given options.
*/
fun defaultBarcodeScannerFactory(options: BarcodeScannerOptions?) : BarcodeScanner {
return if (options == null) BarcodeScanning.getClient() else BarcodeScanning.getClient(options)
fun defaultBarcodeScannerFactory(options: BarcodeScannerOptions.Builder?) : BarcodeScanner {
return if (options == null) BarcodeScanning.getClient() else BarcodeScanning.getClient(options.build())
}
}

Expand Down Expand Up @@ -266,11 +266,7 @@ class MobileScanner(
null
}

scanner = if (barcodeScannerOptions != null) {
BarcodeScanning.getClient(barcodeScannerOptions.build())
} else {
BarcodeScanning.getClient()
}
scanner = barcodeScannerFactory(barcodeScannerOptions)

val cameraProviderFuture = ProcessCameraProvider.getInstance(activity)
val executor = ContextCompat.getMainExecutor(activity)
Expand Down Expand Up @@ -492,7 +488,7 @@ class MobileScanner(
*/
fun analyzeImage(
image: Uri,
scannerOptions: BarcodeScannerOptions?,
scannerOptions: BarcodeScannerOptions.Builder?,
onSuccess: AnalyzerSuccessCallback,
onError: AnalyzerErrorCallback) {
val inputImage = InputImage.fromFilePath(activity, image)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,6 @@ class MobileScannerHandler(
return BarcodeScannerOptions.Builder().setBarcodeFormats(
formatsList.first(),
*formatsList.subList(1, formatsList.size).toIntArray()
)
}
}

0 comments on commit f5c20ec

Please sign in to comment.