Skip to main content

BRMissedEarningsBaseViewController

Base view controller for the Missed Earnings barcode scanning UI. Subclass to receive barcode detection and UPC lookup callbacks.

Declaration

@interface BRMissedEarningsBaseViewController : UIViewController
class BRMissedEarningsBaseViewController : UIViewController

Quick Reference

Properties

PropertyDescription
scanningRegionRestricts the region in which a barcode will be detected.
countryCodeISO 2-character country code for barcode length detection.

Methods

MethodDescription
didDetectBarcode:Override to be notified when a barcode is detected.
lookupUPC:withCompletion:Performs a server lookup for a UPC code.
setTorch:Toggles the torch on or off.
restartCaptureSessionResumes scanning after a barcode is found and the capture session is paused.

Properties

scanningRegion

@property (nonatomic) CGRect scanningRegion;
var scanningRegion: CGRect { get set }

Restricts the region in which a barcode will be detected. Parameters are specified as percentages of the view size.

Default: (0.0, 0.0, 1.0, 1.0) (full frame)


countryCode

@property (nonatomic, strong, nonnull) NSString *countryCode;
var countryCode: String { get set }

ISO 2-character country code. Due to differences in barcode lengths, specifying the country code helps the SDK determine the correct barcode length to detect.


Methods

didDetectBarcode:

- (void)didDetectBarcode:(nonnull NSString *)barcode;
func didDetectBarcode(_ barcode: String)

Override this method to be notified when a barcode is detected. Supports 12-digit and 6-digit UPCs.


lookupUPC:withCompletion:

- (void)lookupUPC:(nonnull NSString *)upc
withCompletion:(nonnull void (^)(BRMissedEarningsLookupResult, NSDictionary *_Nonnull))completion;
func lookupUPC(_ upc: String) async -> (BRMissedEarningsLookupResult, [AnyHashable : Any])

Performs a server lookup for a UPC code.

Parameters

ParameterDescription
upcThe UPC string to look up.
completionCalled when the lookup completes. Receives a BRMissedEarningsLookupResult and a product info dictionary with keys: productName, brand, image_url, brand_participates (Bool), message.

setTorch:

- (void)setTorch:(BOOL)torchOn;
func setTorch(_ torchOn: Bool)

Toggles the torch on or off.


restartCaptureSession

- (void)restartCaptureSession;
func restartCaptureSession()

When a barcode is found, the capture session is automatically paused. Call this to resume scanning.