From d60de5e214c049853b4d997b2b0d85530c34adb8 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 6 Dec 2022 11:39:46 -0600 Subject: [PATCH] Implement terms-of-service and privacy-policy links in signup --- src/view/lib/styles.ts | 3 ++ src/view/screens/Login.tsx | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/src/view/lib/styles.ts b/src/view/lib/styles.ts index d3fc8c70..26d33f6c 100644 --- a/src/view/lib/styles.ts +++ b/src/view/lib/styles.ts @@ -68,6 +68,9 @@ export const s = StyleSheet.create({ light: {fontWeight: '300'}, fw200: {fontWeight: '200'}, + // text decoration + underline: {textDecorationLine: 'underline'}, + // font sizes f9: {fontSize: 9}, f10: {fontSize: 10}, diff --git a/src/view/screens/Login.tsx b/src/view/screens/Login.tsx index 4175e0a3..38c2c1c7 100644 --- a/src/view/screens/Login.tsx +++ b/src/view/screens/Login.tsx @@ -15,6 +15,7 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import * as EmailValidator from 'email-validator' import {observer} from 'mobx-react-lite' import {Picker} from '../com/util/Picker' +import {TextLink} from '../com/util/Link' import {s, colors} from '../lib/styles' import { makeValidHandle, @@ -370,6 +371,55 @@ const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { ) + const Policies = () => { + 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}. + + + ) + } + return ( @@ -510,6 +560,7 @@ const CreateAccount = ({onPressBack}: {onPressBack: () => void}) => { + Back @@ -567,6 +618,12 @@ export const Login = observer( }, ) +function validWebLink(url?: string): string | undefined { + return url && (url.startsWith('http://') || url.startsWith('https://')) + ? url + : undefined +} + const styles = StyleSheet.create({ outer: { flex: 1, @@ -692,6 +749,12 @@ const styles = StyleSheet.create({ pickerIcon: { color: colors.white, }, + policies: { + flexDirection: 'row', + alignItems: 'flex-start', + paddingHorizontal: 20, + paddingBottom: 20, + }, error: { borderWidth: 1, borderColor: colors.red5,