Skip to content

Commit e1094c8

Browse files
Move PushServicePlatform enum to Swift
1 parent 13aef9c commit e1094c8

File tree

4 files changed

+26
-25
lines changed

4 files changed

+26
-25
lines changed

swift-sdk/Internal/IterableAPIInternal.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
123123
hexToken = (token as NSData).iteHexadecimalString()
124124

125125
let device = UIDevice.current
126-
let psp = IterableAPIInternal.pushServicePlatformToString(pushServicePlatform)
126+
let pushServicePlatformString = IterableAPIInternal.pushServicePlatformToString(pushServicePlatform)
127127

128128
var dataFields: [String : Any] = [
129129
.ITBL_DEVICE_LOCALIZED_MODEL: device.localizedModel,
@@ -151,7 +151,7 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
151151

152152
let deviceDictionary: [String : Any] = [
153153
AnyHashable.ITBL_KEY_TOKEN: hexToken!,
154-
AnyHashable.ITBL_KEY_PLATFORM: psp,
154+
AnyHashable.ITBL_KEY_PLATFORM: pushServicePlatformString,
155155
AnyHashable.ITBL_KEY_APPLICATION_NAME: appName,
156156
AnyHashable.ITBL_KEY_DATA_FIELDS: dataFields
157157
]
@@ -551,11 +551,11 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
551551
private var pushIntegrationName: String? {
552552
if let pushIntegrationName = config.pushIntegrationName, let sandboxPushIntegrationName = config.sandboxPushIntegrationName {
553553
switch(config.pushPlatform) {
554-
case .APNS:
554+
case .production:
555555
return pushIntegrationName
556-
case .APNS_SANDBOX:
556+
case .sandbox:
557557
return sandboxPushIntegrationName
558-
case .AUTO:
558+
case .auto:
559559
return IterableAPNSUtil.isSandboxAPNS() ? sandboxPushIntegrationName : pushIntegrationName
560560
}
561561
}
@@ -641,11 +641,11 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
641641

642642
private static func pushServicePlatformToString(_ pushServicePlatform: PushServicePlatform) -> String {
643643
switch pushServicePlatform {
644-
case .APNS:
644+
case .production:
645645
return .ITBL_KEY_APNS
646-
case .APNS_SANDBOX:
646+
case .sandbox:
647647
return .ITBL_KEY_APNS_SANDBOX
648-
case .AUTO:
648+
case .auto:
649649
return IterableAPNSUtil.isSandboxAPNS() ? .ITBL_KEY_APNS_SANDBOX : .ITBL_KEY_APNS
650650
}
651651
}

swift-sdk/IterableAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public final class IterableAPI : NSObject {
8989

9090
/**
9191
* Register this device's token with Iterable
92-
* Push integration name and platform are read from `IterableConfig`. If platform is set to `AUTO`, it will
92+
* Push integration name and platform are read from `IterableConfig`. If platform is set to `auto`, it will
9393
* read APNS environment from the provisioning profile and use an integration name specified in `IterableConfig`.
9494
- parameters:
9595
- token: The token representing this device/application pair, obtained from
@@ -102,7 +102,7 @@ public final class IterableAPI : NSObject {
102102

103103
/**
104104
* Register this device's token with Iterable
105-
* Push integration name and platform are read from `IterableConfig`. If platform is set to `AUTO`, it will
105+
* Push integration name and platform are read from `IterableConfig`. If platform is set to `auto`, it will
106106
* read APNS environment from the provisioning profile and use an integration name specified in `IterableConfig`.
107107
- parameters:
108108
- token: The token representing this device/application pair, obtained from

swift-sdk/IterableConfig.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ import Foundation
5555
@objc(log:Message:) func log(level: LogLevel, message: String)
5656
}
5757

58+
/**
59+
Enum representing push platform; apple push notification service, production vs sandbox
60+
*/
61+
@objc public enum PushServicePlatform : Int {
62+
/** The sandbox push service */
63+
case sandbox
64+
/** The production push service */
65+
case production
66+
/** Detect automatically */
67+
case auto
68+
}
69+
5870
/**
5971
Iterable Configuration Object. Use this when initializing the API.
6072
*/
@@ -73,11 +85,11 @@ public class IterableConfig : NSObject {
7385
public var sandboxPushIntegrationName: String?
7486

7587
/**
76-
* APNS environment for the current build of the app.
77-
* Possible values: `APNS_SANDBOX`, `APNS_SANDBOX`, `AUTO`
78-
* Defaults to `AUTO` and detects the APNS environment automatically
88+
* APNS (Apple Push Notification Service) environment for the current build of the app.
89+
* Possible values: `production`, `sandbox`, `auto`
90+
* Defaults to `auto` and detects the APNS environment automatically
7991
*/
80-
public var pushPlatform: PushServicePlatform = .AUTO
92+
public var pushPlatform: PushServicePlatform = .auto
8193

8294
/// Handles Iterable actions of type 'openUrl'
8395
public weak var urlDelegate: IterableURLDelegate?

swift-sdk/IterableConstants.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,3 @@ typedef void (^OnSuccessHandler)(NSDictionary *data);
5353
*/
5454
typedef void (^OnFailureHandler)(NSString *reason, NSData *_Nullable data);
5555

56-
/**
57-
Enum representing push platform; apple push notification service, production vs sandbox
58-
*/
59-
typedef NS_ENUM(NSInteger, PushServicePlatform) {
60-
/** The sandbox push service */
61-
APNS_SANDBOX,
62-
/** The production push service */
63-
APNS,
64-
/** Detect automatically */
65-
AUTO
66-
};

0 commit comments

Comments
 (0)