@@ -33,6 +33,7 @@ public protocol BarcodeScannerDismissalDelegate: class {
3333 */
3434open class BarcodeScannerViewController : UIViewController {
3535 private static let footerHeight : CGFloat = 75
36+ public var hideFooterView = false
3637
3738 // MARK: - Public properties
3839
@@ -47,6 +48,10 @@ open class BarcodeScannerViewController: UIViewController {
4748 /// and waits for the next reset action.
4849 public var isOneTimeSearch = true
4950
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+
5055 /// `AVCaptureMetadataOutput` metadata object types.
5156 public var metadata = AVMetadataObject . ObjectType. barcodeScannerMetadata {
5257 didSet {
@@ -197,6 +202,13 @@ open class BarcodeScannerViewController: UIViewController {
197202 - Parameter processing: Flag to set the current state to `.processing`.
198203 */
199204 private func animateFlash( whenProcessing: Bool = false ) {
205+ guard shouldSimulateFlash else {
206+ if whenProcessing {
207+ self . status = Status ( state: . processing)
208+ }
209+ return
210+ }
211+
200212 let flashView = UIView ( frame: view. bounds)
201213 flashView. backgroundColor = UIColor . white
202214 flashView. alpha = 1
@@ -235,7 +247,7 @@ private extension BarcodeScannerViewController {
235247 cameraView. trailingAnchor. constraint ( equalTo: view. trailingAnchor) ,
236248 cameraView. bottomAnchor. constraint (
237249 equalTo: view. bottomAnchor,
238- constant: - BarcodeScannerViewController. footerHeight
250+ constant: hideFooterView ? 0 : - BarcodeScannerViewController. footerHeight
239251 )
240252 )
241253
@@ -272,7 +284,7 @@ private extension BarcodeScannerViewController {
272284 messageView. leadingAnchor. constraint ( equalTo: view. leadingAnchor) ,
273285 messageView. trailingAnchor. constraint ( equalTo: view. trailingAnchor) ,
274286 messageView. heightAnchor. constraint (
275- equalToConstant: BarcodeScannerViewController . footerHeight
287+ equalToConstant: hideFooterView ? 0 : - BarcodeScannerViewController. footerHeight
276288 )
277289 ]
278290 }
0 commit comments