Skip to content

Commit

Permalink
♻️ Omit analytics from test/preview pushes
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed May 6, 2024
1 parent 75e30c2 commit bc29bb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Sources/AppcuesKit/Push/ParsedNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal struct ParsedNotification {
self.attachmentURL = (userInfo["appcues_attachment_url"] as? String)
.flatMap { URL(string: $0) }
self.attachmentType = userInfo["appcues_attachment_type"] as? String
self.isTest = userInfo["appcues_test"] as? Bool ?? false
self.isTest = userInfo["appcues_test"] != nil
self.isInternal = userInfo["_appcues_internal"] as? Bool ?? false
}
}
24 changes: 13 additions & 11 deletions Sources/AppcuesKit/Push/PushMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,19 @@ internal class PushMonitor: PushMonitoring {
parsedNotification: ParsedNotification,
completionHandler: @escaping () -> Void
) {
analyticsPublisher.publish(TrackingUpdate(
type: .event(name: Events.Push.pushOpened.rawValue, interactive: false),
properties: [
"notification_id": parsedNotification.notificationID,
"workflow_id": parsedNotification.workflowID,
"workflow_task_id": parsedNotification.workflowTaskID,
"transaction_id": parsedNotification.transactionID,
"device_id": storage.deviceID
].compactMapValues { $0 },
isInternal: true
))
if !parsedNotification.isTest {
analyticsPublisher.publish(TrackingUpdate(
type: .event(name: Events.Push.pushOpened.rawValue, interactive: false),
properties: [
"notification_id": parsedNotification.notificationID,
"workflow_id": parsedNotification.workflowID,
"workflow_task_id": parsedNotification.workflowTaskID,
"transaction_id": parsedNotification.transactionID,
"device_id": storage.deviceID
].compactMapValues { $0 },
isInternal: true
))
}

if #available(iOS 13.0, *) {
var actions: [AppcuesExperienceAction] = []
Expand Down

0 comments on commit bc29bb3

Please sign in to comment.