Skip to content

Commit

Permalink
Remove noise pixels and limit the counter parameter to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Dec 20, 2024
1 parent 82ee613 commit 0a694ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 0 additions & 6 deletions DuckDuckGo/AppLifecycle/AppStateTransitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ extension Background {
extension DoubleBackground {

func apply(event: AppEvent) -> any AppState {
// report event so we know what events can be called at this moment, but do not let SM be stuck in this state just not to be flooded with these events
_ = handleUnexpectedEvent(event)

switch event {
case .activating(let application):
return Active(application: application)
Expand All @@ -123,9 +120,6 @@ extension DoubleBackground {
extension InactiveBackground {

func apply(event: AppEvent) -> any AppState {
// report event so we know what events can be called at this moment, but do not let SM be stuck in this state just not to be flooded with these events
_ = handleUnexpectedEvent(event)

switch event {
case .activating(let application):
return Active(application: application)
Expand Down
7 changes: 5 additions & 2 deletions DuckDuckGo/AppLifecycle/AppStates/Background.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ struct DoubleBackground: AppState {

var parameters = [
PixelParameters.firstBackgroundTimestamp: dateFormatter.string(from: previousDidEnterBackgroundTimestamp),
PixelParameters.secondBackgroundTimestamp: dateFormatter.string(from: currentDidEnterBackgroundTimestamp),
PixelParameters.numberOfBackgrounds: String(counter)
PixelParameters.secondBackgroundTimestamp: dateFormatter.string(from: currentDidEnterBackgroundTimestamp)
]

if counter < 5 {
parameters[PixelParameters.numberOfBackgrounds] = String(counter)
}

func isValid(timestamp: Date) -> Bool {
timestamp >= previousDidEnterBackgroundTimestamp && timestamp <= currentDidEnterBackgroundTimestamp
}
Expand Down

0 comments on commit 0a694ec

Please sign in to comment.