diff --git a/src/components/common/buttons/ClaimButton.jsx b/src/components/common/buttons/ClaimButton.jsx index f4e46e210a..25413bdc53 100644 --- a/src/components/common/buttons/ClaimButton.jsx +++ b/src/components/common/buttons/ClaimButton.jsx @@ -1,9 +1,11 @@ // @flow -import React from 'react' +import React, { useContext } from 'react' import { Animated, Platform, View } from 'react-native' import { noop } from 'lodash' - import { t } from '@lingui/macro' + +import { useFlagWithPayload } from '../../../lib/hooks/useFeatureFlags' +import { GoodWalletContext } from '../../../lib/wallet/GoodWalletProvider' import { PushButton } from '../../appNavigation/PushButton' import { withStyles } from '../../../lib/styles' import Config from '../../../config/config' @@ -51,6 +53,10 @@ const ClaimButton = withStyles(getStylesFromProps)(({ const isPending = false const canContinue = () => true + const { goodWallet } = useContext(GoodWalletContext) + const payload = useFlagWithPayload('uat-goodid-flow') + const { whitelist } = payload + // if there's no status the first time then get it // otherwise just return true. // in case we already have status then button is disabled if pending so its ok to return true here. @@ -62,7 +68,7 @@ const ClaimButton = withStyles(getStylesFromProps)(({ { const advanceClaimsCounter = useClaimCounter() const [, , collectInviteBounty] = useInviteBonus() - const payload = useFlagWithPayload('next-tasks') + const nextTasks = useFlagWithPayload('next-tasks') + const uat = useFlagWithPayload('uat-goodid-flow') - const { tasks } = payload + const { tasks } = nextTasks + const { whitelist } = uat || {} // format number of people who did claim today const formattedNumberOfPeopleClaimedToday = useMemo(() => formatWithSIPrefix(peopleClaimed), [peopleClaimed]) @@ -310,7 +312,8 @@ const Claim = props => { ) const handleFaceVerification = useCallback(() => { - const nextStep = Config.env !== 'development' ? 'FaceVerificationIntro' : 'GoodIdOnboard' + const nextStep = + Config.env === 'development' || whitelist.includes(goodWallet.account) ? 'GoodIdOnboard' : 'FaceVerificationIntro' navigate(nextStep, { from: 'Claim' }) }, [navigate]) diff --git a/src/components/faceVerification/screens/VerificationScreen.jsx b/src/components/faceVerification/screens/VerificationScreen.jsx index 4c3acd10f7..cba6882264 100644 --- a/src/components/faceVerification/screens/VerificationScreen.jsx +++ b/src/components/faceVerification/screens/VerificationScreen.jsx @@ -1,6 +1,8 @@ import React, { useCallback, useContext, useMemo } from 'react' import { identity } from 'lodash' + +import { useFlagWithPayload } from '../../../lib/hooks/useFeatureFlags' import Instructions from '../components/Instructions' import Config from '../../../config/config' @@ -35,6 +37,9 @@ const FaceVerification = ({ screenProps, navigation }) => { const goodWallet = useWallet() const userStorage = useUserStorage() const { isFVFlow } = useContext(FVFlowContext) + const payload = useFlagWithPayload('uat-goodid-flow') + const { whitelist } = payload ?? {} + const { faceIdentifier: enrollmentIdentifier, chainId, v1FaceIdentifier: fvSigner } = useEnrollmentIdentifier() // Redirects to the error screen, passing exception @@ -142,7 +147,8 @@ const FaceVerification = ({ screenProps, navigation }) => { userStorage.userProperties.set('fv2', true) } - const nextStep = Config.env !== 'development' ? 'Claim' : 'GoodIdOnboard' + const nextStep = + Config.env === 'development' || whitelist.includes(goodWallet.account) ? 'GoodIdOnboard' : 'Claim' //go to goodid to complete certificates screenProps.navigateTo(nextStep, { isValid: true }) diff --git a/src/components/goodid/GoodIdOnboard.jsx b/src/components/goodid/GoodIdOnboard.jsx index 130ca8985d..fdf9c85142 100644 --- a/src/components/goodid/GoodIdOnboard.jsx +++ b/src/components/goodid/GoodIdOnboard.jsx @@ -1,6 +1,8 @@ import React, { useCallback, useContext } from 'react' import { View } from 'react-native' import { GoodIdProvider, OnboardController } from '@gooddollar/good-design' + +import { useFlagWithPayload } from '../../lib/hooks/useFeatureFlags' import { GoodWalletContext } from '../../lib/wallet/GoodWalletProvider' import { withStyles } from '../../lib/styles' import Config from '../../config/config' @@ -9,6 +11,8 @@ const GoodIdOnboardImpl = ({ screenProps, styles }) => { // isValid is result from FV const { navigateTo, isValid } = screenProps const { goodWallet } = useContext(GoodWalletContext) + const payload = useFlagWithPayload('uat-goodid-flow') + const { whitelist } = payload ?? {} const navigateToFV = useCallback(() => { navigateTo('FaceVerificationIntro') @@ -33,7 +37,7 @@ const GoodIdOnboardImpl = ({ screenProps, styles }) => { onSkip={onSkip} onDone={onSkip} onExit={onExit} - isDev={Config.env !== 'production'} + isDev={Config.env === 'development' || whitelist.includes(goodWallet.account)} isWallet={true} />