From 384ea52069a64c84358dccc27ea93ebc35cc305a Mon Sep 17 00:00:00 2001 From: Filipe Santos <48060475+fc-santos@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:54:20 -0500 Subject: [PATCH 1/2] fix: let user accept again terms and condition after back action from create pin screen (#1367) Signed-off-by: fc-santos --- packages/legacy/core/App/screens/Terms.tsx | 46 +- .../screens/__snapshots__/Terms.test.tsx.snap | 544 +++++++++--------- 2 files changed, 304 insertions(+), 286 deletions(-) diff --git a/packages/legacy/core/App/screens/Terms.tsx b/packages/legacy/core/App/screens/Terms.tsx index 01b665207..385bb7279 100644 --- a/packages/legacy/core/App/screens/Terms.tsx +++ b/packages/legacy/core/App/screens/Terms.tsx @@ -20,19 +20,19 @@ export const TermsVersion = true const Terms: React.FC = () => { const [store, dispatch] = useStore() - const [checked, setChecked] = useState(false) + const agreedToPreviousTerms = store.onboarding.didAgreeToTerms + const [checked, setChecked] = useState(agreedToPreviousTerms) const { t } = useTranslation() const navigation = useNavigation>() const { OnboardingTheme, TextTheme } = useTheme() const [Button] = useServices([TOKENS.COMP_BUTTON]) - const agreedToPreviousTerms = store.onboarding.didAgreeToTerms const onSubmitPressed = useCallback(() => { dispatch({ type: DispatchAction.DID_AGREE_TO_TERMS, payload: [{ DidAgreeToTerms: TermsVersion }], }) - if (!agreedToPreviousTerms) { + if (!(agreedToPreviousTerms && store.onboarding.didCreatePIN)) { navigation.navigate(Screens.CreatePIN) } else if (store.onboarding.postAuthScreens.length) { const screens: string[] = store.onboarding.postAuthScreens @@ -44,7 +44,7 @@ const Terms: React.FC = () => { dispatch({ type: DispatchAction.DID_COMPLETE_ONBOARDING, payload: [true] }) } } - }, [dispatch, agreedToPreviousTerms, navigation, store.onboarding.postAuthScreens]) + }, [dispatch, agreedToPreviousTerms, navigation, store.onboarding.postAuthScreens, store.onboarding.didCreatePIN]) const style = StyleSheet.create({ container: { ...OnboardingTheme.container, @@ -95,25 +95,27 @@ const Terms: React.FC = () => { est laborum. - {!agreedToPreviousTerms && ( - setChecked(!checked)} - /> + {!(agreedToPreviousTerms && store.authentication.didAuthenticate) && ( + + setChecked(!checked)} + /> + +