Skip to main content

Migrating from v1.3.0 to v1.4.0

Overview

v1.4.0 introduces two breaking changes from v1.3.0:

  1. Explicit SDK bootstrap. BlinkEngageSDK.shared is no longer auto-initialized. You must call BlinkEngageSDK.start(debugMode:) exactly once — typically in your app delegate — before any use of BlinkEngageSDK.shared. The public debugModeEnabled property has been removed; debug mode is chosen at bootstrap time.
  2. Reward-currency configuration consolidation. The reward-currency properties on BlinkEngageSDK and the AppearanceIconKey.offerRewardIcon theme key have been removed. All reward-currency settings now live on a single BlinkEngageRewardConfig instance assigned to BlinkEngageSDK.shared.rewardConfig.

Existing code that references the removed properties will no longer compile. Follow the steps below to migrate.


1. SDK bootstrap: call start(debugMode:)

In v1.3.0, the SDK initialized itself lazily and debug mode was toggled on BlinkEngageSDK.shared:

// v1.3.0
BlinkEngageSDK.shared.debugModeEnabled = true // removed in v1.4.0

In v1.4.0, the SDK is initialized explicitly and debug mode is set at start:

// v1.4.0 — call once at launch, before any use of BlinkEngageSDK.shared
#if DEBUG
BlinkEngageSDK.start(debugMode: true)
#else
BlinkEngageSDK.start(debugMode: false)
#endif
warning

Calling BlinkEngageSDK.shared before BlinkEngageSDK.start(debugMode:) triggers a precondition failure. Calling start(debugMode:) more than once also triggers a precondition failure.

debugMode: true is for local development and integration testing only. It registers the device as a Google Mobile Ads test device so real ads can be served safely without affecting production metrics. Pass false for App Store submissions and customer-facing builds.

Objective-C

// v1.3.0
BlinkEngageSDK.shared.debugModeEnabled = YES; // removed

// v1.4.0
[BlinkEngageSDK startWithDebugMode:YES];

Property mapping

Removed API (v1.3.0)Replacement (v1.4.0)Notes
BlinkEngageSDK.shared.debugModeEnabled = BoolBlinkEngageSDK.start(debugMode:)Debug mode is fixed for the lifetime of the process. Call once; cannot be changed later.

2. Reward-currency configuration

Matching v1.3.0 defaults

The simplest migration that reproduces the exact same styling v1.3.0 used out of the box:

BlinkEngageSDK.shared.rewardConfig = BlinkEngageRewardConfig(
currencyName: "pts",
rewardCallback: { context, amount, blinkReceiptId in
if context == "ScanFinished" { return NSNumber(value: 10) }
return nil
}
)

Two changes are needed: v1.4.0 renamed the default currency name from "pts" to "points", and rewardCallback is now a required parameter. Everything else — reward icon on list rows, toast copy, 100 units per dollar, 60% payout — already matches v1.3.0 defaults.

If you had customized values in v1.3.0, pass them to the config instead:

let config = BlinkEngageRewardConfig(
currencyName: "coins", // was: BlinkEngageSDK.shared.rewardCurrencyName = "coins"
currencyPerDollar: 500, // was: BlinkEngageSDK.shared.rewardCurrencyPerDollar = 500
userPayoutPercentage: 0.7, // was: BlinkEngageSDK.shared.userPayoutPercentage = 0.7
currencyImage: UIImage(named: "coin-icon"),
rewardCallback: { context, amount, blinkReceiptId in
if context == "ScanFinished" { return NSNumber(value: 10) }
return nil
}
)
BlinkEngageSDK.shared.rewardConfig = config

What changed from v1.3.0 defaults

v1.3.0 defaultv1.4.0 defaultAction needed
Currency name"pts""points"Pass currencyName: "pts" to keep the old label
List-row styleReward icon + digitsSame (.currencyImage)None
Toast / headline styleAmount + name in proseSame (.currencyName)None
Conversion rate100100None
Payout percentage0.60.6None
Reward icon sourceTheme (offerRewardIcon)BlinkEngageRewardConfig.currencyImage (nil = built-in icon)Move custom icon to currencyImage if you had one

