From 1689c1acaf9a466d7521c172d39d185c1f4b1f04 Mon Sep 17 00:00:00 2001 From: Alexey Martemyanov Date: Fri, 15 Nov 2024 14:17:51 +0600 Subject: [PATCH] add debug menu items --- DuckDuckGo/Menus/MainMenu.swift | 5 +++++ DuckDuckGo/Menus/MainMenuActions.swift | 18 ++++++++++++++++++ .../Model/AppearancePreferences.swift | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/Menus/MainMenu.swift b/DuckDuckGo/Menus/MainMenu.swift index 018308dd0a..eaa05c7bc8 100644 --- a/DuckDuckGo/Menus/MainMenu.swift +++ b/DuckDuckGo/Menus/MainMenu.swift @@ -627,6 +627,11 @@ final class MainMenu: NSMenu { NSMenuItem(title: "100 Tabs", action: #selector(MainViewController.addDebugTabs(_:)), representedObject: 100) NSMenuItem(title: "150 Tabs", action: #selector(MainViewController.addDebugTabs(_:)), representedObject: 150) } + NSMenuItem(title: "New Tab") { + NSMenuItem(title: "Reset Continue Setup", action: #selector(MainViewController.debugResetContinueSetup)) + NSMenuItem(title: "Shift New Tab daily impression", action: #selector(MainViewController.debugShiftNewTabOpeningDate)) + NSMenuItem(title: "Shift \(AppearancePreferences.Constants.dismissNextStepsCardsAfterDays) days", action: #selector(MainViewController.debugShiftNewTabOpeningDateNtimes)) + } } NSMenuItem(title: "Skip Onboarding", action: #selector(MainViewController.skipOnboarding)) NSMenuItem(title: "Reset Data") { diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index 7598c6b7b8..110028be07 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -767,6 +767,24 @@ extension MainViewController { } } + @objc func debugResetContinueSetup(_ sender: Any?) { + AppearancePreferencesUserDefaultsPersistor().continueSetUpCardsLastDemonstrated = nil + AppearancePreferencesUserDefaultsPersistor().continueSetUpCardsNumberOfDaysDemonstrated = 0 + AppearancePreferences.shared.isContinueSetUpCardsViewOutdated = false + AppearancePreferences.shared.isContinueSetUpVisible = true + } + + @objc func debugShiftNewTabOpeningDate(_ sender: Any?) { + AppearancePreferencesUserDefaultsPersistor().continueSetUpCardsLastDemonstrated = (AppearancePreferencesUserDefaultsPersistor().continueSetUpCardsLastDemonstrated ?? Date()).addingTimeInterval(-.day) + AppearancePreferences.shared.continueSetUpCardsViewDidAppear() + } + + @objc func debugShiftNewTabOpeningDateNtimes(_ sender: Any?) { + for _ in 0.. 0 || true { + if daysSinceLastDemonstration > 0 { persistor.continueSetUpCardsLastDemonstrated = Date() persistor.continueSetUpCardsNumberOfDaysDemonstrated += 1