--- a/src/screens/Signup/StepInfo/index.tsx +++ b/src/screens/Signup/StepInfo/index.tsx @@ -9,44 +9,17 @@ import {logger} from '#/logger' import {isNative} from '#/platform/detection' import {useSignupContext} from '#/screens/Signup/state' -import {Policies} from '#/screens/Signup/StepInfo/Policies' import {atoms as a, native} from '#/alf' -import * as Admonition from '#/components/Admonition' -import * as Dialog from '#/components/Dialog' -import {DeviceLocationRequestDialog} from '#/components/dialogs/DeviceLocationRequestDialog' -import * as DateField from '#/components/forms/DateField' -import {type DateFieldRef} from '#/components/forms/DateField/types' import {FormError} from '#/components/forms/FormError' import {HostingProvider} from '#/components/forms/HostingProvider' import * as TextField from '#/components/forms/TextField' import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/Envelope' import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock' import {Ticket_Stroke2_Corner0_Rounded as Ticket} from '#/components/icons/Ticket' -import {createStaticClick, SimpleInlineLinkText} from '#/components/Link' import {Loader} from '#/components/Loader' import {usePreemptivelyCompleteActivePolicyUpdate} from '#/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate' -import * as Toast from '#/components/Toast' -import { - isUnderAge, - MIN_ACCESS_AGE, - useAgeAssuranceRegionConfigWithFallback, -} from '#/ageAssurance/util' -import { - useDeviceGeolocationApi, - useIsDeviceGeolocationGranted, -} from '#/geolocation' import {BackNextButtons} from '../BackNextButtons' -function sanitizeDate(date: Date): Date { - if (!date || date.toString() === 'Invalid Date') { - logger.error(`Create account: handled invalid date for birthDate`, { - hasDate: !!date, - }) - return new Date() - } - return date -} - export function StepInfo({ onPressBack, isServerError, @@ -70,21 +43,6 @@ const emailInputRef = useRef(null) const passwordInputRef = useRef(null) - const birthdateInputRef = useRef(null) - - const aaRegionConfig = useAgeAssuranceRegionConfigWithFallback() - const {setDeviceGeolocation} = useDeviceGeolocationApi() - const locationControl = Dialog.useDialogControl() - const isOverRegionMinAccessAge = state.dateOfBirth - ? !isUnderAge(state.dateOfBirth.toISOString(), aaRegionConfig.minAccessAge) - : true - const isOverAppMinAccessAge = state.dateOfBirth - ? !isUnderAge(state.dateOfBirth.toISOString(), MIN_ACCESS_AGE) - : true - const isOverMinAdultAge = state.dateOfBirth - ? !isUnderAge(state.dateOfBirth.toISOString(), 18) - : true - const isDeviceGeolocationGranted = useIsDeviceGeolocationGranted() const [hasWarnedEmail, setHasWarnedEmail] = React.useState(false) @@ -105,10 +63,6 @@ const emailChanged = prevEmailValueRef.current !== email const password = passwordValueRef.current - if (!isOverRegionMinAccessAge) { - return - } - if (state.serviceDescription?.inviteCodeRequired && !inviteCode) { return dispatch({ type: 'setError', @@ -275,107 +229,16 @@ secureTextEntry autoComplete="new-password" autoCapitalize="none" - returnKeyType="next" - submitBehavior={native('blurAndSubmit')} - onSubmitEditing={native(() => - birthdateInputRef.current?.focus(), - )} + returnKeyType="done" passwordRules="minlength: 8;" /> - - - Your birth date - - { - dispatch({ - type: 'setDateOfBirth', - value: sanitizeDate(new Date(date)), - }) - }} - label={_(msg`Date of birth`)} - accessibilityHint={_(msg`Select your date of birth`)} - maximumDate={new Date()} - /> - - - - - - {!isOverRegionMinAccessAge || !isOverAppMinAccessAge ? ( - - - - - - {!isOverAppMinAccessAge ? ( - - You must be {MIN_ACCESS_AGE} years of age or older - to create an account. - - ) : ( - - You must be {aaRegionConfig.minAccessAge} years of - age or older to create an account in your region. - - )} - - {isNative && - !isDeviceGeolocationGranted && - isOverAppMinAccessAge && ( - - - Have we got your location wrong?{' '} - { - locationControl.open() - })}> - Tap here to confirm your location with GPS. - - - - )} - - - - ) : !isOverMinAdultAge ? ( - - - If you are not yet an adult according to the laws of your - country, your parent or legal guardian must read these Terms - on your behalf. - - - ) : undefined} - - - {isNative && ( - { - props.closeDialog(() => { - // set this after close! - setDeviceGeolocation(props.geolocation) - Toast.show(_(msg`Your location has been updated.`), { - type: 'success', - }) - }) - }} - /> - )} ) : undefined}