Skip to content

Commit

Permalink
Onboarding: Prevent taps in suggestions until text animation has fini…
Browse files Browse the repository at this point in the history
…shed (#4668)

Task/Issue URL:
https://app.asana.com/0/488551667048375/1207610505138605/f

### Description
Prevent early taps on DaxBubble to avoid firing events too quickly.

### Steps to test this PR

_Feature 1_
- [x] Fresh install, start onboarding
- [x] When you see the “Try a search / Try a site: CTAs try to tap on
the box, so a link is tapped
- [x] Verify that links are only tappable when the whole CTA is visible
  • Loading branch information
malmstein authored Jun 20, 2024
1 parent 022fa56 commit b1a07b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3842,10 +3842,11 @@ class BrowserTabFragment :
private fun showDaxOnboardingBubbleCta(configuration: DaxBubbleCta) {
hideHomeBackground()
configuration.apply {
showCta(daxDialogIntroBubbleCta.daxCtaContainer)
setOnOptionClicked {
userEnteredQuery(it.link)
pixel.fire(it.pixel)
showCta(daxDialogIntroBubbleCta.daxCtaContainer) {
setOnOptionClicked {
userEnteredQuery(it.link)
pixel.fire(it.pixel)
}
}
}
newBrowserTab.newTabLayout.setOnClickListener { daxDialogIntroBubbleCta.dialogTextCta.finishAnimation() }
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import com.duckduckgo.common.utils.baseHost
import com.duckduckgo.common.utils.extensions.html

interface ViewCta {
fun showCta(view: View)
fun showCta(view: View, onTypingAnimationFinished: () -> Unit)
}

interface DaxCta {
Expand Down Expand Up @@ -449,7 +449,7 @@ sealed class DaxBubbleCta(

private var ctaView: View? = null

override fun showCta(view: View) {
override fun showCta(view: View, onTypingAnimationFinished: () -> Unit) {
ctaView = view
val daxTitle = view.context.getString(title)
val daxText = view.context.getString(description)
Expand Down Expand Up @@ -484,7 +484,9 @@ sealed class DaxBubbleCta(
.withEndAction {
ViewCompat.animate(view.findViewById<DaxTextView>(R.id.daxBubbleDialogTitle)).alpha(1f).setDuration(500)
.withEndAction {
view.findViewById<TypeAnimationTextView>(R.id.dialogTextCta).startTypingAnimation(daxText, true)
view.findViewById<TypeAnimationTextView>(R.id.dialogTextCta).startTypingAnimation(daxText, true) {
onTypingAnimationFinished()
}
}
}
}
Expand Down Expand Up @@ -579,7 +581,7 @@ sealed class HomePanelCta(
override val cancelPixel: Pixel.PixelName?,
) : Cta, ViewCta {

override fun showCta(view: View) {
override fun showCta(view: View, onTypingAnimationFinished: () -> Unit) {
// no-op. We are now using a Bottom Sheet to display this
// but we want to keep the same classes for pixels, etc
}
Expand Down

0 comments on commit b1a07b2

Please sign in to comment.