Skip to content

Commit

Permalink
add pixel and only fire / change tabs when the index is different
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy committed Feb 1, 2024
1 parent cc424da commit 103dcd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ extension Pixel {
case syncDeleteAccountError
case syncLoginExistingAccountError

case swipeTabsUsed
case swipeTabsUsedDaily

case bookmarksCleanupFailed
case bookmarksCleanupAttemptedWhileSyncWasEnabled
case favoritesCleanupFailed
Expand Down Expand Up @@ -995,6 +998,8 @@ extension Pixel.Event {
case .syncDeleteAccountError: return "m_d_sync_delete_account_error"
case .syncLoginExistingAccountError: return "m_d_sync_login_existing_account_error"

case .swipeTabsUsed: return "m_swipe-tabs-used"
case .swipeTabsUsedDaily: return "m_swipe-tabs-used-daily"

case .bookmarksCleanupFailed: return "m_d_bookmarks_cleanup_failed"
case .bookmarksCleanupAttemptedWhileSyncWasEnabled: return "m_d_bookmarks_cleanup_attempted_while_sync_was_enabled"
Expand Down
6 changes: 6 additions & 0 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ class MainViewController: UIViewController {
swipeTabsCoordinator = SwipeTabsCoordinator(coordinator: viewCoordinator,
tabPreviewsSource: previewsSource,
appSettings: appSettings) { [weak self] in

guard $0 != self?.tabManager.model.currentIndex else { return }

DailyPixel.fire(pixel: .swipeTabsUsedDaily)
Pixel.fire(pixel: .swipeTabsUsed)
self?.select(tabAt: $0)

} newTab: { [weak self] in
self?.newTab()
} onSwipeStarted: { [weak self] in
Expand Down

0 comments on commit 103dcd3

Please sign in to comment.