File tree Expand file tree Collapse file tree 4 files changed +10
-12
lines changed
swift-sdk.xcodeproj/xcshareddata/xcschemes
swift-sdk/Internal/in-app Expand file tree Collapse file tree 4 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 80
80
</BuildAction >
81
81
<TestAction
82
82
buildConfiguration = " Debug"
83
- selectedDebuggerIdentifier = " "
84
- selectedLauncherIdentifier = " Xcode.IDEFoundation .Launcher.PosixSpawn "
83
+ selectedDebuggerIdentifier = " Xcode.DebuggerFoundation.Debugger.LLDB "
84
+ selectedLauncherIdentifier = " Xcode.DebuggerFoundation .Launcher.LLDB "
85
85
shouldUseLaunchSchemeArgsEnv = " YES"
86
86
codeCoverageEnabled = " YES"
87
87
onlyGenerateCoverageForSpecifiedTargets = " YES" >
Original file line number Diff line number Diff line change @@ -82,7 +82,11 @@ struct InAppMessageParser {
82
82
}
83
83
84
84
let jsonOnly = ( json [ JsonKey . InApp. jsonOnly] as? Int ?? 0 ) == 1
85
- let customPayload = parseCustomPayload ( fromPayload: json)
85
+ var customPayload = parseCustomPayload ( fromPayload: json)
86
+
87
+ if jsonOnly && customPayload == nil {
88
+ customPayload = [ : ]
89
+ }
86
90
87
91
// For non-JSON-only messages, we require content
88
92
if !jsonOnly {
Original file line number Diff line number Diff line change @@ -255,16 +255,10 @@ extension IterableInAppMessage: Codable {
255
255
256
256
let jsonOnly = ( try ? container. decode ( Int . self, forKey: . jsonOnly) ) ?? 0
257
257
let customPayloadData = try ? container. decode ( Data . self, forKey: . customPayload)
258
- let customPayload = IterableInAppMessage . deserializeCustomPayload ( withData: customPayloadData)
258
+ var customPayload = IterableInAppMessage . deserializeCustomPayload ( withData: customPayloadData)
259
259
260
- // For JSON-only messages, require customPayload
261
260
if jsonOnly == 1 && customPayload == nil {
262
- ITBError ( " JSON-only message requires customPayload " )
263
- self . init ( messageId: " " ,
264
- campaignId: 0 ,
265
- content: IterableInAppMessage . createDefaultContent ( ) ,
266
- jsonOnly: false )
267
- return
261
+ customPayload = [ : ]
268
262
}
269
263
270
264
let saveToInbox = ( try ? container. decode ( Bool . self, forKey: . saveToInbox) ) ?? false
Original file line number Diff line number Diff line change @@ -1671,7 +1671,7 @@ class InAppTests: XCTestCase {
1671
1671
XCTAssertEqual ( messages. count, 1 )
1672
1672
1673
1673
let message = messages [ 0 ]
1674
- XCTAssertTrue ( message. customPayload == nil )
1674
+ XCTAssertTrue ( message. customPayload? . isEmpty ?? false )
1675
1675
expectation1. fulfill ( )
1676
1676
}
1677
1677
You can’t perform that action at this time.
0 commit comments