Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-10-29 15:15:51 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
77a74708dabed0966f79b2eeb4ea89db907b6568
77a74708
1 parent
71ef50ee
handle errors from start() in callback
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScannerHandler.kt
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScannerHandler.kt
View file @
77a7470
...
...
@@ -165,7 +165,6 @@ class MobileScannerHandler(
val detectionSpeed: DetectionSpeed = DetectionSpeed.values().first { it.intValue == speed}
try {
mobileScanner!!.start(
barcodeScannerOptions,
returnImage,
...
...
@@ -183,41 +182,44 @@ class MobileScannerHandler(
))
}
},
timeout.toLong(),
cameraResolution,
)
} catch (e: AlreadyStarted) {
mobileScannerErrorCallback = {
Handler(Looper.getMainLooper()).post {
when (it) {
is AlreadyStarted -> {
result.error(
"MobileScanner",
"Called start() while already started",
null
)
} catch (e: NoCamera) {
result.error(
"MobileScanner",
"No camera found or failed to open camera!",
null
)
} catch (e: TorchError) {
}
is CameraError -> {
result.error(
"MobileScanner",
"Error occurred when setting torch
!",
"Error occurred when setting up camera
!",
null
)
} catch (e: CameraError) {
}
is NoCamera -> {
result.error(
"MobileScanner",
"Error occurred when setting up
camera!",
"No camera found or failed to open
camera!",
null
)
} catch (e: Exception) {
}
else -> {
result.error(
"MobileScanner",
"Unknown error occurred.
.",
"Unknown error occurred
.",
null
)
}
}
}
},
timeout.toLong(),
cameraResolution,
)
}
private fun stop(result: MethodChannel.Result) {
try {
...
...
Please
register
or
login
to post a comment