From 76ab831843015c61ec24833964c25c4e0494dd10 Mon Sep 17 00:00:00 2001 From: Taha Cherfia <taha.cherfia@holi.team> Date: Fri, 28 Mar 2025 15:54:22 +0100 Subject: [PATCH] HOLI-11303: add challenges carousel feature flag --- core/featureFlags/constants.ts | 1 + core/featureFlags/featureFlagBootstrapValues.ts | 2 ++ core/screens/homeFeed/Feed.tsx | 7 +++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/featureFlags/constants.ts b/core/featureFlags/constants.ts index 08246dcd96..1f6cd4270d 100644 --- a/core/featureFlags/constants.ts +++ b/core/featureFlags/constants.ts @@ -13,4 +13,5 @@ export enum FeatureFlagKey { NEW_HOME_FEED = 'NEW_HOME_FEED', // multivariate ('control', 'test') -> FeatureFlagAB TASK_CONTACT_CTA = 'TASK_CONTACT_CTA', // boolean EVENTS = 'EVENTS', // boolean + CHALLENGES_CAROUSEL = 'CHALLENGES_CAROUSEL', // boolean } diff --git a/core/featureFlags/featureFlagBootstrapValues.ts b/core/featureFlags/featureFlagBootstrapValues.ts index 9605aa48a3..f3721c229c 100644 --- a/core/featureFlags/featureFlagBootstrapValues.ts +++ b/core/featureFlags/featureFlagBootstrapValues.ts @@ -29,6 +29,7 @@ export const featureFlagBootstrapValues: FeatureFlagsAndPayloads = { [FeatureFlagKey.POST_TRANSLATION]: false, [FeatureFlagKey.TASK_CONTACT_CTA]: false, [FeatureFlagKey.EVENTS]: false, + [FeatureFlagKey.CHALLENGES_CAROUSEL]: false, }, featureFlagPayloads: { [FeatureFlagKey.DONATIONS]: null, @@ -45,6 +46,7 @@ export const featureFlagBootstrapValues: FeatureFlagsAndPayloads = { [FeatureFlagKey.POST_TRANSLATION]: null, [FeatureFlagKey.TASK_CONTACT_CTA]: null, [FeatureFlagKey.EVENTS]: null, + [FeatureFlagKey.CHALLENGES_CAROUSEL]: null, }, } diff --git a/core/screens/homeFeed/Feed.tsx b/core/screens/homeFeed/Feed.tsx index 3c207b4b56..6d7f160de0 100644 --- a/core/screens/homeFeed/Feed.tsx +++ b/core/screens/homeFeed/Feed.tsx @@ -36,6 +36,7 @@ import { useScrollToTop } from '@react-navigation/native' import useTracking from '@holi/core/tracking/hooks/useTracking' import { useFeedStats } from '@holi/core/screens/homeFeed/helpers/useFeedStats' import ChallengesCarousel from '@holi-apps/challenges/components/feed/ChallengesCarousel' +import { useFeatureFlag } from '@holi/core/featureFlags/hooks/useFeatureFlag' const surveyUrl = 'https://tally.so/r/nrdGxX' const HomeFeed = () => { @@ -49,6 +50,8 @@ const HomeFeed = () => { setLastViewedIndex((prev) => Math.max(prev, index)) }, []) const displayFeedbackLink = useFeatureFlagWithMaintenance(FeatureFlagKey.FEEDBACK_LINK).isOn + const displayChallengesCarousel = useFeatureFlag(FeatureFlagKey.CHALLENGES_CAROUSEL) + const { initialLoading, canLoadMore, combinedFeedData, fetchMore, refetch, refreshing, insightsCreators } = useFeedQuery() @@ -118,11 +121,11 @@ const HomeFeed = () => { <HoliTransition.FadeDown visible> <View style={styles.listHeader}> <HomeFeedHeader /> - <ChallengesCarousel /> + {displayChallengesCarousel[0] && <ChallengesCarousel />} </View> </HoliTransition.FadeDown> ), - [] + [displayChallengesCarousel] ) const listItemTrackingEvent: ListItemTrackingEvent<FeedItem> = (item) => { -- GitLab