import React from 'react' import {View} from 'react-native' import {ComAtprotoServerDescribeServer} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {atoms as a, useTheme} from '#/alf' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' export const Policies = ({ serviceDescription, needsGuardian, under13, }: { serviceDescription: ComAtprotoServerDescribeServer.OutputSchema needsGuardian: boolean under13: boolean }) => { const t = useTheme() const {_} = useLingui() if (!serviceDescription) { return } const tos = validWebLink(serviceDescription.links?.termsOfService) const pp = validWebLink(serviceDescription.links?.privacyPolicy) if (!tos && !pp) { return ( This service has not provided terms of service or a privacy policy. ) } const els = [] if (tos) { els.push( {_(msg`Terms of Service`)} , ) } if (pp) { els.push( {_(msg`Privacy Policy`)} , ) } if (els.length === 2) { els.splice( 1, 0, {' '} and{' '} , ) } return ( By creating an account you agree to the {els}. {under13 ? ( You must be 13 years of age or older to sign up. ) : needsGuardian ? ( 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} ) } function validWebLink(url?: string): string | undefined { return url && (url.startsWith('http://') || url.startsWith('https://')) ? url : undefined }