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-18 12:04:44 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
93e38b4b72ba216a6cb93928364de660eb42a3c5
93e38b4b
1 parent
ece227d7
return nil if analyze image has no file
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
13 deletions
ios/Classes/MobileScannerPlugin.swift
macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift
ios/Classes/MobileScannerPlugin.swift
View file @
93e38b4
...
...
@@ -258,9 +258,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin {
let
uiImage
=
UIImage
(
contentsOfFile
:
(
call
.
arguments
as!
Dictionary
<
String
,
Any
?
>
)[
"filePath"
]
as?
String
??
""
)
if
(
uiImage
==
nil
)
{
result
(
FlutterError
(
code
:
"MobileScanner"
,
message
:
"No image found in analyzeImage!"
,
details
:
nil
))
result
(
nil
)
return
}
...
...
macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift
View file @
93e38b4
...
...
@@ -273,7 +273,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
let
argReader
=
MapArgumentReader
(
call
.
arguments
as?
[
String
:
Any
])
// let ratio: Int = argReader.int(key: "ratio")
let
torch
:
Bool
=
argReader
.
bool
(
key
:
"torch"
)
??
false
let
facing
:
Int
=
argReader
.
int
(
key
:
"facing"
)
??
1
let
speed
:
Int
=
argReader
.
int
(
key
:
"speed"
)
??
0
...
...
@@ -327,7 +326,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
videoOutput
.
setSampleBufferDelegate
(
self
,
queue
:
DispatchQueue
.
main
)
captureSession
!.
addOutput
(
videoOutput
)
for
connection
in
videoOutput
.
connections
{
// connection.videoOrientation = .portrait
if
position
==
.
front
&&
connection
.
isVideoMirroringSupported
{
connection
.
isVideoMirrored
=
true
}
...
...
@@ -459,20 +457,14 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
let
symbologies
:[
VNBarcodeSymbology
]
=
argReader
.
toSymbology
()
guard
let
filePath
:
String
=
argReader
.
string
(
key
:
"filePath"
)
else
{
// TODO: fix error code
result
(
FlutterError
(
code
:
"MobileScanner"
,
message
:
"No image found in analyzeImage!"
,
details
:
nil
))
result
(
nil
)
return
}
let
fileUrl
=
URL
(
fileURLWithPath
:
filePath
)
guard
let
ciImage
=
CIImage
(
contentsOf
:
fileUrl
)
else
{
// TODO: fix error code
result
(
FlutterError
(
code
:
"MobileScanner"
,
message
:
"No image found in analyzeImage!"
,
details
:
nil
))
result
(
nil
)
return
}
...
...
Please
register
or
login
to post a comment