Commit 2e36cd46 authored by Eddy Verbruggen's avatar Eddy Verbruggen Committed by GitHub

Merge pull request #408 from PCSTrac/disable-beep

add an option to disable the success beep on iOS
parents fc242631 37a7ef0a
......@@ -162,7 +162,8 @@ A full example could be:
resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500
formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device
disableAnimations : true // iOS
disableAnimations : true, // iOS
disableSuccessBeep: false // iOS
}
);
```
......
......@@ -70,6 +70,7 @@
@property (nonatomic) BOOL isShowTorchButton;
@property (nonatomic) BOOL isFlipped;
@property (nonatomic) BOOL isTransitionAnimated;
@property (nonatomic) BOOL isSuccessBeepEnabled;
- (id)initWithPlugin:(CDVBarcodeScanner*)plugin callback:(NSString*)callback parentViewController:(UIViewController*)parentViewController alterateOverlayXib:(NSString *)alternateXib;
......@@ -165,6 +166,7 @@
BOOL showFlipCameraButton = [options[@"showFlipCameraButton"] boolValue];
BOOL showTorchButton = [options[@"showTorchButton"] boolValue];
BOOL disableAnimations = [options[@"disableAnimations"] boolValue];
BOOL disableSuccessBeep = [options[@"disableSuccessBeep"] boolValue];
// We allow the user to define an alternate xib file for loading the overlay.
NSString *overlayXib = options[@"overlayXib"];
......@@ -199,6 +201,8 @@
processor.isShowTorchButton = true;
}
processor.isSuccessBeepEnabled = !disableSuccessBeep;
processor.isTransitionAnimated = !disableAnimations;
processor.formats = options[@"formats"];
......@@ -406,7 +410,9 @@ parentViewController:(UIViewController*)parentViewController
[self barcodeScanDone:^{
[self.plugin returnSuccess:text format:format cancelled:FALSE flipped:FALSE callback:self.callback];
}];
AudioServicesPlaySystemSound(_soundFileObject);
if (self.isSuccessBeepEnabled) {
AudioServicesPlaySystemSound(_soundFileObject);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment