Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboarding highlights experiment updates #3406

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DuckDuckGo/DaxDialogs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ final class DaxDialogs: NewTabDialogSpecProvider, ContextualOnboardingLogic {
var isEnabled: Bool {
// skip dax dialogs in integration tests
guard ProcessInfo.processInfo.environment["DAXDIALOGS"] != "false" else { return false }
guard variantManager.shouldShowDaxDialogs else { return false }
return !settings.isDismissed
}

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/FullscreenDaxDialogViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class FullscreenDaxDialogViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if let spec = spec {
Pixel.fire(pixel: spec.pixelName, withAdditionalParameters: [ "wo": woShown ? "1" : "0" ])
Pixel.fire(pixel: spec.pixelName, withAdditionalParameters: [ "wo": woShown ? "1" : "0" ], includedParameters: [.appVersion, .atb])
}
containerHeight.constant = daxDialogViewController?.calculateHeight() ?? 0
daxDialogViewController?.start()
Expand Down
2 changes: 0 additions & 2 deletions DuckDuckGo/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,6 @@ class HomeViewController: UIViewController, NewTabPage {
}

func presentNextDaxDialog() {
guard variantManager.shouldShowDaxDialogs else { return }

if variantManager.isContextualDaxDialogsEnabled {
showNextDaxDialogNew(dialogProvider: newTabDialogTypeProvider, factory: newTabDialogFactory)
} else {
Expand Down
3 changes: 1 addition & 2 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2737,8 +2737,7 @@ extension MainViewController: AutoClearWorker {
self.privacyProDataReporter.saveFireCount()

// Ideally this should happen once data clearing has finished AND the animation is finished
// `showNextDaxDialog: true` only set from old onboarding FireDialog ActionSheet
if showNextDaxDialog && self.variantManager.shouldShowDaxDialogs {
if showNextDaxDialog {
self.homeController?.showNextDaxDialog()
} else if KeyboardSettings().onNewTab {
let showKeyboardAfterFireButton = DispatchWorkItem {
Expand Down
4 changes: 1 addition & 3 deletions DuckDuckGo/NewTabPageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ final class NewTabPageViewController: UIHostingController<NewTabPageView<Favorit
}

func showNextDaxDialog() {
if variantManager.shouldShowDaxDialogs {
showNextDaxDialogNew(dialogProvider: newTabDialogTypeProvider, factory: newTabDialogFactory)
}
showNextDaxDialogNew(dialogProvider: newTabDialogTypeProvider, factory: newTabDialogFactory)
}

func onboardingCompleted() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ final class ContextualOnboardingPresenter: ContextualOnboardingPresenting {
}

func presentContextualOnboarding(for spec: DaxDialogs.BrowsingSpec, in vc: TabViewOnboardingDelegate) {
// Extra safety net
guard variantManager.shouldShowDaxDialogs else { return }

if variantManager.isContextualDaxDialogsEnabled {
presentExperimentContextualOnboarding(for: spec, in: vc)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ extension VariantManager {
isSupported(feature: .newOnboardingIntroHighlights)
}

var shouldShowDaxDialogs: Bool {
// Disable Dax Dialogs if only feature supported is .newOnboardingIntro
guard let features = currentVariant?.features else { return true }
return !(features.count == 1 && features.contains(.newOnboardingIntro))
}

var isContextualDaxDialogsEnabled: Bool {
isSupported(feature: .contextualDaxDialogs)
}
Expand Down
8 changes: 1 addition & 7 deletions DuckDuckGo/TabSwitcherViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,7 @@ class TabSwitcherViewController: UIViewController {
}

Pixel.fire(pixel: .forgetAllPressedTabSwitching)
let variantManager = DefaultVariantManager()
let isNewOnboarding = variantManager.isContextualDaxDialogsEnabled

guard variantManager.shouldShowDaxDialogs else {
presentForgetDataAlert()
return
}
let isNewOnboarding = DefaultVariantManager().isContextualDaxDialogsEnabled

if !isNewOnboarding
&& DaxDialogs.shared.shouldShowFireButtonPulse {
Expand Down
9 changes: 1 addition & 8 deletions DuckDuckGo/TabsBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,7 @@ class TabsBarViewController: UIViewController {
self.present(controller: alert, fromView: fireButton)
}

let variantManager = DefaultVariantManager()

guard variantManager.shouldShowDaxDialogs else {
showClearDataAlert()
return
}

if variantManager.isContextualDaxDialogsEnabled {
if DefaultVariantManager().isContextualDaxDialogsEnabled {
delegate?.tabsBarDidRequestFireEducationDialog(self)
showClearDataAlert()
} else {
Expand Down
23 changes: 0 additions & 23 deletions DuckDuckGoTests/ContextualOnboardingPresenterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,6 @@ final class ContextualOnboardingPresenterTests: XCTestCase {
XCTAssertNotNil(parent.capturedChild)
}

func testWhenPresentContextualOnboardingAndVariantShouldNotShowContextualDialogsThenDoNothing() {
// GIVEN
var variantManagerMock = MockVariantManager()
variantManagerMock.currentVariant = MockVariant(features: [.newOnboardingIntro])
let sut = ContextualOnboardingPresenter(variantManager: variantManagerMock, daxDialogsFactory: contextualDaxDialogsFactory)
let parent = TabViewControllerMock()
XCTAssertFalse(parent.didCallAddChild)
XCTAssertNil(parent.capturedChild)
XCTAssertFalse(parent.didCallPerformSegue)
XCTAssertNil(parent.capturedSegueIdentifier)
XCTAssertNil(parent.capturedSender)

// WHEN
sut.presentContextualOnboarding(for: .afterSearch, in: parent)

// THEN
XCTAssertFalse(parent.didCallAddChild)
XCTAssertNil(parent.capturedChild)
XCTAssertFalse(parent.didCallPerformSegue)
XCTAssertNil(parent.capturedSegueIdentifier)
XCTAssertNil(parent.capturedSender)
}

func testWhenPresentContextualOnboardingForFireEducational_andBarAtTheTop_TheMessageHandPointsInTheRightDirection() throws {
// GIVEN
var variantManagerMock = MockVariantManager()
Expand Down
13 changes: 0 additions & 13 deletions DuckDuckGoTests/DaxDialogTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1100,19 +1100,6 @@ final class DaxDialog: XCTestCase {
XCTAssertTrue(result)
}

func testWhenIsEnabledIsCalled_AndShouldShowDaxDialogsIsFalse_ThenReturnFalse() {
// GIVEN
var mockVariantManager = MockVariantManager()
mockVariantManager.currentVariant = MockVariant(features: [.newOnboardingIntro])
let sut = DaxDialogs(settings: settings, entityProviding: entityProvider, variantManager: mockVariantManager)

// WHEN
let result = sut.isEnabled

// THEN
XCTAssertFalse(result)
}

private func detectedTrackerFrom(_ url: URL, pageUrl: String) -> DetectedRequest {
let entity = entityProvider.entity(forHost: url.host!)
return DetectedRequest(url: url.absoluteString,
Expand Down
46 changes: 0 additions & 46 deletions DuckDuckGoTests/DefaultVariantManagerOnboardingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,52 +94,6 @@ final class DefaultVariantManagerOnboardingTests: XCTestCase {
XCTAssertFalse(result)
}

// MARK: - Should Show Dax Dialogs

func testWhenShouldShowDaxDialogs_AndFeaturesContainOnboardingIntro_ThenReturnFalse() {
// GIVEN
let sut = makeVariantManager(features: [.newOnboardingIntro])

// WHEN
let result = sut.shouldShowDaxDialogs

// THEN
XCTAssertFalse(result)
}

func testWhenShouldShowDaxDialogs_AndFeaturesContainOnboardingIntroAndContextualDaxDialogs_ThenReturnTrue() {
// GIVEN
let sut = makeVariantManager(features: [.newOnboardingIntro, .contextualDaxDialogs])

// WHEN
let result = sut.shouldShowDaxDialogs

// THEN
XCTAssertTrue(result)
}

func testWhenShouldShowDaxDialogs_AndFeaturesContainOnboardingHighlights_ThenReturnTrue() {
// GIVEN
let sut = makeVariantManager(features: [.newOnboardingIntroHighlights])

// WHEN
let result = sut.shouldShowDaxDialogs

// THEN
XCTAssertTrue(result)
}

func testWhenShouldShowDaxDialogs_AndFeaturesIsEmpty_ThenReturnTrue() {
// GIVEN
let sut = makeVariantManager(features: [])

// WHEN
let result = sut.shouldShowDaxDialogs

// THEN
XCTAssertTrue(result)
}

// MARK: - Is Contextual Dax Dialogs Enabled

func testWhenIsContextualDaxDialogsEnabled_AndFeaturesContainContextualDaxDialogs_ThenReturnTrue() {
Expand Down
29 changes: 0 additions & 29 deletions DuckDuckGoTests/HomeViewControllerDaxDialogTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,6 @@ final class HomeViewControllerDaxDialogTests: XCTestCase {
XCTAssertNotNil(self.dialogFactory.onDismiss)
}

func testWhenDaxDialogsAreNotEnabled_OnDidAppear_NothingHappens() throws {
// GIVEN
variantManager.currentVariant = MockVariant(features: [.newOnboardingIntro])
let expectedSpec = randomDialogType()
specProvider.specToReturn = expectedSpec

// WHEN
hvc.viewDidAppear(false)

// THEN
XCTAssertNil(self.variantManager.capturedFeatureName)
XCTAssertFalse(self.specProvider.nextHomeScreenMessageCalled)
XCTAssertFalse(self.specProvider.nextHomeScreenMessageNewCalled)
XCTAssertNil(self.dialogFactory.homeDialog)
XCTAssertNil(self.dialogFactory.onDismiss)
}

func testWhenOldOnboarding_OnDidAppear_NothingPassedDialogFactory() throws {
// GIVEN
variantManager.supportedFeatures = []
Expand Down Expand Up @@ -197,18 +180,6 @@ final class HomeViewControllerDaxDialogTests: XCTestCase {
XCTAssertFalse(specProvider.nextHomeScreenMessageNewCalled)
}

func testWhenShowNextDaxDialog_AndShouldNotShowDaxDialogs_ThenReturnFalse() {
// GIVEN
variantManager.currentVariant = MockVariant(features: [.newOnboardingIntro])

// WHEN
hvc.showNextDaxDialog()

// THEN
XCTAssertFalse(specProvider.nextHomeScreenMessageCalled)
XCTAssertFalse(specProvider.nextHomeScreenMessageNewCalled)
}

private func randomDialogType() -> DaxDialogs.HomeScreenSpec {
let specs: [DaxDialogs.HomeScreenSpec] = [.initial, .subsequent, .final, .addFavorite]
return specs.randomElement()!
Expand Down
Loading