Skip to content

Commit

Permalink
Send failed compilations pixel if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Sep 14, 2023
1 parent f115b40 commit 5c7bf7e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ extension Pixel {
case emailIncontextModalDismissed
case emailIncontextModalExitEarly
case emailIncontextModalExitEarlyContinue

case compilationFailed
}

}
Expand Down Expand Up @@ -881,6 +883,8 @@ extension Pixel.Event {
case .emailIncontextModalDismissed: return "m_email_incontext_modal_dismissed"
case .emailIncontextModalExitEarly: return "m_email_incontext_modal_exit_early"
case .emailIncontextModalExitEarlyContinue: return "m_email_incontext_modal_exit_early_continue"

case .compilationFailed: return "m_d_compilation_failed"
}

}
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8877,8 +8877,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 77.2.0;
branch = "jacek/compilation-pixel";
kind = branch;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"package": "BrowserServicesKit",
"repositoryURL": "https://github.com/DuckDuckGo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "42b073f8a26165e8b328a5f72501abfecdd4c666",
"version": "77.2.0"
"branch": "jacek/compilation-pixel",
"revision": "7f04c144aa5dc7f1bf629695e844ecab942f394d",
"version": null
}
},
{
Expand Down Expand Up @@ -156,7 +156,7 @@
},
{
"package": "TrackerRadarKit",
"repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit",
"repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit.git",
"state": {
"branch": null,
"revision": "4684440d03304e7638a2c8086895367e90987463",
Expand Down
12 changes: 12 additions & 0 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

syncService.scheduler.notifyAppLifecycleEvent()
fireFailedCompilationsPixelIfNeeded()
}

private func fireAppLaunchPixel() {
Expand Down Expand Up @@ -365,6 +366,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
#endif
}

private func fireFailedCompilationsPixelIfNeeded() {
let store = FailedCompilationsStore()
if store.hasAnyFailures {
DailyPixel.fire(pixel: .compilationFailed, withAdditionalParameters: store.summary) { error in
if error == nil {
store.cleanup()
}
}
}
}

private func shouldShowKeyboardOnLaunch() -> Bool {
guard let date = lastBackgroundDate else { return true }
Expand Down

0 comments on commit 5c7bf7e

Please sign in to comment.