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-31 11:22:05 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f8e4f9d6cbedf3ab2915e27efcde9b6b2ad20015
f8e4f9d6
1 parent
a56d397f
only turn the torch on on iOS if requested
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
ios/Classes/MobileScanner.swift
ios/Classes/MobileScannerPlugin.swift
ios/Classes/MobileScanner.swift
View file @
f8e4f9d
...
...
@@ -133,7 +133,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
}
/// Start scanning for barcodes
func
start
(
barcodeScannerOptions
:
BarcodeScannerOptions
?,
returnImage
:
Bool
,
cameraPosition
:
AVCaptureDevice
.
Position
,
torch
:
AVCaptureDevice
.
TorchMode
,
detectionSpeed
:
DetectionSpeed
,
completion
:
@escaping
(
MobileScannerStartParameters
)
->
())
throws
{
func
start
(
barcodeScannerOptions
:
BarcodeScannerOptions
?,
returnImage
:
Bool
,
cameraPosition
:
AVCaptureDevice
.
Position
,
torch
:
Boolean
,
detectionSpeed
:
DetectionSpeed
,
completion
:
@escaping
(
MobileScannerStartParameters
)
->
())
throws
{
self
.
detectionSpeed
=
detectionSpeed
if
(
device
!=
nil
)
{
throw
MobileScannerError
.
alreadyStarted
...
...
@@ -216,12 +216,14 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
// Turn on the flashlight if requested,
// but after the capture session started.
if
(
torch
)
{
do
{
try
self
.
toggleTorch
(
torch
)
try
self
.
toggleTorch
(
.
on
)
}
catch
{
// If the torch does not turn on,
// continue with the capture session anyway.
}
}
do
{
try
self
.
resetScale
()
...
...
ios/Classes/MobileScannerPlugin.swift
View file @
f8e4f9d
...
...
@@ -120,7 +120,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin {
let
detectionSpeed
:
DetectionSpeed
=
DetectionSpeed
(
rawValue
:
speed
)
!
do
{
try
mobileScanner
.
start
(
barcodeScannerOptions
:
barcodeOptions
,
returnImage
:
returnImage
,
cameraPosition
:
position
,
torch
:
torch
?
.
on
:
.
off
,
detectionSpeed
:
detectionSpeed
)
{
parameters
in
try
mobileScanner
.
start
(
barcodeScannerOptions
:
barcodeOptions
,
returnImage
:
returnImage
,
cameraPosition
:
position
,
torch
:
torch
,
detectionSpeed
:
detectionSpeed
)
{
parameters
in
DispatchQueue
.
main
.
async
{
result
([
"textureId"
:
parameters
.
textureId
,
...
...
Please
register
or
login
to post a comment