diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 7b12570caa..8b53f5f54e 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -507,7 +507,6 @@ 85864FBC24D31EF300E756FF /* SuggestionTrayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85864FBB24D31EF300E756FF /* SuggestionTrayViewController.swift */; }; 858650D12469BCDE00C36F8A /* DaxDialogs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 858650D02469BCDE00C36F8A /* DaxDialogs.swift */; }; 858650D32469BFAD00C36F8A /* DaxDialogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 858650D22469BFAD00C36F8A /* DaxDialogTests.swift */; }; - 858650D9246B0D3C00C36F8A /* DaxOnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 858650D8246B0D3C00C36F8A /* DaxOnboardingViewController.swift */; }; 858650DB246B111900C36F8A /* DaxOnboarding.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 858650DA246B111900C36F8A /* DaxOnboarding.xcassets */; }; 8586A10D24CBA7070049720E /* FindInPageActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8586A10C24CBA7070049720E /* FindInPageActivity.swift */; }; 8586A10E24CBAF5B0049720E /* Core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F143C2E41E4A4CD400CFDE3A /* Core.framework */; }; @@ -1815,7 +1814,6 @@ 85864FBB24D31EF300E756FF /* SuggestionTrayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionTrayViewController.swift; sourceTree = ""; }; 858650D02469BCDE00C36F8A /* DaxDialogs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DaxDialogs.swift; sourceTree = ""; }; 858650D22469BFAD00C36F8A /* DaxDialogTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DaxDialogTests.swift; sourceTree = ""; }; - 858650D8246B0D3C00C36F8A /* DaxOnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DaxOnboardingViewController.swift; sourceTree = ""; }; 858650DA246B111900C36F8A /* DaxOnboarding.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DaxOnboarding.xcassets; sourceTree = ""; }; 8586A10C24CBA7070049720E /* FindInPageActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindInPageActivity.swift; sourceTree = ""; }; 8586A10F24CCCD040049720E /* TabsBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsBarViewController.swift; sourceTree = ""; }; @@ -4431,7 +4429,6 @@ 984147CB24F02E9E00362052 /* DaxOnboarding.storyboard */, 858650D02469BCDE00C36F8A /* DaxDialogs.swift */, 858650DA246B111900C36F8A /* DaxOnboarding.xcassets */, - 858650D8246B0D3C00C36F8A /* DaxOnboardingViewController.swift */, 8524CC93246C5C8900E59D45 /* DaxDialogViewController.swift */, 8524CC99246DA81700E59D45 /* FullscreenDaxDialogViewController.swift */, F42EF9302614BABD00101FB9 /* ActionSheetDaxDialogViewController.swift */, @@ -7746,7 +7743,6 @@ 9FF7E9862C23D10300902BE5 /* BrowsersComparisonChart.swift in Sources */, 6F64AA532C47E92600CF4489 /* FavoritesFaviconLoader.swift in Sources */, 4B274F602AFEAECC003F0745 /* NetworkProtectionWidgetRefreshModel.swift in Sources */, - 858650D9246B0D3C00C36F8A /* DaxOnboardingViewController.swift in Sources */, 312E5746283BB04A00C18FA0 /* AutofillEmptySearchView.swift in Sources */, 8565A34B1FC8D96B00239327 /* LaunchTabNotification.swift in Sources */, 311BD1AD2836BB3900AEF6C1 /* AutofillItemsEmptyView.swift in Sources */, diff --git a/DuckDuckGo/Base.lproj/DaxOnboarding.storyboard b/DuckDuckGo/Base.lproj/DaxOnboarding.storyboard index f95f44d472..0b72f7c384 100644 --- a/DuckDuckGo/Base.lproj/DaxOnboarding.storyboard +++ b/DuckDuckGo/Base.lproj/DaxOnboarding.storyboard @@ -1,149 +1,14 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -331,14 +196,6 @@ DuckDuckGo! - - - - - - - - @@ -348,7 +205,7 @@ DuckDuckGo! - + @@ -442,12 +299,10 @@ DuckDuckGo! - + - - diff --git a/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/Contents.json b/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/Contents.json deleted file mode 100644 index 19cb768f2e..0000000000 --- a/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/Contents.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "images" : [ - { - "filename" : "Lighthouse.pdf", - "idiom" : "iphone" - }, - { - "filename" : "lighthouse-large.pdf", - "idiom" : "ipad" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/Lighthouse.pdf b/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/Lighthouse.pdf deleted file mode 100644 index dab3dccc1f..0000000000 Binary files a/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/Lighthouse.pdf and /dev/null differ diff --git a/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/lighthouse-large.pdf b/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/lighthouse-large.pdf deleted file mode 100644 index 5d648895d7..0000000000 Binary files a/DuckDuckGo/DaxOnboarding.xcassets/Lighthouse.imageset/lighthouse-large.pdf and /dev/null differ diff --git a/DuckDuckGo/DaxOnboardingViewController.swift b/DuckDuckGo/DaxOnboardingViewController.swift deleted file mode 100644 index 9fda073b4e..0000000000 --- a/DuckDuckGo/DaxOnboardingViewController.swift +++ /dev/null @@ -1,206 +0,0 @@ -// -// DaxOnboardingViewController.swift -// DuckDuckGo -// -// Copyright © 2020 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 UIKit - -class DaxOnboardingViewController: UIViewController, Onboarding { - - struct Constants { - - static let animationDelay = 1.4 - static let animationDuration = 0.4 - - } - - weak var delegate: OnboardingDelegate? - weak var daxDialog: DaxDialogViewController? - - @IBOutlet weak var welcomeMessage: UILabel! - @IBOutlet weak var daxDialogContainer: UIView! - @IBOutlet weak var daxDialogContainerHeight: NSLayoutConstraint! - @IBOutlet weak var daxIcon: UIView! - @IBOutlet weak var onboardingIcon: UIView! - @IBOutlet weak var transitionalIcon: UIView! - @IBOutlet weak var button: UIButton! - @IBOutlet weak var backgroundView: UIView! - - override var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return isPad ? super.supportedInterfaceOrientations : [ .portrait ] - } - - override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { - return isPad ? super.preferredInterfaceOrientationForPresentation : .portrait - } - - override var shouldAutorotate: Bool { - return true - } - - private let pixelReporting: OnboardingIntroImpressionReporting - - init?(coder: NSCoder, pixelReporting: OnboardingIntroImpressionReporting) { - self.pixelReporting = pixelReporting - super.init(coder: coder) - } - - @available(*, unavailable) - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func viewDidLoad() { - super.viewDidLoad() - - welcomeMessage.setAttributedTextString(UserText.launchscreenWelcomeMessage) - daxDialog?.message = UserText.daxDialogOnboardingMessage - daxDialog?.reset() - daxDialogContainerHeight.constant = daxDialog?.calculateHeight() ?? 0 - button.displayDropShadow() - daxIcon.isHidden = true - - pixelReporting.trackOnboardingIntroImpression() - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - guard !view.isHidden else { return } - - daxDialogContainerHeight.constant = daxDialog?.calculateHeight() ?? 0 - self.daxDialog?.reset() - - DispatchQueue.main.asyncAfter(deadline: .now() + Constants.animationDelay) { - self.transitionFromOnboarding() - } - } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - super.prepare(for: segue, sender: nil) - - if let daxDialog = segue.destination as? DaxDialogViewController { - self.daxDialog = daxDialog - view.addGestureRecognizer(daxDialog.tapToCompleteGestureRecognizer) - } else if let controller = segue.destination as? DaxOnboardingPadViewController { - controller.delegate = self - } else if let navController = segue.destination as? UINavigationController, - let controller = navController.viewControllers.first as? OnboardingViewController { - controller.delegate = self - } - - } - - func transitionFromOnboarding() { - - // using snapshots means the original views don't get messed up by their constraints when subsequent animations kick off - let transitionIconSS: UIView = self.transitionalIcon.snapshotView(afterScreenUpdates: true) ?? self.transitionalIcon - transitionIconSS.frame = self.transitionalIcon.frame - view.addSubview(transitionIconSS) - self.transitionalIcon.isHidden = true - - let onboardingIconSS: UIView = self.onboardingIcon.snapshotView(afterScreenUpdates: true) ?? self.onboardingIcon - onboardingIconSS.frame = self.onboardingIcon.frame - view.addSubview(onboardingIconSS) - self.onboardingIcon.isHidden = true - - UIView.animate(withDuration: 0.3, animations: { - - // the dax dialog icon is not exactly centered with or the same size as this icon so we need to account for this in the animation - onboardingIconSS.frame = CGRect(x: 0, y: 0, width: 76, height: 76) - onboardingIconSS.center = CGPoint(x: self.daxIcon.center.x, y: self.daxIcon.center.y - 2) - onboardingIconSS.alpha = 0.0 - - transitionIconSS.frame = self.daxIcon.frame - transitionIconSS.alpha = 1.0 - - self.backgroundView.alpha = 0.0 - }, completion: { _ in - self.daxIcon.isHidden = false - onboardingIconSS.isHidden = true - transitionIconSS.isHidden = true - - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - onboardingIconSS.removeFromSuperview() - transitionIconSS.removeFromSuperview() - self.transitionToDaxDialog() - } - - }) - - } - - func transitionToDaxDialog() { - - let snapshot: UIView = self.daxIcon.snapshotView(afterScreenUpdates: true) ?? self.daxIcon - snapshot.frame = self.daxIcon.frame - view.addSubview(snapshot) - self.daxIcon.isHidden = true - - UIView.animate(withDuration: Constants.animationDuration, animations: { - self.welcomeMessage.alpha = 0.0 - - if let frame = self.daxDialog?.icon.frame, - let localFrame = self.daxDialog?.icon.superview!.convert(frame, to: self.view) { - self.daxIcon.frame = localFrame - snapshot.frame = localFrame - } - - }, completion: { _ in - - // fade out while it's being shown again below, otherwise there's an abrupt change when the double dropshadow disappears - UIView.animate(withDuration: 1.0, animations: { - snapshot.alpha = 0.0 - }, completion: { _ in - snapshot.removeFromSuperview() - }) - - self.showDaxDialog { - self.daxDialog?.start() - } - }) - - } - - @IBAction func onTapButton() { - let segue = isPad ? "AddToHomeRow-iPad" : "AddToHomeRow" - performSegue(withIdentifier: segue, sender: self) - } - - func showDaxDialog(completion: @escaping () -> Void) { - daxDialogContainer.alpha = 0.0 - daxDialogContainer.isHidden = false - - button.alpha = 0.0 - button.isHidden = false - - UIView.animate(withDuration: Constants.animationDuration, animations: { - self.daxDialogContainer.alpha = 1.0 - self.button.alpha = 1.0 - }, completion: { _ in - completion() - }) - } - -} - -extension DaxOnboardingViewController: OnboardingDelegate { - func onboardingCompleted(controller: UIViewController) { - self.view.isHidden = true - controller.dismiss(animated: true) - self.delegate?.onboardingCompleted(controller: self) - } -} diff --git a/DuckDuckGo/MainViewController+Segues.swift b/DuckDuckGo/MainViewController+Segues.swift index bca512800e..8d91186009 100644 --- a/DuckDuckGo/MainViewController+Segues.swift +++ b/DuckDuckGo/MainViewController+Segues.swift @@ -33,19 +33,8 @@ extension MainViewController { Logger.lifecycle.debug(#function) hideAllHighlightsIfNeeded() - var controller: (Onboarding & UIViewController)? - - if DefaultVariantManager().isNewIntroFlow { - controller = OnboardingIntroViewController(onboardingPixelReporter: contextualOnboardingPixelReporter) - } else { - let storyboard = UIStoryboard(name: "DaxOnboarding", bundle: nil) - controller = storyboard.instantiateInitialViewController(creator: { coder in - DaxOnboardingViewController(coder: coder, pixelReporting: self.contextualOnboardingPixelReporter) - }) - } - - controller?.delegate = self - guard let controller else { return assertionFailure() } + let controller = OnboardingIntroViewController(onboardingPixelReporter: contextualOnboardingPixelReporter) + controller.delegate = self controller.modalPresentationStyle = .overFullScreen present(controller, animated: false) } diff --git a/DuckDuckGo/OnboardingExperiment/DefaultVariantManager+Onboarding.swift b/DuckDuckGo/OnboardingExperiment/DefaultVariantManager+Onboarding.swift index fa3701270a..528ff47fc8 100644 --- a/DuckDuckGo/OnboardingExperiment/DefaultVariantManager+Onboarding.swift +++ b/DuckDuckGo/OnboardingExperiment/DefaultVariantManager+Onboarding.swift @@ -22,10 +22,6 @@ import BrowserServicesKit extension VariantManager { - var isNewIntroFlow: Bool { - isSupported(feature: .newOnboardingIntro) || isSupported(feature: .newOnboardingIntroHighlights) - } - var isOnboardingHighlightsExperiment: Bool { isSupported(feature: .newOnboardingIntroHighlights) } diff --git a/DuckDuckGo/UserText.swift b/DuckDuckGo/UserText.swift index c526e40a7d..c0d006206f 100644 --- a/DuckDuckGo/UserText.swift +++ b/DuckDuckGo/UserText.swift @@ -221,7 +221,6 @@ public struct UserText { public static let favorite = NSLocalizedString("favorite", value: "Favorite", comment: "") - public static let launchscreenWelcomeMessage = NSLocalizedString("launchscreenWelcomeMessage", value: "Welcome to\nDuckDuckGo!", comment: "Please preserve newline character") public static let onboardingWelcomeHeader = NSLocalizedString("onboardingWelcomeHeader", value: "Welcome to DuckDuckGo!", comment: "") public static let onboardingContinue = NSLocalizedString("onboardingContinue", value: "Continue", comment: "") public static let onboardingSkip = NSLocalizedString("onboardingSkip", value: "Skip", comment: "") @@ -274,9 +273,6 @@ public struct UserText { public static let daxDialogFireButtonEducationConfirmAction = NSLocalizedString("dax.onboarding.fire.button.confirmAction", value: "Close Tabs and Clear Data", comment: "Encourage user to try clearing data with the fire button") public static let daxDialogFireButtonEducationCancelAction = NSLocalizedString("dax.onboarding.fire.button.cancelAction", value: "Cancel", comment: "Cancel action") - - public static let daxDialogOnboardingMessage = NSLocalizedString("dax.onboarding.message", value: "The Internet can be kinda creepy.\n\nNot to worry! Searching and browsing privately is easier than you think.", comment: "") - public static let daxDialogHideTitle = NSLocalizedString("dax.hide.title", value: "Hide remaining tips?", comment: "Title in Hide Dax dialog") public static let daxDialogHideMessage = NSLocalizedString("dax.hide.message", value: "There are only a few, and we tried to make them informative.", comment: "Subtitle in Hide Dax dialog") public static let daxDialogHideButton = NSLocalizedString("dax.hide.button", value: "Hide Tips Forever", comment: "") diff --git a/DuckDuckGo/en.lproj/Localizable.strings b/DuckDuckGo/en.lproj/Localizable.strings index 4ab56d6e1f..214e4328a4 100644 --- a/DuckDuckGo/en.lproj/Localizable.strings +++ b/DuckDuckGo/en.lproj/Localizable.strings @@ -962,9 +962,6 @@ /* ad = advertisment */ "dax.onboarding.home.subsequent" = "You’ve got this!\n\nRemember: Every time you browse with me, a creepy ad loses its wings. 👍"; -/* No comment provided by engineer. */ -"dax.onboarding.message" = "The Internet can be kinda creepy.\n\nNot to worry! Searching and browsing privately is easier than you think."; - /* Default string used if users device is not iPhone or iPad */ "device.type.default" = "device"; @@ -1565,9 +1562,6 @@ /* No comment provided by engineer. */ "keyCommandShowAllTabs" = "Show All Tabs"; -/* Please preserve newline character */ -"launchscreenWelcomeMessage" = "Welcome to\nDuckDuckGo!"; - /* Summary text for the macOS browser waitlist */ "mac-browser.waitlist.summary" = "DuckDuckGo for Mac has the speed you need, the browsing features you expect, and comes packed with our best-in-class privacy essentials."; diff --git a/DuckDuckGoTests/DefaultVariantManagerOnboardingTests.swift b/DuckDuckGoTests/DefaultVariantManagerOnboardingTests.swift index 23d5d06c5f..f9641c8fd1 100644 --- a/DuckDuckGoTests/DefaultVariantManagerOnboardingTests.swift +++ b/DuckDuckGoTests/DefaultVariantManagerOnboardingTests.swift @@ -24,41 +24,6 @@ import BrowserServicesKit final class DefaultVariantManagerOnboardingTests: XCTestCase { - // MARK: - Is New Intro Flow - - func testWhenIsNewIntroFlow_AndFeatureIsNewOnboardingIntro_ThenReturnTrue() { - // GIVEN - let sut = makeVariantManager(features: [.newOnboardingIntro]) - - // WHEN - let result = sut.isNewIntroFlow - - // THEN - XCTAssertTrue(result) - } - - func testWhenIsNewIntroFlow_AndFeaturesContainNewOnboardingIntroHighlights_ThenReturnTrue() { - // GIVEN - let sut = makeVariantManager(features: [.newOnboardingIntroHighlights]) - - // WHEN - let result = sut.isNewIntroFlow - - // THEN - XCTAssertTrue(result) - } - - func testWhenIsNewIntroFlow_AndFeaturesDoNotContainNewOnboardingIntroOrNewOnboardingIntroHighlights_ThenReturnFalse() { - // GIVEN - let sut = makeVariantManager(features: [.contextualDaxDialogs]) - - // WHEN - let result = sut.isNewIntroFlow - - // THEN - XCTAssertFalse(result) - } - // MARK: - Is Onboarding Highlights func testWhenIsOnboardingHighlights_AndFeaturesContainOnboardingHighlights_ThenReturnTrue() {