Skip to content

Commit

Permalink
Add an option to disable simulating flash
Browse files Browse the repository at this point in the history
  • Loading branch information
3lvis committed Oct 8, 2020
1 parent a8b0bc2 commit 6fe5bb5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/Controllers/BarcodeScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ open class BarcodeScannerViewController: UIViewController {
/// and waits for the next reset action.
public var isOneTimeSearch = true

/// When the flag is set to `true` the screen is flashed on barcode scan.
/// Defaults to true.
public var shouldSimulateFlash = true

/// `AVCaptureMetadataOutput` metadata object types.
public var metadata = AVMetadataObject.ObjectType.barcodeScannerMetadata {
didSet {
Expand Down Expand Up @@ -198,6 +202,13 @@ open class BarcodeScannerViewController: UIViewController {
- Parameter processing: Flag to set the current state to `.processing`.
*/
private func animateFlash(whenProcessing: Bool = false) {
guard shouldSimulateFlash else {
if whenProcessing {
self.status = Status(state: .processing)
}
return
}

let flashView = UIView(frame: view.bounds)
flashView.backgroundColor = UIColor.white
flashView.alpha = 1
Expand Down

0 comments on commit 6fe5bb5

Please sign in to comment.