Skip to content

Commit

Permalink
Fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Dec 19, 2024
1 parent 88a7dc8 commit 5ef686f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo/AppLifecycle/AppStateTransitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ extension Background {
case .openURL:
return self
case .backgrounding:
return DoubleBackground(firstTimeBackgroundTimestamp: timestamp)
return DoubleBackground(firstTimeBackgroundTimestamp: timestamp, consecutiveTimestamps: [])
case .launching, .suspending:
return handleUnexpectedEvent(event)
}
Expand All @@ -111,7 +111,7 @@ extension DoubleBackground {
case .suspending(let application):
return Inactive(application: application)
case .backgrounding(let application):
return DoubleBackground(firstTimeBackgroundTimestamp: firstTimeBackgroundTimestamp,)
return DoubleBackground(firstTimeBackgroundTimestamp: firstTimeBackgroundTimestamp, consecutiveTimestamps: consecutiveTimestamps)
case .launching, .openURL:
return self
}
Expand Down
7 changes: 4 additions & 3 deletions DuckDuckGo/AppLifecycle/AppStates/Background.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ struct DoubleBackground: AppState {
}()

let firstTimeBackgroundTimestamp: Date
var consecutiveTimestamps: [Date]
var consecutiveTimestamps: [Date] = []

init(firstTimeBackgroundTimestamp: Date) {
init(firstTimeBackgroundTimestamp: Date, consecutiveTimestamps: [Date]) {
self.firstTimeBackgroundTimestamp = firstTimeBackgroundTimestamp
self.consecutiveTimestamps = consecutiveTimestamps
let lastTimestamp = Date()
consecutiveTimestamps.append(lastTimestamp)
self.consecutiveTimestamps.append(lastTimestamp)

var parameters = [PixelParameters.firstBackgroundTimestamp: dateFormatter.string(from: firstTimeBackgroundTimestamp)]

Expand Down

0 comments on commit 5ef686f

Please sign in to comment.