Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ import com.duckduckgo.app.browser.viewstate.LoadingViewState
import com.duckduckgo.app.browser.webview.SslWarningLayout.Action
import com.duckduckgo.app.cta.db.DismissedCtaDao
import com.duckduckgo.app.cta.model.CtaId
import com.duckduckgo.app.cta.model.CtaId.DAX_DIALOG_NETWORK
import com.duckduckgo.app.cta.model.CtaId.DAX_DIALOG_TRACKERS_FOUND
import com.duckduckgo.app.cta.model.CtaId.DAX_END
import com.duckduckgo.app.cta.model.DismissedCta
import com.duckduckgo.app.cta.ui.Cta
Expand Down Expand Up @@ -2366,6 +2368,7 @@ class BrowserTabViewModelTest {
whenever(mockWidgetCapabilities.supportsAutomaticWidgetAdd).thenReturn(false)
whenever(mockWidgetCapabilities.hasInstalledWidgets).thenReturn(true)
whenever(mockDismissedCtaDao.exists(DAX_END)).thenReturn(true)
whenever(mockDismissedCtaDao.exists(DAX_DIALOG_TRACKERS_FOUND)).thenReturn(true)
testee.refreshCta()
assertNull(testee.ctaViewState.value!!.cta)
assertTrue(testee.ctaViewState.value!!.daxOnboardingComplete)
Expand All @@ -2378,6 +2381,7 @@ class BrowserTabViewModelTest {
whenever(mockWidgetCapabilities.supportsAutomaticWidgetAdd).thenReturn(false)
whenever(mockWidgetCapabilities.hasInstalledWidgets).thenReturn(true)
whenever(mockDismissedCtaDao.exists(DAX_END)).thenReturn(true)
whenever(mockDismissedCtaDao.exists(DAX_DIALOG_NETWORK)).thenReturn(true)
testee.refreshCta()
assertNull(testee.ctaViewState.value!!.cta)
assertTrue(testee.ctaViewState.value!!.daxOnboardingComplete)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteEntity
import com.duckduckgo.app.fire.fireproofwebsite.data.FireproofWebsiteRepository
import com.duckduckgo.app.fire.fireproofwebsite.ui.AutomaticFireproofSetting.ALWAYS
import com.duckduckgo.app.fire.fireproofwebsite.ui.AutomaticFireproofSetting.ASK_EVERY_TIME
import com.duckduckgo.app.global.*
import com.duckduckgo.app.global.events.db.UserEventKey
import com.duckduckgo.app.global.events.db.UserEventsStore
import com.duckduckgo.app.global.model.PrivacyShield
Expand Down Expand Up @@ -2442,7 +2441,7 @@ class BrowserTabViewModel @Inject constructor(
)
}
val isOnboardingComplete = withContext(dispatchers.io()) {
ctaViewModel.daxDialogEndShown()
ctaViewModel.areBubbleDaxDialogsCompleted()
}
if (isBrowserShowing && cta != null) hasCtaBeenShownForCurrentPage.set(true)
ctaViewState.value = currentCtaViewState().copy(
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ class CtaViewModel @Inject constructor(

// We only want to show New Tab when the Home CTAs from Onboarding has finished
// https://app.asana.com/0/1157893581871903/1207769731595075/f
fun daxDialogEndShown(): Boolean = dismissedCtaDao.exists(CtaId.DAX_END)
fun areBubbleDaxDialogsCompleted(): Boolean {
val bubbleCtasShown = daxDialogEndShown() && (daxDialogNetworkShown() || daxDialogOtherShown() || daxDialogTrackersFoundShown())
return bubbleCtasShown || hideTips()
}

private fun daxDialogSerpShown(): Boolean = dismissedCtaDao.exists(CtaId.DAX_DIALOG_SERP)

Expand All @@ -300,6 +303,8 @@ class CtaViewModel @Inject constructor(

private fun daxDialogFireEducationShown(): Boolean = dismissedCtaDao.exists(CtaId.DAX_FIRE_BUTTON)

private fun daxDialogEndShown(): Boolean = dismissedCtaDao.exists(CtaId.DAX_END)

private fun pulseFireButtonShown(): Boolean = dismissedCtaDao.exists(CtaId.DAX_FIRE_BUTTON_PULSE)

private fun isSerpUrl(url: String): Boolean = url.contains(OnboardingDaxDialogCta.SERP)
Expand Down