BRMissedEarningsBaseViewController

Objective-C

@interface BRMissedEarningsBaseViewController : UIViewController

/**
 *  This property restricts the region in which barcode will be detected. The parametesr are specified as percentages of the view size. The default value is `(0.0, 0.0, 1.0, 1.0)`
 */
@property (nonatomic) CGRect scanningRegion;

/**
 *  Due to differences in barcode lengths, specifying the country code helps determine the correct barcode length the SDK should detect
 */
@property (nonatomic, strong) NSString *countryCode;

/**
 * Override this method to be notified when a barcode is detected. Supports 12 digit and 6 digit UPC's.
 */
- (void)didDetectBarcode:(NSString*)barcode;

/**
 * Perform server lookup of this UPC
 *
 * @param completion This callback is invoked when the lookup completes (or fails)
 *      * `BRMissedEarningsLookupResult lookupResult` - The status of the lookup indicating whether the supplied UPC participates in the program, does not participate, was not found, or if the lookup failed
 *      * `NSDictionary *productInfo` - If the UPC was found, this dictionary contains information about the product. The keys are: `productName`, `brand`, `image_url`, and `brand_participates`, which is a boolean indicating whether this product's brand is part of the program. This helps identify scenarios where some products in a brand participate in the program, but the provided UPC does not. Additionally a `message` key which can contain a custom message for a given product
 */
- (void)lookupUPC:(NSString*)upc withCompletion:(void(^)(BRMissedEarningsLookupResult lookupResult, NSDictionary *productInfo))completion;

/**
 *  Toggle the status of the torch
 *
 *  @param torchOn      Whether to turn the torch on or off
 */
- (void)setTorch:(BOOL)torchOn;

/**
 * When a barcode is found, the capture session is automatically paused. Invoke this method to restart the capture session afterwards.
 */
- (void)restartCaptureSession;

@end

Swift

class BRMissedEarningsBaseViewController : UIViewController
  • This property restricts the region in which barcode will be detected. The parametesr are specified as percentages of the view size. The default value is (0.0, 0.0, 1.0, 1.0)

    Declaration

    Objective-C

    @property (nonatomic) CGRect scanningRegion;

    Swift

    var scanningRegion: CGRect { get set }
  • Due to differences in barcode lengths, specifying the country code helps determine the correct barcode length the SDK should detect

    Declaration

    Objective-C

    @property (nonatomic, strong) NSString *_Nonnull countryCode;

    Swift

    var countryCode: String { get set }
  • Override this method to be notified when a barcode is detected. Supports 12 digit and 6 digit UPC’s.

    Declaration

    Objective-C

    - (void)didDetectBarcode:(nonnull NSString *)barcode;

    Swift

    func didDetectBarcode(_ barcode: String)
  • Perform server lookup of this UPC

    Declaration

    Objective-C

    - (void)lookupUPC:(nonnull NSString *)upc
        withCompletion:(nonnull void (^)(BRMissedEarningsLookupResult,
                                         NSDictionary *_Nonnull))completion;

    Swift

    func lookupUPC(_ upc: String) async -> (BRMissedEarningsLookupResult, [AnyHashable : Any])

    Parameters

    completion

    This callback is invoked when the lookup completes (or fails)

    • BRMissedEarningsLookupResult lookupResult - The status of the lookup indicating whether the supplied UPC participates in the program, does not participate, was not found, or if the lookup failed
    • NSDictionary *productInfo - If the UPC was found, this dictionary contains information about the product. The keys are: productName, brand, image_url, and brand_participates, which is a boolean indicating whether this product’s brand is part of the program. This helps identify scenarios where some products in a brand participate in the program, but the provided UPC does not. Additionally a message key which can contain a custom message for a given product

  • Toggle the status of the torch

    Declaration

    Objective-C

    - (void)setTorch:(BOOL)torchOn;

    Swift

    func setTorch(_ torchOn: Bool)

    Parameters

    torchOn

    Whether to turn the torch on or off

  • When a barcode is found, the capture session is automatically paused. Invoke this method to restart the capture session afterwards.

    Declaration

    Objective-C

    - (void)restartCaptureSession;

    Swift

    func restartCaptureSession()