From 5405554cdf723b21ddae9abb08c639568e9fbfdf Mon Sep 17 00:00:00 2001 From: bwaresiak Date: Wed, 6 Mar 2024 22:31:21 +0100 Subject: [PATCH] Validate correct environment (#2546) Task/Issue URL: https://app.asana.com/0/0/1206645876801807/f Tech Design URL: CC: Description: Fire Unique pixel in case we are on dev environment but we most likely should not be. --- Core/PixelEvent.swift | 3 +++ DuckDuckGo/AppDelegate.swift | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index 527ce9c495..be65c36f6a 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -499,6 +499,7 @@ extension Pixel { case syncRemoveDeviceError case syncDeleteAccountError case syncLoginExistingAccountError + case syncWrongEnvironment case swipeTabsUsed case swipeTabsUsedDaily @@ -1004,6 +1005,8 @@ extension Pixel.Event { case .syncDeleteAccountError: return "m_d_sync_delete_account_error" case .syncLoginExistingAccountError: return "m_d_sync_login_existing_account_error" + case .syncWrongEnvironment: return "m_d_sync_wrong_environment_u" + case .swipeTabsUsed: return "m_swipe-tabs-used" case .swipeTabsUsedDaily: return "m_swipe-tabs-used-daily" diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index 3bd12868ed..72323da1e2 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -399,6 +399,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { guard !testing else { return } syncService.initializeIfNeeded() + if syncService.authState == .active && + (InternalUserStore().isInternalUser == false && syncService.serverEnvironment == .development) { + UniquePixel.fire(pixel: .syncWrongEnvironment) + } syncDataProviders.setUpDatabaseCleanersIfNeeded(syncService: syncService) if !(overlayWindow?.rootViewController is AuthenticationViewController) {