Skip to content

Onboarding Design Experiment: Final fixes #6590

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
25 changes: 17 additions & 8 deletions app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3164,8 +3164,10 @@ class BrowserTabFragment :
daxBubbleCta.hideDaxBubbleCta(binding)
hideDaxBubbleCta()
if (onboardingDesignExperimentManager.isBuckEnrolledAndEnabled()) {
if (daxBubbleCta is DaxBubbleCta.DaxEndCta) {
hideBuckEndAnimation()
when (daxBubbleCta) {
is DaxBubbleCta.DaxIntroSearchOptionsCta -> hideBuckMagnifyingGlassAnimation()
is DaxBubbleCta.DaxEndCta -> hideBuckEndAnimation()
else -> Unit
}
}
renderer.showNewTab()
Expand Down Expand Up @@ -4510,12 +4512,15 @@ class BrowserTabFragment :
}

if (onboardingDesignExperimentManager.isBuckEnrolledAndEnabled()) {
if (configuration is DaxIntroVisitSiteOptionsCta && context?.resources?.getBoolean(R.bool.show_wing_animation) == true) {
lifecycleScope.launch {
with(newBrowserTab.wingAnimation) {
delay(2.5.seconds)
show()
playAnimation()
if (configuration is DaxIntroVisitSiteOptionsCta) {
hideBuckMagnifyingGlassAnimation()
if (context?.resources?.getBoolean(R.bool.show_wing_animation) == true) {
lifecycleScope.launch {
with(newBrowserTab.wingAnimation) {
delay(2.5.seconds)
show()
playAnimation()
}
}
}
}
Expand Down Expand Up @@ -4726,6 +4731,10 @@ class BrowserTabFragment :
}
}

private fun hideBuckMagnifyingGlassAnimation() {
newBrowserTab.buckMagnifyingGlassAnimation.isGone = true
}

private fun hideBuckEndAnimation() {
newBrowserTab.buckEndAnimation.isGone = true
val backgroundColor = requireActivity().getColorFromAttr(attrColor = CommonR.attr.daxColorBackground)
Expand Down
66 changes: 45 additions & 21 deletions app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,14 @@ sealed class OnboardingDaxDialogCta(

optionsViews.forEachIndexed { index, buttonView ->
options[index].setOptionView(buttonView)
buttonView.animate().alpha(MAX_ALPHA).duration = DAX_DIALOG_APPEARANCE_ANIMATION
buttonView.setOnClickListener {
onSuggestedOptionClicked?.invoke(options[index], index)
wingAnimation.gone()
}
buttonView.animate().alpha(MAX_ALPHA)
.setDuration(DAX_DIALOG_APPEARANCE_ANIMATION)
.withEndAction {
buttonView.setOnClickListener {
onSuggestedOptionClicked?.invoke(options[index], index)
wingAnimation.gone()
}
}
}

showAndPlayWingAnimation()
Expand Down Expand Up @@ -1004,10 +1007,13 @@ sealed class OnboardingDaxDialogCta(

optionsViews.forEachIndexed { index, buttonView ->
options[index].setOptionView(buttonView)
buttonView.animate().alpha(MAX_ALPHA).duration = DAX_DIALOG_APPEARANCE_ANIMATION
buttonView.setOnClickListener {
onSuggestedOptionClicked?.invoke(options[index], index)
}
buttonView.animate().alpha(MAX_ALPHA)
.setDuration(DAX_DIALOG_APPEARANCE_ANIMATION)
.withEndAction {
buttonView.setOnClickListener {
onSuggestedOptionClicked?.invoke(options[index], index)
}
}
}
}

Expand Down Expand Up @@ -1144,6 +1150,8 @@ sealed class DaxBubbleCta(
) : Cta, ViewCta, DaxCta {

var isModifiedControlOnboardingExperimentEnabled: Boolean? = null
private var buckAnimators: List<ViewPropertyAnimator> = emptyList()
private var bbAnimators: List<ViewPropertyAnimator> = emptyList()

protected var ctaView: View? = null

Expand Down Expand Up @@ -1326,13 +1334,13 @@ sealed class DaxBubbleCta(
val afterAnimation = {
daxBubbleDialogTitle.finishAnimation()
dialogTextCta.finishAnimation()
placeholder?.let { placeholderImageView.fadeIn() }
primaryCta.fadeIn()
secondaryCta.fadeIn()
placeholder?.let { bbAnimators += placeholderImageView.fadeIn() }
bbAnimators += primaryCta.fadeIn()
bbAnimators += secondaryCta.fadeIn()
options?.let {
optionsViews.forEachIndexed { index, buttonView ->
if (it.size > index) {
buttonView.fadeIn()
bbAnimators += buttonView.fadeIn()
}
}
}
Expand All @@ -1357,9 +1365,9 @@ sealed class DaxBubbleCta(
}
}

root.fadeIn().setStartDelay(500).withEndAction {
bbAnimators += root.fadeIn().setStartDelay(500).withEndAction {
if (configuration is DaxEndCta) {
headerImage.fadeIn().withEndAction {
bbAnimators += headerImage.fadeIn().withEndAction {
runTypingAnimations()
}
} else {
Expand Down Expand Up @@ -1455,13 +1463,13 @@ sealed class DaxBubbleCta(

val afterAnimation = {
dialogTextCta.finishAnimation()
placeholder?.let { placeholderImageView.fadeIn() }
primaryCta.fadeIn()
secondaryCta.fadeIn()
placeholder?.let { buckAnimators += placeholderImageView.fadeIn() }
buckAnimators += primaryCta.fadeIn()
buckAnimators += secondaryCta.fadeIn()
options?.let {
optionsViews.forEachIndexed { index, buttonView ->
if (it.size > index) {
buttonView.fadeIn()
buckAnimators += buttonView.fadeIn()
}
}
}
Expand All @@ -1472,8 +1480,8 @@ sealed class DaxBubbleCta(
with(buckOnboardingDialogView) {
animateEntrance(
onAnimationEnd = {
daxDialogDismissButton.fadeIn()
daxBubbleDialogTitle.fadeIn()
buckAnimators += daxDialogDismissButton.fadeIn()
buckAnimators += daxBubbleDialogTitle.fadeIn()
.withEndAction {
dialogTextCta.startTypingAnimation(daxText, true) {
afterAnimation()
Expand Down Expand Up @@ -1508,17 +1516,33 @@ sealed class DaxBubbleCta(

private fun clearBubbleBuckDialog(binding: IncludeOnboardingBubbleBuckDialogBinding) {
binding.apply {
buckAnimators.forEach { it.cancel() }
buckAnimators = emptyList()
daxBubbleDialogTitle.text = ""
dialogTextCta.cancelAnimation()
dialogTextCta.text = ""
this.daxDialogDismissButton.alpha = 0f
this.primaryCta.gone()
this.primaryCta.alpha = 0f
this.secondaryCta.gone()
this.secondaryCta.alpha = 0f
this.daxDialogOption1.alpha = 0f
this.daxDialogOption1.gone()
this.daxDialogOption2.alpha = 0f
this.daxDialogOption2.gone()
this.daxDialogOption3.alpha = 0f
this.daxDialogOption3.gone()
}
}

private fun clearBubbleBBDialog(binding: IncludeOnboardingBubbleBbDialogBinding) {
binding.apply {
bbAnimators.forEach { it.cancel() }
bbAnimators = emptyList()
daxBubbleDialogTitle.cancelAnimation()
daxBubbleDialogTitle.text = ""
dialogTextCta.cancelAnimation()
dialogTextCta.text = ""
primaryCta.alpha = 0f
primaryCta.gone()
secondaryCta.alpha = 0f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class BbWelcomePage : OnboardingPageFragment(R.layout.content_onboarding_welcome
}

val titleText = getString(R.string.highlightsPreOnboardingDaxDialog1TitleBb)
binding.daxDialogCta.initial.dialogTitleInvisible.text = titleText

afterTypingAnimation = {
binding.daxDialogCta.initial.dialogTitle.finishAnimation()
Expand Down
Loading