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
2024-09-10 12:09:23 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
84a121e01bcf3e2ec9d2e0d50a28ea0e08ce83f2
84a121e0
1 parent
cdac3f70
use separate method to create scanner options on iOS
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
ios/Classes/MobileScannerPlugin.swift
ios/Classes/MobileScannerPlugin.swift
View file @
84a121e
...
...
@@ -134,16 +134,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin {
self
.
mobileScanner
.
timeoutSeconds
=
Double
(
timeoutMs
)
/
Double
(
1000
)
MobileScannerPlugin
.
returnImage
=
returnImage
let
formatList
=
formats
.
map
{
format
in
return
BarcodeFormat
(
rawValue
:
format
)}
var
barcodeOptions
:
BarcodeScannerOptions
?
=
nil
if
(
formatList
.
count
!=
0
)
{
var
barcodeFormats
:
BarcodeFormat
=
[]
for
index
in
formats
{
barcodeFormats
.
insert
(
BarcodeFormat
(
rawValue
:
index
))
}
barcodeOptions
=
BarcodeScannerOptions
(
formats
:
barcodeFormats
)
}
let
barcodeOptions
:
BarcodeScannerOptions
?
=
buildBarcodeScannerOptions
(
formats
)
let
position
=
facing
==
0
?
AVCaptureDevice
.
Position
.
front
:
.
back
let
detectionSpeed
:
DetectionSpeed
=
DetectionSpeed
(
rawValue
:
speed
)
!
...
...
@@ -297,4 +288,18 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin {
}
})
}
private
func
buildBarcodeScannerOptions
(
_
formats
:
[
Int
])
->
BarcodeScannerOptions
?
{
guard
!
formats
.
isEmpty
else
{
return
nil
}
var
barcodeFormats
:
BarcodeFormat
=
[]
for
format
in
formats
{
barcodeFormats
.
insert
(
BarcodeFormat
(
rawValue
:
format
))
}
return
BarcodeScannerOptions
(
formats
:
barcodeFormats
)
}
}
...
...
Please
register
or
login
to post a comment