Skip to content

Commit 592ada3

Browse files
Remove 'channelName'
1 parent eca1cca commit 592ada3

File tree

7 files changed

+6
-37
lines changed

7 files changed

+6
-37
lines changed

Tests/swift-sdk-swift-tests/InAppHelperTests.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ class InAppHelperTests: XCTestCase {
320320
"""
321321
var customPayload1 = customPayloadStr1.toJsonDict()
322322
customPayload1["inAppType"] = "default"
323-
customPayload1["channelName"] = "channel1"
324323
customPayload1["contentType"] = "html"
325324

326325
let customPayloadStr2 = """
@@ -334,7 +333,6 @@ class InAppHelperTests: XCTestCase {
334333
"""
335334
var customPayload2 = customPayloadStr2.toJsonDict()
336335
customPayload2["inAppType"] = "inBox"
337-
customPayload2["channelName"] = "channel2"
338336
customPayload2["contentType"] = "html"
339337

340338
let payload = """
@@ -395,21 +393,17 @@ class InAppHelperTests: XCTestCase {
395393
XCTAssertEqual(messages.count, 4)
396394
let message1 = messages[0]
397395
XCTAssertEqual(message1.messageId, "messageId1")
398-
XCTAssertEqual(message1.channelName, "channel1")
399396
XCTAssertEqual(message1.inAppType, .default)
400397
XCTAssertTrue(TestUtils.areEqual(dict1: message1.extraInfo!, dict2: customPayloadStr1.toJsonDict()))
401398

402399
let message2 = messages[1]
403-
XCTAssertEqual(message2.channelName, "channel2")
404400
XCTAssertEqual(message2.inAppType, .inBox)
405401
XCTAssertTrue(TestUtils.areEqual(dict1: message2.extraInfo!, dict2: customPayloadStr2.toJsonDict()))
406402

407403
let message3 = messages[2]
408-
XCTAssertEqual(message3.channelName, "")
409404
XCTAssertEqual(message3.inAppType, .default)
410405

411406
let message4 = messages[3]
412-
XCTAssertEqual(message4.channelName, "")
413407
XCTAssertEqual(message4.inAppType, .default)
414408
}
415409

@@ -445,7 +439,6 @@ class InAppHelperTests: XCTestCase {
445439
"messageId" : "messageIdxxx",
446440
"campaignId" : "campaignIdxxx",
447441
"inAppType" : "default",
448-
"channelName" : "channel1",
449442
"trigger" : {
450443
"type" : "myNewKind",
451444
"myPayload" : {"var1" : "val1"}
@@ -454,7 +447,6 @@ class InAppHelperTests: XCTestCase {
454447
},
455448
{
456449
"inAppType" : "inBox",
457-
"channelName" : "channel2",
458450
"content" : {
459451
"contentType" : "html",
460452
"html" : "<a href=\\"http://somewhere.com\\">Click here</a>"
@@ -497,21 +489,17 @@ class InAppHelperTests: XCTestCase {
497489

498490
XCTAssertEqual(messages.count, 4)
499491
let message1 = messages[0]
500-
XCTAssertEqual(message1.channelName, "channel1")
501492
XCTAssertEqual(message1.inAppType, .default)
502493
XCTAssertTrue(TestUtils.areEqual(dict1: message1.extraInfo!, dict2: customPayloadStr1.toJsonDict()))
503494

504495
let message2 = messages[1]
505-
XCTAssertEqual(message2.channelName, "channel2")
506496
XCTAssertEqual(message2.inAppType, .inBox)
507497
XCTAssertTrue(TestUtils.areEqual(dict1: message2.extraInfo!, dict2: customPayloadStr2.toJsonDict()))
508498

509499
let message3 = messages[2]
510-
XCTAssertEqual(message3.channelName, "")
511500
XCTAssertEqual(message3.inAppType, .default)
512501

513502
let message4 = messages[3]
514-
XCTAssertEqual(message4.channelName, "")
515503
XCTAssertEqual(message4.inAppType, .default)
516504
}
517505

Tests/swift-sdk-swift-tests/InAppTests.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,12 @@ class InAppTests: XCTestCase {
708708
[
709709
{
710710
"inAppType": "default",
711-
"channelName": "channel1",
712-
"content": {"contentType": "html", "inAppDisplaySettings": {"bottom": {"displayOption": "AutoExpand"}, "backgroundAlpha": 0.5, "left": {"percentage": 60}, "right": {"percentage": 60}, "top": {"displayOption": "AutoExpand"}}, "html": "<a href=\'https://www.site1.com\'>Click Here</a>", "payload": {"channelName": "inBox", "title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}},
711+
"content": {"contentType": "html", "inAppDisplaySettings": {"bottom": {"displayOption": "AutoExpand"}, "backgroundAlpha": 0.5, "left": {"percentage": 60}, "right": {"percentage": 60}, "top": {"displayOption": "AutoExpand"}}, "html": "<a href=\'https://www.site1.com\'>Click Here</a>", "payload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}},
713712
"trigger": {"type": "event", "details": "some event details"},
714713
"messageId": "message1",
715714
"expiresAt": 1550605745142,
716715
"campaignId": "campaign1",
717-
"customPayload": {"channelName": "inBox", "title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
716+
"customPayload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
718717
},
719718
{
720719
"inAppType": "inBox",
@@ -723,22 +722,22 @@ class InAppTests: XCTestCase {
723722
"messageId": "message2",
724723
"expiresAt": 1550605745145,
725724
"campaignId": "campaign2",
726-
"customPayload": {"channelName": "inBox", "title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
725+
"customPayload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
727726
},
728727
{
729728
"content": {"inAppDisplaySettings": {"bottom": {"displayOption": "AutoExpand"}, "backgroundAlpha": 0.5, "left": {"percentage": 60}, "right": {"percentage": 60}, "top": {"displayOption": "AutoExpand"}}, "html": "<a href=\'https://www.site3.com\'>Click Here</a>"},
730729
"trigger": {"type": "never"},
731730
"messageId": "message3",
732731
"campaignId": "campaign3",
733-
"customPayload": {"channelName": "inBox", "title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
732+
"customPayload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
734733
},
735734
{
736735
"content": {"inAppDisplaySettings": {"bottom": {"displayOption": "AutoExpand"}, "backgroundAlpha": 0.5, "left": {"percentage": 60}, "right": {"percentage": 60}, "top": {"displayOption": "AutoExpand"}}, "html": "<a href=\'https://www.site4.com\'>Click Here</a>"},
737736
"trigger": {"type": "newEventType", "nested": {"var1": "val1"}},
738737
"messageId": "message4",
739738
"expiresAt": 1550605745145,
740739
"campaignId": "campaign4",
741-
"customPayload": {"channelName": "inBox", "title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
740+
"customPayload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
742741
}
743742
]
744743
}
@@ -1028,7 +1027,6 @@ extension IterableInAppMessage {
10281027
return IterableUtil.describe("messageId", messageId,
10291028
"campaignId", campaignId,
10301029
"inAppType", inAppType,
1031-
"channelName", channelName,
10321030
"trigger", trigger,
10331031
"expiresAt", expiresAt ?? "nil",
10341032
"content", content,

Tests/swift-sdk-swift-tests/TestInAppPayloadGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct TestInAppPayloadGenerator {
8484
],
8585
"messageId" : getMessageId(index: index),
8686
"campaignId" : getCampaignId(index: index),
87-
"customPayload" : ["channelName" : "inBox", "title" : "Product 1 Available", "date" : "2018-11-14T14:00:00:00.32Z"]
87+
"customPayload" : ["title" : "Product 1 Available", "date" : "2018-11-14T14:00:00:00.32Z"]
8888
]
8989
}
9090

swift-sdk/ITBConsts.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ public extension AnyHashable {
157157
public static let ITBL_IN_APP_HREF = "href"
158158
public static let ITBL_IN_APP_DISPLAY_SETTINGS = "inAppDisplaySettings"
159159
public static let ITBL_IN_APP_CUSTOM_PAYLOAD = "customPayload"
160-
public static let ITBL_IN_APP_CHANNEL_NAME = "channelName"
161160
public static let ITBL_IN_APP_INAPP_TYPE = "inAppType"
162161
public static let ITBL_IN_APP_CONTENT_TYPE = "contentType"
163162
}

swift-sdk/Internal/InAppHelper.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ struct InAppHelper {
308308
private struct InAppDetails {
309309
let inAppType: IterableInAppType
310310
let content: IterableInAppContent
311-
let channelName: String
312311
let messageId: String
313312
let campaignId: String
314313
let trigger: IterableInAppTrigger
@@ -339,7 +338,6 @@ struct InAppHelper {
339338
}
340339

341340
moveValue(withKey: AnyHashable.ITBL_IN_APP_INAPP_TYPE, from: &customPayloadDict, to: &result)
342-
moveValue(withKey: AnyHashable.ITBL_IN_APP_CHANNEL_NAME, from: &customPayloadDict, to: &result)
343341

344342
if var contentDict = dict[.ITBL_IN_APP_CONTENT] as? [AnyHashable : Any] {
345343
moveValue(withKey: AnyHashable.ITBL_IN_APP_CONTENT_TYPE, from: &customPayloadDict, to: &contentDict)
@@ -397,16 +395,12 @@ struct InAppHelper {
397395

398396
let extraInfo = parseCustomPayload(fromPayload: dict)
399397

400-
// this is temporary until we fix backend
401-
let channelName = dict[.ITBL_IN_APP_CHANNEL_NAME] as? String ?? ""
402-
403398
let trigger = parseTrigger(fromTriggerElement: dict[.ITBL_IN_APP_TRIGGER] as? [AnyHashable : Any])
404399
let expiresAt = parseExpiresAt(dict: dict)
405400

406401
return .success(InAppDetails(
407402
inAppType: inAppType,
408403
content: content,
409-
channelName: channelName,
410404
messageId: messageId,
411405
campaignId: campaignId,
412406
trigger: trigger,
@@ -440,7 +434,6 @@ struct InAppHelper {
440434
case .success(let inAppDetails):
441435
return IterableInAppMessage(messageId: inAppDetails.messageId,
442436
campaignId: inAppDetails.campaignId,
443-
channelName: inAppDetails.channelName,
444437
inAppType: inAppDetails.inAppType,
445438
trigger: inAppDetails.trigger,
446439
expiresAt: inAppDetails.expiresAt,

swift-sdk/Internal/InAppPersistence.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ extension IterableInAppMessage : Codable {
176176
case inAppType
177177
case messageId
178178
case campaignId
179-
case channelName
180179
case trigger
181180
case expiresAt
182181
case content
@@ -198,7 +197,6 @@ extension IterableInAppMessage : Codable {
198197
let inAppType = (try? container.decode(IterableInAppType.self, forKey: .inAppType)) ?? .default
199198
let messageId = (try? container.decode(String.self, forKey: .messageId)) ?? ""
200199
let campaignId = (try? container.decode(String.self, forKey: .campaignId)) ?? ""
201-
let channelName = (try? container.decode(String.self, forKey: .channelName)) ?? ""
202200
let trigger = (try? container.decode(IterableInAppTrigger.self, forKey: .trigger)) ?? .undefinedTrigger
203201
let expiresAt = (try? container.decode(Date.self, forKey: .expiresAt))
204202
let content = IterableInAppMessage.decodeContent(from: container)
@@ -207,7 +205,6 @@ extension IterableInAppMessage : Codable {
207205

208206
self.init(messageId: messageId,
209207
campaignId: campaignId,
210-
channelName: channelName,
211208
inAppType: inAppType,
212209
trigger: trigger,
213210
expiresAt: expiresAt,
@@ -248,7 +245,6 @@ extension IterableInAppMessage : Codable {
248245
try? container.encode(inAppType, forKey: .inAppType)
249246
try? container.encode(messageId, forKey: .messageId)
250247
try? container.encode(campaignId, forKey: .campaignId)
251-
try? container.encode(channelName, forKey: .channelName)
252248
try? container.encode(trigger, forKey: .trigger)
253249
try? container.encode(expiresAt, forKey: .expiresAt)
254250
IterableInAppMessage.encode(content: content, inContainer: &container)

swift-sdk/IterableInApp.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ public final class IterableInAppMessage : NSObject {
121121
/// the campaign id for this message
122122
public let campaignId: String
123123

124-
/// the name of channelFor this message
125-
public let channelName: String
126-
127124
/// the in-app type
128125
public let inAppType: IterableInAppType
129126

@@ -151,7 +148,6 @@ public final class IterableInAppMessage : NSObject {
151148
init(
152149
messageId: String,
153150
campaignId: String,
154-
channelName: String = "",
155151
inAppType: IterableInAppType = .default,
156152
trigger: IterableInAppTrigger = .defaultTrigger,
157153
expiresAt: Date? = nil,
@@ -160,7 +156,6 @@ public final class IterableInAppMessage : NSObject {
160156
) {
161157
self.messageId = messageId
162158
self.campaignId = campaignId
163-
self.channelName = channelName
164159
self.inAppType = inAppType
165160
self.trigger = trigger
166161
self.expiresAt = expiresAt

0 commit comments

Comments
 (0)