Skip to content
Open
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Updates

- 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

### Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableConte
configBuilder.setExpiringAuthTokenRefreshPeriod(iterableContextJSON.optLong("expiringAuthTokenRefreshPeriod"));
}

if (iterableContextJSON.has("eventThresholdLimit")) {
configBuilder.setEventThresholdLimit(
iterableContextJSON.optInt("eventThresholdLimit", 100));
}

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

if let eventThresholdLimit = dict["eventThresholdLimit"] as? Int {
config.eventThresholdLimit = eventThresholdLimit
}

if let logLevelNumber = dict["logLevel"] as? NSNumber {
config.logDelegate = createLogDelegate(logLevelNumber: logLevelNumber)
}
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 @@ -328,6 +328,7 @@ describe('Iterable', () => {
expect(config.enableEmbeddedMessaging).toBe(false);
expect(config.encryptionEnforced).toBe(false);
expect(config.expiringAuthTokenRefreshPeriod).toBe(60.0);
expect(config.eventThresholdLimit).toBe(100);
expect(config.inAppDisplayInterval).toBe(30.0);
expect(config.inAppHandler).toBe(undefined);
expect(config.logLevel).toBe(IterableLogLevel.debug);
Expand All @@ -347,6 +348,7 @@ describe('Iterable', () => {
expect(configDict.enableEmbeddedMessaging).toBe(false);
expect(configDict.encryptionEnforced).toBe(false);
expect(configDict.expiringAuthTokenRefreshPeriod).toBe(60.0);
expect(configDict.eventThresholdLimit).toBe(100);
expect(configDict.inAppDisplayInterval).toBe(30.0);
expect(configDict.inAppHandlerPresent).toBe(false);
expect(configDict.logLevel).toBe(IterableLogLevel.debug);
Expand All @@ -365,6 +367,13 @@ describe('Iterable', () => {
expect(configDict.androidWakeDelayMs).toBe(1500);
expect(configDict.authCallbackTimeoutMs).toBe(2500);
});

it('should include eventThresholdLimit in toDict() when overridden', () => {
const config = new IterableConfig();
config.eventThresholdLimit = 50;
const configDict = config.toDict();
expect(configDict.eventThresholdLimit).toBe(50);
});
});

describe('urlHandler', () => {
Expand Down
13 changes: 13 additions & 0 deletions src/core/classes/IterableConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ export class IterableConfig {
*/
expiringAuthTokenRefreshPeriod = 60.0;

/**
* Maximum number of unknown-user (anonymous) events stored locally before
* identification. The native SDK drops the oldest events when the count
* exceeds this limit.
*
* The value is sent to the native SDK at init. React Native does not expose
* `enableUnknownUserActivation` yet, so this limit has no observable effect
* until that option is added; when it is, the limit applies only while
* unknown-user activation is enabled.
*/
eventThresholdLimit = 100;

/**
* Use this array to declare the specific URL protocols that the SDK can
* expect to see on incoming links from Iterable, so it knows that it can
Expand Down Expand Up @@ -476,6 +488,7 @@ export class IterableConfig {
/** The log level for the SDK. */
logLevel: this.logLevel,
expiringAuthTokenRefreshPeriod: this.expiringAuthTokenRefreshPeriod,
eventThresholdLimit: this.eventThresholdLimit,
allowedProtocols: this.allowedProtocols,
androidSdkUseInMemoryStorageForInApps:
this.androidSdkUseInMemoryStorageForInApps,
Expand Down
Loading