Skip to content

Commit 67b3c65

Browse files
authored
Onboarding: Added onboarding active check to New Tab Page (#5849)
Task/Issue URL: https://app.asana.com/0/1201807753394693/1209870056514404/f ### Description Added a check for onboarding active in order to show the new tab page ### Steps to test this PR _Existing user_ - [x] Add some favorites - [x] Install from branch - [x] Check favorites still appear in new tab page _New user_ - [x] Fresh install - [x] Don't skip onboarding - [x] Add favorites before finishing onboarding - [x] finish onboarding - [x] Check favorites appear ### No UI changes
1 parent 5ca3dbd commit 67b3c65

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,15 @@ class CtaViewModel @Inject constructor(
368368
suspend fun areBubbleDaxDialogsCompleted(): Boolean {
369369
return withContext(dispatchers.io()) {
370370
val noBrowserCtaExperiment = extendedOnboardingFeatureToggles.noBrowserCtas().isEnabled()
371-
noBrowserCtaExperiment || daxDialogEndShown() || hideTips()
371+
noBrowserCtaExperiment || daxDialogEndShown() || hideTips() || !userStageStore.daxOnboardingActive()
372372
}
373373
}
374374

375375
suspend fun areInContextDaxDialogsCompleted(): Boolean {
376376
return withContext(dispatchers.io()) {
377377
val noBrowserCtaExperiment = extendedOnboardingFeatureToggles.noBrowserCtas().isEnabled()
378378
val inContextDaxCtasShown = daxDialogSerpShown() && daxDialogTrackersFoundShown() && daxDialogFireEducationShown() && daxDialogEndShown()
379-
noBrowserCtaExperiment || inContextDaxCtasShown || hideTips()
379+
noBrowserCtaExperiment || inContextDaxCtasShown || hideTips() || !userStageStore.daxOnboardingActive()
380380
}
381381
}
382382

app/src/test/java/com/duckduckgo/app/cta/ui/OnboardingDaxDialogTests.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,19 @@ class OnboardingDaxDialogTests {
177177
assertTrue(onboardingComplete)
178178
}
179179

180+
@Test
181+
fun whenOnboardingCompleteThenAreBubbleDaxDialogsCompletedIsTrue() = runTest {
182+
whenever(userStageStore.getUserAppStage()).thenReturn(AppStage.ESTABLISHED)
183+
whenever(settingsDataStore.hideTips).thenReturn(false)
184+
whenever(dismissedCtaDao.exists(DAX_DIALOG_SERP)).thenReturn(false)
185+
whenever(dismissedCtaDao.exists(DAX_DIALOG_TRACKERS_FOUND)).thenReturn(false)
186+
whenever(dismissedCtaDao.exists(DAX_FIRE_BUTTON)).thenReturn(false)
187+
whenever(dismissedCtaDao.exists(DAX_END)).thenReturn(false)
188+
189+
val inContextDaxDialogsComplete = testee.areBubbleDaxDialogsCompleted()
190+
assertTrue(inContextDaxDialogsComplete)
191+
}
192+
180193
@Test
181194
fun whenAllInContextDialogsShownThenAreInContextDialogsCompletedIsTrue() = runTest {
182195
whenever(userStageStore.getUserAppStage()).thenReturn(AppStage.DAX_ONBOARDING)
@@ -220,4 +233,17 @@ class OnboardingDaxDialogTests {
220233
val inContextDaxDialogsComplete = testee.areInContextDaxDialogsCompleted()
221234
assertTrue(inContextDaxDialogsComplete)
222235
}
236+
237+
@Test
238+
fun whenOnboardingCompleteThenAreInContextDialogsCompletedIsTrue() = runTest {
239+
whenever(userStageStore.getUserAppStage()).thenReturn(AppStage.ESTABLISHED)
240+
whenever(settingsDataStore.hideTips).thenReturn(false)
241+
whenever(dismissedCtaDao.exists(DAX_DIALOG_SERP)).thenReturn(false)
242+
whenever(dismissedCtaDao.exists(DAX_DIALOG_TRACKERS_FOUND)).thenReturn(false)
243+
whenever(dismissedCtaDao.exists(DAX_FIRE_BUTTON)).thenReturn(false)
244+
whenever(dismissedCtaDao.exists(DAX_END)).thenReturn(false)
245+
246+
val inContextDaxDialogsComplete = testee.areInContextDaxDialogsCompleted()
247+
assertTrue(inContextDaxDialogsComplete)
248+
}
223249
}

0 commit comments

Comments
 (0)