Skip to content

Commit 0006060

Browse files
committed
Logs InApp content block data without HTML content
1 parent a93ab9d commit 0006060

8 files changed

+149
-43
lines changed

ExponeaSDK/Example/Views/AuthenticationViewController.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ class AuthenticationViewController: UIViewController {
8989
publicKey: advancedAuthPubKey,
9090
expiration: nil
9191
)
92-
93-
92+
9493
let exponea = Exponea.shared.onInitSucceeded {
9594
Exponea.logger.log(.verbose, message: "Configuration initialization succeeded")
9695
//Uncomment if you want to test in-app message delegate
9796
//Exponea.shared.inAppMessagesDelegate = InAppDelegate(overrideDefaultBehavior: true, trackActions: false)
9897
}
99-
98+
Exponea.logger.logLevel = .verbose
10099
exponea.checkPushSetup = true
101100
Exponea.logger.log(.verbose, message: "Before Configuration call")
102101
exponea.configure(

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/InAppContentBlocksManager.swift

+90-35
Large diffs are not rendered by default.

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/Model/InAppContentBlockResponse.swift

+6
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,9 @@ public struct InAppContentBlocksDisplayStatus: Codable, Equatable {
151151
let displayed: Date?
152152
let interacted: Date?
153153
}
154+
155+
internal extension InAppContentBlockResponse {
156+
func describe() -> String {
157+
return "ID:\(id), Name:\(name)"
158+
}
159+
}

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/Model/PersonalizedInAppContentBlockResponse.swift

+19
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,22 @@ public struct PersonalizedInAppContentBlockResponse: Codable {
8989
self.ttlSeen = ttlSeen
9090
}
9191
}
92+
93+
extension PersonalizedInAppContentBlockResponse {
94+
func describeDetailed() -> String {
95+
return """
96+
{
97+
id: \(id),
98+
status: \(status),
99+
ttlSeconds: \(ttlSeconds),
100+
variantId: \(String(describing: variantId)),
101+
hasTrackingConsent: \(String(describing: hasTrackingConsent)),
102+
variantName: \(String(describing: variantName)),
103+
contentType: \(String(describing: contentType)),
104+
ttlSeen: \(String(describing: ttlSeen)),
105+
tag: \(String(describing: tag)),
106+
isCorruptedImage: \(isCorruptedImage)
107+
}
108+
"""
109+
}
110+
}

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/Model/QueueData.swift

+11
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,14 @@ struct QueueLoadData {
1818
let indexPath: IndexPath
1919
let expired: [InAppContentBlockResponse]
2020
}
21+
22+
extension QueueData {
23+
func describeDetailed() -> String {
24+
return """
25+
{
26+
inAppContentBlocks: \(inAppContentBlocks.describe()),
27+
newValue: \(newValue.describeDetailed())
28+
}
29+
"""
30+
}
31+
}

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/Model/UsedInAppContentBlocks.swift

+15
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,19 @@ public struct UsedInAppContentBlocks {
3636
self.hasBeenLoaded = hasBeenLoaded
3737
self.placeholderData = placeholderData
3838
}
39+
40+
func describeDetailed() -> String {
41+
return """
42+
{
43+
tag: \(tag),
44+
indexPath: \(indexPath),
45+
messageId: \(messageId),
46+
placeholder: \(placeholder),
47+
height: \(height),
48+
hasBeenLoaded: \(hasBeenLoaded),
49+
placeholderData: \(String(describing: placeholderData?.describe())),
50+
isActive: \(isActive)
51+
}
52+
"""
53+
}
3954
}

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/Protocol/InAppContentBlockCallbackType.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public protocol InAppContentBlockCallbackType {
1818

1919
internal struct DefaultInAppContentBlockCallback: InAppContentBlockCallbackType {
2020
func onMessageShown(placeholderId: String, contentBlock: InAppContentBlockResponse) {
21-
Exponea.logger.log(.verbose, message: "Tracking of InApp Content Block \(contentBlock.id) show")
21+
Exponea.logger.log(
22+
.verbose,
23+
message: "Tracking of InApp Content Block \(contentBlock) show"
24+
)
2225
Exponea.shared.trackInAppContentBlockShown(placeholderId: placeholderId, message: contentBlock)
2326
}
2427
func onNoMessageFound(placeholderId: String) {

ExponeaSDK/ExponeaSDK/Classes/Others/HtmlNormalizer.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class HtmlNormalizer {
8989
document = try SwiftSoup.parse(originalHtml)
9090
} catch {
9191
Exponea.logger.log(
92-
.verbose,
92+
.warning,
9393
message: "[HTML] Unable to parse original HTML source code \(originalHtml)"
9494
)
9595
document = nil
@@ -122,9 +122,7 @@ public class HtmlNormalizer {
122122
return nil
123123
}
124124
do {
125-
let result = try document.html()
126-
Exponea.logger.log(.verbose, message: "[HTML] Output is:\n \(String(describing: result))")
127-
return result
125+
return try document.html()
128126
} catch let error {
129127
Exponea.logger.log(.error, message: "[HTML] Output cannot be exported: \(error)")
130128
return nil

0 commit comments

Comments
 (0)