Skip to content

Commit

Permalink
Merge pull request #580 from Iterable/MOB-9381-pushPlatform-for-ios
Browse files Browse the repository at this point in the history
[MOB-9381] - Push platform Configuration for iOS
  • Loading branch information
Ayyanchira authored Oct 7, 2024
2 parents 5da295b + 5375672 commit 2f87799
Show file tree
Hide file tree
Showing 4 changed files with 604 additions and 571 deletions.
11 changes: 11 additions & 0 deletions ios/RNIterableAPI/Serialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ extension IterableConfig {
if let pushIntegrationName = dict["pushIntegrationName"] as? String {
config.pushIntegrationName = pushIntegrationName
}

if let pushPlatform = dict["pushPlatform"] as? NSNumber {
switch pushPlatform {
case 0:
config.pushPlatform = .sandbox
case 1:
config.pushPlatform = .production
default:
config.pushPlatform = .auto
}
}

if let autoPushRegistration = dict["autoPushRegistration"] as? Bool {
config.autoPushRegistration = autoPushRegistration
Expand Down
10 changes: 10 additions & 0 deletions ts/IterableConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import IterableInAppMessage from './IterableInAppMessage'

import { IterableDataRegion } from './IterableDataRegion'

import { IterablePushPlatform } from './IterablePushPlatform'

type AuthCallBack = (() => void)

/**
Expand Down Expand Up @@ -121,6 +123,13 @@ class IterableConfig {
* This specifies the data region which determines the data center and associated endpoints used by the SDK
*/
dataRegion: IterableDataRegion = IterableDataRegion.US

/**
* This specifies the push platform to use for push notifications. Either `sandbox`, `production`, or `auto`.
* The default value is `auto`, which means the SDK will automatically determine the push platform to use.
* However, you can also set this to `sandbox` or `production` to force the SDK to use a specific platform.
*/
pushPlatform: IterablePushPlatform = IterablePushPlatform.auto

/**
* Android only feature: This controls whether the SDK should enforce encryption for all PII stored on disk.
Expand All @@ -143,6 +152,7 @@ class IterableConfig {
"androidSdkUseInMemoryStorageForInApps": this.androidSdkUseInMemoryStorageForInApps,
"useInMemoryStorageForInApps": this.useInMemoryStorageForInApps,
"dataRegion": this.dataRegion,
"pushPlatform": this.pushPlatform,
"encryptionEnforced": this.encryptionEnforced
}
}
Expand Down
10 changes: 10 additions & 0 deletions ts/IterablePushPlatform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

enum IterablePushPlatform {
sandbox = 0,
production = 1,
auto = 2
}

export {
IterablePushPlatform
}
Loading

0 comments on commit 2f87799

Please sign in to comment.