import React from 'react' import {StyleSheet, View} from 'react-native' import { FontAwesomeIcon, FontAwesomeIconStyle, } from '@fortawesome/react-native-fontawesome' import {TextLink} from '../../util/Link' import {Text} from '../../util/text/Text' import {s, colors} from 'lib/styles' import {ServiceDescription} from 'state/models/session' import {usePalette} from 'lib/hooks/usePalette' export const Policies = ({ serviceDescription, }: { serviceDescription: ServiceDescription }) => { const pal = usePalette('default') 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( , ) } if (pp) { els.push( , ) } if (els.length === 2) { els.splice( 1, 0, {' '} and{' '} , ) } return ( By creating an account you agree to the {els}. ) } function validWebLink(url?: string): string | undefined { return url && (url.startsWith('http://') || url.startsWith('https://')) ? url : undefined } const styles = StyleSheet.create({ policies: { flexDirection: 'row', alignItems: 'flex-start', }, errorIcon: { borderWidth: 1, borderColor: colors.white, borderRadius: 30, width: 16, height: 16, alignItems: 'center', justifyContent: 'center', marginRight: 5, }, })