Skip to content

Commit

Permalink
Add didPerformFetchTimestamp to pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Dec 20, 2024
1 parent d8cd0a4 commit e6f3dd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions Core/Pixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public struct PixelParameters {
public static let didReceiveUNNotification = "didReceiveUNNotification"
public static let didStartRemoteMessagingClientBackgroundTask = "didStartRemoteMessagingClientBackgroundTask"
public static let didStartAppConfigurationFetchBackgroundTask = "didStartAppConfigurationFetchBackgroundTask"
public static let didPerformFetchTimestamp = "didPerformFetchTimestamp"
public static let numberOfBackgrounds = "numberOfBackgrounds"
}

Expand Down
14 changes: 9 additions & 5 deletions DuckDuckGo/AppLifecycle/AppStates/Background.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,29 @@ struct DoubleBackground: AppState {

if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
if let didReceiveMemoryWarningTimestamp = appDelegate.didReceiveMemoryWarningTimestamp,
isValid(timestamp: didReceiveMemoryWarningTimestamp) {
isValid(timestamp: didReceiveMemoryWarningTimestamp) {
parameters[PixelParameters.didReceiveMemoryWarningTimestamp] = dateFormatter.string(from: didReceiveMemoryWarningTimestamp)
}
if let didReceiveMXPayloadTimestamp = appDelegate.didReceiveMXPayloadTimestamp,
isValid(timestamp: didReceiveMXPayloadTimestamp) {
isValid(timestamp: didReceiveMXPayloadTimestamp) {
parameters[PixelParameters.didReceiveMXPayloadTimestamp] = dateFormatter.string(from: didReceiveMXPayloadTimestamp)
}
if let didReceiveUNNotificationTimestamp = appDelegate.didReceiveUNNotificationTimestamp,
isValid(timestamp: didReceiveUNNotificationTimestamp) {
isValid(timestamp: didReceiveUNNotificationTimestamp) {
parameters[PixelParameters.didReceiveUNNotification] = dateFormatter.string(from: didReceiveUNNotificationTimestamp)
}
if let didStartRemoteMessagingClientBackgroundTaskTimestamp = appDelegate.didStartRemoteMessagingClientBackgroundTaskTimestamp,
isValid(timestamp: didStartRemoteMessagingClientBackgroundTaskTimestamp) {
isValid(timestamp: didStartRemoteMessagingClientBackgroundTaskTimestamp) {
parameters[PixelParameters.didStartRemoteMessagingClientBackgroundTask] = dateFormatter.string(from: didStartRemoteMessagingClientBackgroundTaskTimestamp)
}
if let didStartAppConfigurationFetchBackgroundTaskTimestamp = appDelegate.didStartAppConfigurationFetchBackgroundTaskTimestamp,
isValid(timestamp: didStartAppConfigurationFetchBackgroundTaskTimestamp) {
isValid(timestamp: didStartAppConfigurationFetchBackgroundTaskTimestamp) {
parameters[PixelParameters.didStartAppConfigurationFetchBackgroundTask] = dateFormatter.string(from: didStartAppConfigurationFetchBackgroundTaskTimestamp)
}
if let didPerformFetchTimestamp = appDelegate.didPerformFetchTimestamp,
isValid(timestamp: didPerformFetchTimestamp) {
parameters[PixelParameters.didPerformFetchTimestamp] = dateFormatter.string(from: didPerformFetchTimestamp)
}
}
Pixel.fire(pixel: .appDidConsecutivelyBackground, withAdditionalParameters: parameters)
}
Expand Down

0 comments on commit e6f3dd8

Please sign in to comment.