Skip to content

Commit 2b08444

Browse files
committed
clean up and remove test setup
1 parent 2fa7b93 commit 2b08444

7 files changed

Lines changed: 27 additions & 29 deletions

File tree

app/src/main/java/com/duckduckgo/app/onboarding/CustomDuckAiOnboardingFeature.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ interface CustomDuckAiOnboardingFeature {
3030
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
3131
fun self(): Toggle
3232

33-
@Toggle.DefaultValue(DefaultFeatureValue.INTERNAL)
33+
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
3434
fun introAnimation(): Toggle
3535
}

app/src/main/java/com/duckduckgo/app/onboarding/ui/OnboardingViewModel.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class OnboardingViewModel @Inject constructor(
5454
val viewState = _viewState.asStateFlow()
5555

5656
fun initializePages() {
57-
// pageLayoutManager.buildPageBlueprints()
58-
pageLayoutManager.buildBrandDesignUpdatePageBlueprints()
57+
pageLayoutManager.buildPageBlueprints()
5958
}
6059

6160
fun pageCount(): Int {
@@ -101,7 +100,6 @@ class OnboardingViewModel @Inject constructor(
101100
}
102101

103102
fun initializeOnboardingSkipper() {
104-
return
105103
if (!appBuildConfig.canSkipOnboarding) return
106104

107105
// delay showing skip button until privacy config downloaded

app/src/main/java/com/duckduckgo/app/onboarding/ui/page/BrandDesignUpdateWelcomePage.kt

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
127127
private var walkingDaxDelayedRunnable: Runnable? = null
128128
private var bottomWingDelayedRunnable: Runnable? = null
129129
private var leftWingDelayedRunnable: Runnable? = null
130-
private var duckAiIntroDelayedRunnable: Runnable? = null
131130
private var welcomeFadeInAnimatorSet: AnimatorSet? = null
132131
private var comparisonChartFadeInAnimatorSet: AnimatorSet? = null
133132
private var comparisonChartDetailAnimatorSet: AnimatorSet? = null
@@ -362,7 +361,7 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
362361
}
363362
}
364363

365-
private fun playIntroAnimation() {
364+
private fun playIntroAnimation(isDuckAiIntroAnimationEnabled: Boolean) {
366365
binding.backgroundPrimary.setMinFrame(BACKGROUND_MIN_FRAME)
367366

368367
backgroundIntroAnimatorSet = buildBackgroundIntroAnimatorSet()
@@ -379,7 +378,7 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
379378
}
380379
addAnimatorListener(object : AnimatorListenerAdapter() {
381380
override fun onAnimationEnd(animation: android.animation.Animator) {
382-
if (!viewModel.viewState.value.isDuckAiIntroAnimationEnabled) {
381+
if (!isDuckAiIntroAnimationEnabled) {
383382
viewModel.onIntroAnimationFinished()
384383
}
385384
}
@@ -389,12 +388,12 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
389388
introAnimatorSet = buildIntroAnimatorSet().apply {
390389
start()
391390
doOnEnd {
392-
if (viewModel.viewState.value.isDuckAiIntroAnimationEnabled) {
391+
if (isDuckAiIntroAnimationEnabled) {
393392
prepareDuckAiIntroAnimation()
394393
binding.duckAiIntroAnimation.isVisible = true
395394
binding.duckAiIntroAnimation.addAnimatorListener(object : AnimatorListenerAdapter() {
396395
override fun onAnimationEnd(animation: Animator) {
397-
// viewModel.onIntroAnimationFinished()
396+
viewModel.onIntroAnimationFinished()
398397
}
399398
})
400399
binding.duckAiIntroAnimation.playAnimation()
@@ -403,20 +402,20 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
403402
}
404403
}
405404

406-
private fun sizeDuckAiIntroAnimationToTextSp() {
407-
val targetTextPx = TypedValue.applyDimension(
408-
TypedValue.COMPLEX_UNIT_SP,
409-
DUCK_AI_INTRO_TEXT_SP,
410-
resources.displayMetrics,
411-
)
412-
val viewHeightPx = (targetTextPx * DUCK_AI_INTRO_CANVAS_H / DUCK_AI_INTRO_TEXT_CANVAS_UNITS).toInt()
413-
binding.duckAiIntroAnimation.updateLayoutParams {
414-
height = viewHeightPx
415-
}
416-
}
417-
418405
private fun prepareDuckAiIntroAnimation() {
419406
binding.duckAiIntroAnimation.apply {
407+
// compute the view height so that it scales correctly with font size
408+
val targetTextPx = TypedValue.applyDimension(
409+
TypedValue.COMPLEX_UNIT_SP,
410+
DUCK_AI_INTRO_TEXT_SP,
411+
resources.displayMetrics,
412+
)
413+
val viewHeightPx = (targetTextPx * DUCK_AI_INTRO_CANVAS_H / DUCK_AI_INTRO_TEXT_CANVAS_UNITS).toInt()
414+
updateLayoutParams {
415+
height = viewHeightPx
416+
}
417+
418+
// set a text delegate for 'with' word so that it can use translated values
420419
setTextDelegate(
421420
TextDelegate(this).apply {
422421
setText("with", getString(R.string.onboardingWelcomeIntroWith))
@@ -428,6 +427,8 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
428427
?: Typeface.DEFAULT
429428
}
430429
})
430+
431+
// set text color
431432
val textColor = resolveOnboardingTextPrimary(context)
432433
addValueCallback(KeyPath("**", "with Duck.ai"), LottieProperty.COLOR) { textColor }
433434
addValueCallback(KeyPath("**", "with Duck.ai 2"), LottieProperty.COLOR) { textColor }
@@ -507,8 +508,6 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
507508
) {
508509
super.onViewCreated(view, savedInstanceState)
509510

510-
sizeDuckAiIntroAnimationToTextSp()
511-
512511
ViewGroupCompat.installCompatInsetsDispatch(binding.root)
513512
if (deviceInfo.isTablet()) {
514513
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, windowInsets ->
@@ -547,7 +546,7 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
547546
.flowWithLifecycle(viewLifecycleOwner.lifecycle, Lifecycle.State.STARTED)
548547
.onEach { state ->
549548
when {
550-
!state.hasPlayedIntroAnimation -> binding.root.doOnLayout { playIntroAnimation() }
549+
!state.hasPlayedIntroAnimation -> binding.root.doOnLayout { playIntroAnimation(state.isDuckAiIntroAnimationEnabled) }
551550
state.hasPlayedIntroAnimation && state.currentDialog == null -> snapToIntroEndState()
552551
isAnimating -> { /* animation in progress — ignore re-emissions from onDialogAnimationStarted() */ }
553552
state.hasAnimatedCurrentDialog -> {
@@ -608,8 +607,6 @@ class BrandDesignUpdateWelcomePage : OnboardingPageFragment(R.layout.content_onb
608607
bottomWingDelayedRunnable = null
609608
leftWingDelayedRunnable?.let { binding.leftWingAnimation?.removeCallbacks(it) }
610609
leftWingDelayedRunnable = null
611-
duckAiIntroDelayedRunnable?.let { binding.duckAiIntroAnimation.removeCallbacks(it) }
612-
duckAiIntroDelayedRunnable = null
613610
welcomeFadeInAnimatorSet?.cancel()
614611
welcomeFadeInAnimatorSet = null
615612
comparisonChartFadeInAnimatorSet?.cancel()

app/src/main/java/com/duckduckgo/app/onboardingbranddesignupdate/OnboardingBrandDesignUpdateToggles.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ interface OnboardingBrandDesignUpdateToggles {
3434
* Main toggle for the onboarding brand design update feature.
3535
* Default value: false (disabled).
3636
*/
37-
@Toggle.DefaultValue(DefaultFeatureValue.TRUE)
37+
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
3838
fun self(): Toggle
3939

4040
/**
4141
* Toggle for the brand design update variant.
4242
* Default value: false (disabled).
4343
*/
44-
@Toggle.DefaultValue(DefaultFeatureValue.TRUE)
44+
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
4545
fun brandDesignUpdate(): Toggle
4646

4747
/**

app/src/main/res/layout-land/content_onboarding_welcome_page_update.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
style="@style/Typography.DuckDuckGo.Onboarding.WelcomeTitle"
7575
android:layout_width="0dp"
7676
android:layout_height="wrap_content"
77+
android:layout_marginHorizontal="16dp"
7778
android:alpha="0"
7879
android:gravity="center"
7980
android:text="@string/onboardingWelcomeTitle"

app/src/main/res/values/donottranslate.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,7 @@
129129
<!-- Fire animation rollout: relabel HeroFire to "Inferno Classic" when fireAnimationUpdate is on — pending translation -->
130130
<string name="settingsHeroFireAnimationClassic">Inferno Classic</string>
131131
<string name="settingsInfernoAnimation">Inferno</string>
132+
133+
<!-- Custom Duck.ai onboarding -->
134+
<string name="onboardingWelcomeIntroWith" instruction="Short connector word shown in the welcome animation, immediately before the brand name 'Duck.ai'. Example: 'with Duck.ai'.">with</string>
132135
</resources>

app/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@
508508

509509
<!-- New Onboarding Experience -->
510510
<string name="onboardingWelcomeTitle">"Welcome to DuckDuckGo!"</string>
511-
<string name="onboardingWelcomeIntroWith" instruction="Short connector word shown in the welcome animation, immediately before the brand name 'Duck.ai'. Example: 'with Duck.ai'.">with</string>
512511
<string name="onboardingDaxText"><![CDATA[The Internet can be kinda creepy.<br/><br/>Not to worry! Searching and browsing privately is easier than you think.]]></string>
513512
<string name="onboardingLetsDoItButton">Let\'s Do It!</string>
514513
<string name="daxNonSerpCtaText"><![CDATA[As you tap and scroll, I\'ll block pesky trackers. <br/><br/>Go ahead — keep browsing!]]></string>

0 commit comments

Comments
 (0)