Skip to content
Closed
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
32 changes: 32 additions & 0 deletions mobile/android/fenix/app/onboarding.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,38 @@ features:
value:
enabled: true

onboarding-haptics:
description: Feature to enable haptic feedback during onboarding.
variables:
enabled:
description: If true, the feature is enabled.
type: Boolean
default: false
defaults:
- channel: developer
value:
enabled: true
- channel: nightly
value:
enabled: true

onboarding-kit-animation:
description: >
Feature to show the animated kit illustration instead of the static one on the onboarding
terms of use page.
variables:
enabled:
description: If true, the feature is enabled.
type: Boolean
default: false
defaults:
- channel: developer
value:
enabled: true
- channel: nightly
value:
enabled: true

objects:

OnboardingCardData:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,4 @@ object FeatureFlags {
* ⚠️ DO NOT MODIFY THIS FLAG IN PRODUCTION.
*/
val onboardingFeatureEnabled = !Config.channel.isDebug

/** Enables haptic feedback during onboarding. */
val onboardingHapticsEnabled = Config.channel.isNightlyOrDebug

/** Shows the animated kit illustration instead of the static one on the onboarding terms of use page. */
val onboardingKitAnimationEnabled = Config.channel.isNightlyOrDebug
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ package org.mozilla.fenix.onboarding.view
import androidx.compose.runtime.Composable
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.nimbus.FxNimbus

/** Wraps [onClick] so that pressing an onboarding button also plays a confirmation haptic. */
@Composable
internal fun hapticOnClick(onClick: () -> Unit): () -> Unit {
if (!FeatureFlags.onboardingHapticsEnabled) return onClick
if (!FxNimbus.features.onboardingHaptics.value().enabled) return onClick
val haptic = LocalHapticFeedback.current
return {
haptic.performHapticFeedback(HapticFeedbackType.Confirm)
Expand All @@ -23,7 +23,7 @@ internal fun hapticOnClick(onClick: () -> Unit): () -> Unit {
/** Wraps a link's [onClick] so that pressing an onboarding link also plays a confirmation haptic. */
@Composable
internal fun hapticOnLinkClick(onClick: (String) -> Unit): (String) -> Unit {
if (!FeatureFlags.onboardingHapticsEnabled) return onClick
if (!FxNimbus.features.onboardingHaptics.value().enabled) return onClick
val haptic = LocalHapticFeedback.current
return { url ->
haptic.performHapticFeedback(HapticFeedbackType.Confirm)
Expand All @@ -34,7 +34,7 @@ internal fun hapticOnLinkClick(onClick: (String) -> Unit): (String) -> Unit {
/** Wraps [onCheckedChange] so that flipping an onboarding toggle also plays the matching toggle haptic. */
@Composable
internal fun hapticOnCheckedChange(onCheckedChange: (Boolean) -> Unit): (Boolean) -> Unit {
if (!FeatureFlags.onboardingHapticsEnabled) return onCheckedChange
if (!FxNimbus.features.onboardingHaptics.value().enabled) return onCheckedChange
val haptic = LocalHapticFeedback.current
return { checked ->
haptic.performHapticFeedback(if (checked) HapticFeedbackType.ToggleOn else HapticFeedbackType.ToggleOff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview
import mozilla.components.compose.base.button.TextButton
import mozilla.components.lib.state.ext.observeAsComposableState
import mozilla.components.support.base.log.logger.Logger
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.components.components
import org.mozilla.fenix.nimbus.FxNimbus
import org.mozilla.fenix.theme.FirefoxTheme

private val logger = Logger("OnboardingScreen")
Expand Down Expand Up @@ -137,7 +137,7 @@ fun OnboardingScreen(
}
}

if (FeatureFlags.onboardingHapticsEnabled) {
if (FxNimbus.features.onboardingHaptics.value().enabled) {
OnboardingPagerHaptics(pagerState)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import mozilla.components.compose.base.LinkText
import mozilla.components.compose.base.LinkTextState
import mozilla.components.compose.base.button.FilledButton
import mozilla.components.ui.animation.AnimatedIllustration
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.compose.ScrollIndicator
import org.mozilla.fenix.nimbus.FxNimbus
import org.mozilla.fenix.theme.FirefoxTheme

private val TOU_IMAGE_HEIGHT = 176.dp
Expand Down Expand Up @@ -132,7 +132,7 @@ fun TermsOfServiceOnboardingPage(

@Composable
private fun Header(pageState: OnboardingPageState) {
if (FeatureFlags.onboardingKitAnimationEnabled) {
if (FxNimbus.features.onboardingKitAnimation.value().enabled) {
AnimatedIllustration(
animationResource = R.raw.terms_of_use_hero_animation,
staticDrawableResource = R.drawable.terms_of_use_hero,
Expand Down
Loading