Property mapping

Removed API (v1.3.0)Replacement on BlinkEngageRewardConfig (v1.4.0)Notes
BlinkEngageSDK.rewardCurrencyNamecurrencyNameDefault changed from "pts" to "points". Maximum 8 characters.
BlinkEngageSDK.rewardCurrencyPerDollarcurrencyPerDollarSame semantics and default (100.0).
BlinkEngageSDK.userPayoutPercentageuserPayoutPercentageSame semantics and default (0.6). Valid range: 0.4 ... 1.0.
BlinkEngageSDK.rewardCallbackBlinkEngageRewardConfig.rewardCallbackSignature changed — scanResults removed (see below). Required parameter with no default.
AppearanceIconKey.offerRewardIconBlinkEngageRewardConfig.currencyImage + currencyImageLocationsIcon is now set on the config, not the theme.

Callback signature change

The rewardCallback closure dropped the scanResults parameter:

v1.3.0 signaturev1.4.0 signature
Swift(String, [String: Any]?, NSNumber?, String?) -> NSNumber?(String, NSNumber?, String?) -> NSNumber?
Objective-CNSNumber *(^)(NSString *, NSDictionary *, NSNumber *, NSString *)NSNumber *(^)(NSString *, NSNumber *, NSString *)

Remove the scanResults / NSDictionary parameter. rewardCallback is a required parameter — it has no default value.

Objective-C equivalent

BlinkEngageRewardConfig *config = [[BlinkEngageRewardConfig alloc]
initWithCurrencyName:@"coins"
currencyCode:nil
currencyCodePosition:RewardCurrencyCodePositionLeading
currencyPerDollar:500
userPayoutPercentage:0.7
currencyImage:nil
currencyImageLocations:BlinkEngageRewardConfig.imageLocationAll
rewardLabelStyle:RewardCurrencyLabelStyleCurrencyImage
messagingTextStyle:RewardCurrencyMessagingTextStyleCurrencyName
rewardRounding:RewardCurrencyRoundingWhole
rewardCallback:^NSNumber *(NSString *ctx, NSNumber *amt, NSString *blinkReceiptId) {
if ([ctx isEqualToString:@"ScanFinished"]) return @10;
return nil;
}];

BlinkEngageSDK.shared.rewardConfig = config;

3. Theme changes

Removed APIReplacementMigration step
AppearanceIconKey.offerRewardIconBlinkEngageRewardConfig.currencyImageMove the custom UIImage to the config's currencyImage parameter. Delete the case .offerRewardIcon: branch from your Theme.image(forKey:) implementation.
Theme.isRewardIconEnabledBlinkEngageRewardConfig.rewardCurrencyLabelStyleUse .currencyImage to show the icon, or .currencyCode / .currencyName for text-only rows.
note

Always match on enum case names (e.g. .offerWallFloatingButtonIcon), not raw integer values. Removing offerRewardIcon in v1.4.0 shifted the raw values of the remaining AppearanceIconKey cases.


At a glance

APIChange
BlinkEngageSDK.shared.debugModeEnabledRemoved — use BlinkEngageSDK.start(debugMode:)
BlinkEngageSDK.rewardCurrencyNameMoved to BlinkEngageRewardConfig.currencyName
BlinkEngageSDK.rewardCurrencyPerDollarMoved to BlinkEngageRewardConfig.currencyPerDollar
BlinkEngageSDK.userPayoutPercentageMoved to BlinkEngageRewardConfig.userPayoutPercentage
BlinkEngageSDK.rewardCallbackMoved to BlinkEngageRewardConfig.rewardCallback; scanResults param removed
AppearanceIconKey.offerRewardIconMoved to BlinkEngageRewardConfig.currencyImage
Theme.isRewardIconEnabledReplaced by BlinkEngageRewardConfig.rewardCurrencyLabelStyle