Skip to content

Commit 2f87799

Browse files
authored
Merge pull request #580 from Iterable/MOB-9381-pushPlatform-for-ios
[MOB-9381] - Push platform Configuration for iOS
2 parents 5da295b + 5375672 commit 2f87799

File tree

4 files changed

+604
-571
lines changed

4 files changed

+604
-571
lines changed

ios/RNIterableAPI/Serialization.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ extension IterableConfig {
5050
if let pushIntegrationName = dict["pushIntegrationName"] as? String {
5151
config.pushIntegrationName = pushIntegrationName
5252
}
53+
54+
if let pushPlatform = dict["pushPlatform"] as? NSNumber {
55+
switch pushPlatform {
56+
case 0:
57+
config.pushPlatform = .sandbox
58+
case 1:
59+
config.pushPlatform = .production
60+
default:
61+
config.pushPlatform = .auto
62+
}
63+
}
5364

5465
if let autoPushRegistration = dict["autoPushRegistration"] as? Bool {
5566
config.autoPushRegistration = autoPushRegistration

ts/IterableConfig.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import IterableInAppMessage from './IterableInAppMessage'
1212

1313
import { IterableDataRegion } from './IterableDataRegion'
1414

15+
import { IterablePushPlatform } from './IterablePushPlatform'
16+
1517
type AuthCallBack = (() => void)
1618

1719
/**
@@ -121,6 +123,13 @@ class IterableConfig {
121123
* This specifies the data region which determines the data center and associated endpoints used by the SDK
122124
*/
123125
dataRegion: IterableDataRegion = IterableDataRegion.US
126+
127+
/**
128+
* This specifies the push platform to use for push notifications. Either `sandbox`, `production`, or `auto`.
129+
* The default value is `auto`, which means the SDK will automatically determine the push platform to use.
130+
* However, you can also set this to `sandbox` or `production` to force the SDK to use a specific platform.
131+
*/
132+
pushPlatform: IterablePushPlatform = IterablePushPlatform.auto
124133

125134
/**
126135
* Android only feature: This controls whether the SDK should enforce encryption for all PII stored on disk.
@@ -143,6 +152,7 @@ class IterableConfig {
143152
"androidSdkUseInMemoryStorageForInApps": this.androidSdkUseInMemoryStorageForInApps,
144153
"useInMemoryStorageForInApps": this.useInMemoryStorageForInApps,
145154
"dataRegion": this.dataRegion,
155+
"pushPlatform": this.pushPlatform,
146156
"encryptionEnforced": this.encryptionEnforced
147157
}
148158
}

ts/IterablePushPlatform.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
enum IterablePushPlatform {
3+
sandbox = 0,
4+
production = 1,
5+
auto = 2
6+
}
7+
8+
export {
9+
IterablePushPlatform
10+
}

0 commit comments

Comments
 (0)