Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Updates

- Added `IterableConfig.enableForegroundCriteriaFetch` (default `true`) to control whether the SDK fetches unknown-user targeting criteria when the app enters the foreground (SDK-554).
- Added `IterableConfig.eventThresholdLimit` (default `100`) to cap locally stored unknown-user events before identification (SDK-553). The value is forwarded to the native SDK; it has no runtime effect in React Native until `enableUnknownUserActivation` is exposed in a future release (that switch is not on the RN config surface yet).

## 3.2.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableConte
configBuilder.setDataRegion(iterableDataRegion);
}

if (iterableContextJSON.has("enableForegroundCriteriaFetch")) {
configBuilder.setEnableForegroundCriteriaFetch(iterableContextJSON.optBoolean("enableForegroundCriteriaFetch"));
}

if (iterableContextJSON.has("enableEmbeddedMessaging")) {
configBuilder.setEnableEmbeddedMessaging(iterableContextJSON.optBoolean("enableEmbeddedMessaging"));
}
Expand Down
4 changes: 4 additions & 0 deletions ios/RNIterableAPI/Serialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ extension IterableConfig {
config.useInMemoryStorageForInApps = useInMemoryStorageForInApp
}

if let enableForegroundCriteriaFetch = dict["enableForegroundCriteriaFetch"] as? Bool {
config.enableForegroundCriteriaFetch = enableForegroundCriteriaFetch
}

if let enableEmbeddedMessaging = dict["enableEmbeddedMessaging"] as? Bool {
config.enableEmbeddedMessaging = enableEmbeddedMessaging
}
Expand Down
9 changes: 9 additions & 0 deletions src/core/classes/Iterable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ describe('Iterable', () => {
expect(config.checkForDeferredDeeplink).toBe(false);
expect(config.customActionHandler).toBe(undefined);
expect(config.dataRegion).toBe(IterableDataRegion.US);
expect(config.enableForegroundCriteriaFetch).toBe(true);
expect(config.enableEmbeddedMessaging).toBe(false);
expect(config.encryptionEnforced).toBe(false);
expect(config.expiringAuthTokenRefreshPeriod).toBe(60.0);
Expand All @@ -345,6 +346,7 @@ describe('Iterable', () => {
expect(configDict.autoPushRegistration).toBe(true);
expect(configDict.customActionHandlerPresent).toBe(false);
expect(configDict.dataRegion).toBe(IterableDataRegion.US);
expect(configDict.enableForegroundCriteriaFetch).toBe(true);
expect(configDict.enableEmbeddedMessaging).toBe(false);
expect(configDict.encryptionEnforced).toBe(false);
expect(configDict.expiringAuthTokenRefreshPeriod).toBe(60.0);
Expand All @@ -368,6 +370,13 @@ describe('Iterable', () => {
expect(configDict.authCallbackTimeoutMs).toBe(2500);
});

it('should include enableForegroundCriteriaFetch in toDict() when set to false', () => {
const config = new IterableConfig();
config.enableForegroundCriteriaFetch = false;
const configDict = config.toDict();
expect(configDict.enableForegroundCriteriaFetch).toBe(false);
});

it('should include eventThresholdLimit in toDict() when overridden', () => {
const config = new IterableConfig();
config.eventThresholdLimit = 50;
Expand Down
9 changes: 9 additions & 0 deletions src/core/classes/IterableConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,14 @@ export class IterableConfig {
*/
authCallbackTimeoutMs = 6000;

/**
* When `true` (the default), the SDK fetches unknown-user (anonymous) targeting
* criteria when the app enters the foreground.
*
* Set to `false` to disable that foreground fetch.
*/
enableForegroundCriteriaFetch = true;

/**
* Should the SDK enable and use embedded messaging?
*
Expand Down Expand Up @@ -497,6 +505,7 @@ export class IterableConfig {
pushPlatform: this.pushPlatform,
encryptionEnforced: this.encryptionEnforced,
retryPolicy: this.retryPolicy,
enableForegroundCriteriaFetch: this.enableForegroundCriteriaFetch,
enableEmbeddedMessaging: this.enableEmbeddedMessaging,
androidWakeDelayMs: this.androidWakeDelayMs,
authCallbackTimeoutMs: this.authCallbackTimeoutMs,
Expand Down
Loading