From 103dcd338796981a50951db691472f034743ba98 Mon Sep 17 00:00:00 2001 From: Chris Brind Date: Thu, 1 Feb 2024 11:18:59 +0000 Subject: [PATCH] add pixel and only fire / change tabs when the index is different --- Core/PixelEvent.swift | 5 +++++ DuckDuckGo/MainViewController.swift | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index babb0b9179..8e4938bcb2 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -502,6 +502,9 @@ extension Pixel { case syncDeleteAccountError case syncLoginExistingAccountError + case swipeTabsUsed + case swipeTabsUsedDaily + case bookmarksCleanupFailed case bookmarksCleanupAttemptedWhileSyncWasEnabled case favoritesCleanupFailed @@ -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" diff --git a/DuckDuckGo/MainViewController.swift b/DuckDuckGo/MainViewController.swift index 62888a3094..3933ba0bb6 100644 --- a/DuckDuckGo/MainViewController.swift +++ b/DuckDuckGo/MainViewController.swift @@ -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