From 8f256c3fda1f697d555c4093e7fb3eb7e023a715 Mon Sep 17 00:00:00 2001 From: Christopher Brind Date: Tue, 19 Sep 2023 13:49:52 +0100 Subject: [PATCH] remove set as default statistics (#2018) --- Core/Pixel.swift | 2 - Core/PixelEvent.swift | 12 ---- Core/SetAsDefaultStatistics.swift | 55 ------------------- Core/StatisticsLoader.swift | 4 -- DuckDuckGo.xcodeproj/project.pbxproj | 4 -- DuckDuckGo/AppDelegate.swift | 1 - ...boardingDefaultBroswerViewController.swift | 2 - 7 files changed, 80 deletions(-) delete mode 100644 Core/SetAsDefaultStatistics.swift diff --git a/Core/Pixel.swift b/Core/Pixel.swift index b3606fbd86..1d60adcf71 100644 --- a/Core/Pixel.swift +++ b/Core/Pixel.swift @@ -110,8 +110,6 @@ public struct PixelParameters { public static let message = "message" public static let sheetResult = "success" - public static let defaultBrowser = "default_browser" - // Return user public static let returnUserErrorCode = "error_code" public static let returnUserOldATB = "old_atb" diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index 1d9fd4dc57..a1c6c8daf3 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -302,10 +302,6 @@ extension Pixel { case remoteMessageSecondaryActionClicked case remoteMessageSheet - // MARK: Set as Default - case onboardingSetDefaultOpened - case onboardingSetDefaultSkipped - // MARK: Return user measurement case returnUser @@ -443,8 +439,6 @@ extension Pixel { case invalidPayload(Configuration) - case dailyActiveUser - case emailIncontextPromptDisplayed case emailIncontextPromptConfirmed case emailIncontextPromptDismissed @@ -744,10 +738,6 @@ extension Pixel.Event { case .remoteMessageSecondaryActionClicked: return "m_remote_message_secondary_action_clicked" case .remoteMessageSheet: return "m_remote_message_sheet" - // MARK: Set as default measuring - case .onboardingSetDefaultOpened: return "m_onboarding_set-default-opened" - case .onboardingSetDefaultSkipped: return "m_onboarding_set-default-skipped" - // MARK: debug pixels case .dbCrashDetected: return "m_d_crash" @@ -880,8 +870,6 @@ extension Pixel.Event { case .invalidPayload(let configuration): return "m_d_\(configuration.rawValue)_invalid_payload".lowercased() - case .dailyActiveUser: return "m_daily_active_user" - // MARK: - InContext Email Protection case .emailIncontextPromptDisplayed: return "m_email_incontext_prompt_displayed" case .emailIncontextPromptConfirmed: return "m_email_incontext_prompt_confirmed" diff --git a/Core/SetAsDefaultStatistics.swift b/Core/SetAsDefaultStatistics.swift deleted file mode 100644 index 3faa71aa24..0000000000 --- a/Core/SetAsDefaultStatistics.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// SetAsDefaultStatistics.swift -// DuckDuckGo -// -// Copyright © 2023 DuckDuckGo. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation - -/// Measuring set as default usage. To be removed mid-end October. -public class SetAsDefaultStatistics { - - @UserDefaultsWrapper(key: .defaultBrowserUsageLastSeen, defaultValue: nil) - var defaultBrowserUsageLastSeen: Date? - - /// We assume we're default if we the app was launched with a URL in the last 7 days - public var isDefault: Bool { - guard let lastSeen = defaultBrowserUsageLastSeen, - let days = Calendar.current.numberOfDaysBetween(lastSeen, and: Date()) else { return false } - return (0...7).contains(days) - } - - public init() { } - - public func openedAsDefault() { - defaultBrowserUsageLastSeen = Date() - } - - public func setAsDefaultOpened() { - Pixel.fire(pixel: .onboardingSetDefaultOpened) - } - - public func setAsDefaultSkipped() { - Pixel.fire(pixel: .onboardingSetDefaultSkipped) - } - - public func fireDailyActiveUser() { - DailyPixel.fire(pixel: .dailyActiveUser, withAdditionalParameters: [ - PixelParameters.defaultBrowser: "\(isDefault)" - ]) - } - -} diff --git a/Core/StatisticsLoader.swift b/Core/StatisticsLoader.swift index 9fa6967c2e..e852d70540 100644 --- a/Core/StatisticsLoader.swift +++ b/Core/StatisticsLoader.swift @@ -91,8 +91,6 @@ public class StatisticsLoader { return } - SetAsDefaultStatistics().fireDailyActiveUser() - let configuration = APIRequest.Configuration(url: url) let request = APIRequest(configuration: configuration, urlSession: .session()) @@ -116,8 +114,6 @@ public class StatisticsLoader { return } - SetAsDefaultStatistics().fireDailyActiveUser() - let configuration = APIRequest.Configuration(url: url) let request = APIRequest(configuration: configuration, urlSession: .session()) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 2c4957e728..eb745d86d7 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -408,7 +408,6 @@ 8565A34B1FC8D96B00239327 /* LaunchTabNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8565A34A1FC8D96B00239327 /* LaunchTabNotification.swift */; }; 8565A34D1FC8DFE400239327 /* LaunchTabNotificationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8565A34C1FC8DFE400239327 /* LaunchTabNotificationTests.swift */; }; 8577A1C5255D2C0D00D43FCD /* HitTestingToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8577A1C4255D2C0D00D43FCD /* HitTestingToolbar.swift */; }; - 8577C6602A964BAC00788B3A /* SetAsDefaultStatistics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8577C65F2A964BAC00788B3A /* SetAsDefaultStatistics.swift */; }; 857EEB752095FFAC008A005C /* HomeRowInstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 857EEB742095FFAC008A005C /* HomeRowInstructionsViewController.swift */; }; 858566E8252E4F56007501B8 /* Debug.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 858566E7252E4F56007501B8 /* Debug.storyboard */; }; 858566FB252E55D6007501B8 /* ImageCacheDebugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 858566FA252E55D6007501B8 /* ImageCacheDebugViewController.swift */; }; @@ -1403,7 +1402,6 @@ 8565A34A1FC8D96B00239327 /* LaunchTabNotification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTabNotification.swift; sourceTree = ""; }; 8565A34C1FC8DFE400239327 /* LaunchTabNotificationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTabNotificationTests.swift; sourceTree = ""; }; 8577A1C4255D2C0D00D43FCD /* HitTestingToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HitTestingToolbar.swift; sourceTree = ""; }; - 8577C65F2A964BAC00788B3A /* SetAsDefaultStatistics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetAsDefaultStatistics.swift; sourceTree = ""; }; 857EEB742095FFAC008A005C /* HomeRowInstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeRowInstructionsViewController.swift; sourceTree = ""; }; 858566E7252E4F56007501B8 /* Debug.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Debug.storyboard; sourceTree = ""; }; 858566FA252E55D6007501B8 /* ImageCacheDebugViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCacheDebugViewController.swift; sourceTree = ""; }; @@ -4400,7 +4398,6 @@ 853A717520F62FE800FE60BC /* Pixel.swift */, 1E05D1D729C46EDA00BF9A1F /* TimedPixel.swift */, 1E05D1D529C46EBB00BF9A1F /* DailyPixel.swift */, - 8577C65F2A964BAC00788B3A /* SetAsDefaultStatistics.swift */, 85E242162AB1B54D000F3E28 /* ReturnUserMeasurement.swift */, ); name = Statistics; @@ -6642,7 +6639,6 @@ 85F21DC621145DD5002631A6 /* global.swift in Sources */, F41C2DA326C1925700F9A760 /* BookmarksAndFolders.xcdatamodeld in Sources */, F4F6DFBA26EFF28A00ED7E12 /* BookmarkObjects.swift in Sources */, - 8577C6602A964BAC00788B3A /* SetAsDefaultStatistics.swift in Sources */, 836A941D247F23C600BF8EF5 /* UserAgentManager.swift in Sources */, 4B83397329AFB8D2003F7EA9 /* AppTrackingProtectionFeedbackModel.swift in Sources */, 85CA53A824BB343700A6288C /* Favicons.swift in Sources */, diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index e069ce280f..95126bb9d3 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -473,7 +473,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { showKeyboardIfSettingOn = false if !handleAppDeepLink(app, mainViewController, url) { - SetAsDefaultStatistics().openedAsDefault() mainViewController?.loadUrlInNewTab(url, reuseExisting: true, inheritedAttribution: nil) } diff --git a/DuckDuckGo/OnboardingDefaultBroswerViewController.swift b/DuckDuckGo/OnboardingDefaultBroswerViewController.swift index 807db19c25..addf162132 100644 --- a/DuckDuckGo/OnboardingDefaultBroswerViewController.swift +++ b/DuckDuckGo/OnboardingDefaultBroswerViewController.swift @@ -35,7 +35,6 @@ class OnboardingDefaultBroswerViewController: OnboardingContentViewController { } override func onContinuePressed(navigationHandler: @escaping () -> Void) { - SetAsDefaultStatistics().setAsDefaultOpened() if let url = URL(string: UIApplication.openSettingsURLString) { UIApplication.shared.open(url) } @@ -43,7 +42,6 @@ class OnboardingDefaultBroswerViewController: OnboardingContentViewController { } override func onSkipPressed(navigationHandler: @escaping () -> Void) { - SetAsDefaultStatistics().setAsDefaultSkipped() super.onSkipPressed(navigationHandler: navigationHandler) } }