Skip to content

Commit 08467cd

Browse files
authored
Merge pull request #412 from Iterable/jay/MOB-5116-add-ios-config
[MOB-5116] add iOS in memory option
2 parents 454515e + 0e2a682 commit 08467cd

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

android/src/main/java/com/iterable/reactnative/Serialization.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableConte
167167
configBuilder.setInAppDisplayInterval(iterableContextJSON.optDouble("inAppDisplayInterval"));
168168
}
169169

170-
if (iterableContextJSON.has("androidSdkUseInMemoryStorageForInApps")) {
171-
configBuilder.setUseInMemoryStorageForInApps(iterableContextJSON.optBoolean("androidSdkUseInMemoryStorageForInApps"));
170+
if (iterableContextJSON.has("useInMemoryStorageForInApps") || iterableContextJSON.has("androidSdkUseInMemoryStorageForInApps")) {
171+
configBuilder.setUseInMemoryStorageForInApps(iterableContextJSON.optBoolean("useInMemoryStorageForInApps"));
172172
}
173173

174174
if (iterableContextJSON.has("logLevel")) {

ios/RNIterableAPI/Serialization.swift

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ extension IterableConfig {
6363
config.logDelegate = createLogDelegate(logLevelNumber: logLevelNumber)
6464
}
6565

66+
if let useInMemoryStorageForInApp = dict["useInMemoryStorageForInApps"] as? Bool {
67+
config.useInMemoryStorageForInApps = useInMemoryStorageForInApp
68+
}
69+
6670
return config
6771
}
6872

ts/IterableConfig.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ class IterableConfig {
2525
* Note: Don't specify this value unless you are using an older Iterable push integration that
2626
* has a custom name. To view your existing integrations, navigate to Settings > Mobile Apps.
2727
*/
28-
2928
pushIntegrationName?: string
3029

3130
/**
3231
* When set to true (which is the default value), IterableSDK will automatically register and deregister
3332
* notification tokens when you provide email or userId values to the SDK using Iterable.setEmail or Iterable.setUserId.
3433
*/
35-
3634
autoPushRegistration = true
3735

3836
/**
@@ -45,19 +43,16 @@ class IterableConfig {
4543
* Number of seconds to wait when displaying multiple in-app messages in sequence.
4644
* between each. Defaults to 30 seconds.
4745
*/
48-
4946
inAppDisplayInterval: number = 30.0
5047

5148
/**
5249
* A callback function used to handle deep link URLs and in-app message button and link URLs.
5350
*/
54-
5551
urlHandler?: (url: string, context: IterableActionContext) => boolean
5652

5753
/**
5854
* A function expression used to handle `action://` URLs for in-app buttons and links.
5955
*/
60-
6156
customActionHandler?: (action: IterableAction, context: IterableActionContext) => boolean
6257

6358
/**
@@ -75,7 +70,6 @@ class IterableConfig {
7570
* React Native SDK. Provide an implementation for this method only if your app uses a
7671
* JWT-enabled API key.
7772
*/
78-
7973
authHandler?:() => Promise<AuthResponse | String | undefined>
8074

8175
/**
@@ -89,30 +83,37 @@ class IterableConfig {
8983
* This is for calls within the React Native layer, and is separate from `logLevel`
9084
* which affects the Android and iOS native SDKs
9185
*/
92-
9386
logReactNativeSdkCalls: boolean = true
9487

9588
/**
9689
* The number of seconds before the current JWT's expiration that the SDK should call the
9790
* authHandler to get an updated JWT.
9891
*/
99-
10092
expiringAuthTokenRefreshPeriod: number = 60.0
10193

10294
/**
10395
* Use this array to declare the specific URL protocols that the SDK can expect to see on incoming
10496
* links from Iterable, so it knows that it can safely handle them as needed. This array helps
10597
* prevent the SDK from opening links that use unexpected URL protocols.
10698
*/
107-
10899
allowedProtocols: Array<string> = []
109100

110101
/**
102+
* DEPRECATED - please use `useInMemoryStorageForInApps` as a replacement for this config option.
103+
*
104+
* NOTE: until this option is removed, it will still function with `useInMemoryStorageForInApps` by
105+
* doing an OR operation, so if either this or `useInMemoryStorageForInApps` are set to `true`,
106+
* the native Android SDK layer will use in memory storage for in-apps.
107+
*
111108
* This specifies the `useInMemoryStorageForInApps` config option downstream to the Android SDK layer.
112-
* Please read the `IterableConfig` file for specific details on this config option.
113109
*/
110+
androidSdkUseInMemoryStorageForInApps: boolean = false
114111

115-
androidSdkUseInMemoryStorageForInApps: boolean = false
112+
/**
113+
* This specifies the `useInMemoryStorageForInApps` config option downstream to the native SDK layers.
114+
* Please read the respective `IterableConfig` files for specific details on this config option.
115+
*/
116+
useInMemoryStorageForInApps: boolean = false
116117

117118
toDict(): any {
118119
return {
@@ -126,7 +127,8 @@ class IterableConfig {
126127
"logLevel": this.logLevel,
127128
"expiringAuthTokenRefreshPeriod": this.expiringAuthTokenRefreshPeriod,
128129
"allowedProtocols": this.allowedProtocols,
129-
"androidSdkUseInMemoryStorageForInApps": this.androidSdkUseInMemoryStorageForInApps
130+
"androidSdkUseInMemoryStorageForInApps": this.androidSdkUseInMemoryStorageForInApps,
131+
"useInMemoryStorageForInApps": this.useInMemoryStorageForInApps
130132
}
131133
}
132134
}

0 commit comments

Comments
 (0)