Skip to content

Commit 6fe5bb5

Browse files
committed
Add an option to disable simulating flash
1 parent a8b0bc2 commit 6fe5bb5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/Controllers/BarcodeScannerViewController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ open class BarcodeScannerViewController: UIViewController {
4848
/// and waits for the next reset action.
4949
public var isOneTimeSearch = true
5050

51+
/// When the flag is set to `true` the screen is flashed on barcode scan.
52+
/// Defaults to true.
53+
public var shouldSimulateFlash = true
54+
5155
/// `AVCaptureMetadataOutput` metadata object types.
5256
public var metadata = AVMetadataObject.ObjectType.barcodeScannerMetadata {
5357
didSet {
@@ -198,6 +202,13 @@ open class BarcodeScannerViewController: UIViewController {
198202
- Parameter processing: Flag to set the current state to `.processing`.
199203
*/
200204
private func animateFlash(whenProcessing: Bool = false) {
205+
guard shouldSimulateFlash else {
206+
if whenProcessing {
207+
self.status = Status(state: .processing)
208+
}
209+
return
210+
}
211+
201212
let flashView = UIView(frame: view.bounds)
202213
flashView.backgroundColor = UIColor.white
203214
flashView.alpha = 1

0 commit comments

Comments
 (0)