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-04-26 15:36:59 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c0ed87b9c5cb34a5e0ed1862abf86a7122125877
c0ed87b9
1 parent
2178ccda
forward the current torch state on iOS / MacOS
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
7 deletions
example/macos/Runner.xcodeproj/project.pbxproj
example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
ios/Classes/MobileScanner.swift
ios/Classes/MobileScannerPlugin.swift
macos/Classes/MobileScannerPlugin.swift
example/macos/Runner.xcodeproj/project.pbxproj
View file @
c0ed87b
...
...
@@ -259,7 +259,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1
43
0;
LastUpgradeCheck = 1
51
0;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C80D4294CF70F00263BE5 = {
...
...
example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
View file @
c0ed87b
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"1
43
0"
LastUpgradeVersion =
"1
51
0"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
ios/Classes/MobileScanner.swift
View file @
c0ed87b
...
...
@@ -283,13 +283,12 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
// as this does not change the configuration of the hardware camera.
let
dimensions
=
CMVideoFormatDescriptionGetDimensions
(
device
.
activeFormat
.
formatDescription
)
let
hasTorch
=
device
.
hasTorch
completion
(
MobileScannerStartParameters
(
width
:
Double
(
dimensions
.
height
),
height
:
Double
(
dimensions
.
width
),
hasTorch
:
hasTorch
,
currentTorchState
:
device
.
hasTorch
?
device
.
torchMode
.
rawValue
:
-
1
,
textureId
:
self
.
textureId
??
0
)
)
...
...
@@ -459,7 +458,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
struct
MobileScannerStartParameters
{
var
width
:
Double
=
0.0
var
height
:
Double
=
0.0
var
hasTorch
=
false
var
currentTorchState
:
Int
=
-
1
var
textureId
:
Int64
=
0
}
}
...
...
ios/Classes/MobileScannerPlugin.swift
View file @
c0ed87b
...
...
@@ -125,7 +125,8 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin {
result
([
"textureId"
:
parameters
.
textureId
,
"size"
:
[
"width"
:
parameters
.
width
,
"height"
:
parameters
.
height
],
"torchable"
:
parameters
.
hasTorch
])
"currentTorchState"
:
parameters
.
currentTorchState
,
])
}
}
}
catch
MobileScannerError
.
alreadyStarted
{
...
...
macos/Classes/MobileScannerPlugin.swift
View file @
c0ed87b
...
...
@@ -326,7 +326,12 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
captureSession
!.
startRunning
()
let
dimensions
=
CMVideoFormatDescriptionGetDimensions
(
device
.
activeFormat
.
formatDescription
)
let
size
=
[
"width"
:
Double
(
dimensions
.
width
),
"height"
:
Double
(
dimensions
.
height
)]
let
answer
:
[
String
:
Any
?]
=
[
"textureId"
:
textureId
,
"size"
:
size
,
"torchable"
:
device
.
hasTorch
]
let
answer
:
[
String
:
Any
?]
=
[
"textureId"
:
textureId
,
"size"
:
size
,
"currentTorchState"
:
device
.
hasTorch
?
device
.
torchMode
.
rawValue
:
-
1
,
]
result
(
answer
)
}
...
...
Please
register
or
login
to post a comment