Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addresses accessibility issues for privacy policy #78

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locale/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"NoConnectivity": "No internet connection",
"NoConnectivityDetailed": "COVID Shield needs internet access to continue checking for potential exposure.",
"AppName": "COVID Shield",
"ExternalLinkHint": "Opens in a new window",
"LastCheckedMinutes": {
"One": "Last checked {number} minute ago",
"Other": "Last checked {number} minutes ago"
Expand Down
1 change: 1 addition & 0 deletions src/locale/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"NoConnectivity": "Aucune connexion Internet",
"NoConnectivityDetailed": "COVID Shield a besoin d'un accès Internet pour continuer de vérifier les expositions potentielles à la COVID-19.",
"AppName": "COVID Shield",
"ExternalLinkHint": "Ouvre dans une nouvelle fenêtre",
"LastCheckedMinutes": {
"One": "Dernière vérification il y a {number} minute",
"Other": "Dernière vérification il y a {number} minutes"
Expand Down
2 changes: 1 addition & 1 deletion src/locale/translations/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/locale/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"NoConnectivity": "Sem conexão à internet",
"NoConnectivityDetailed": "O COVID Shield precisa de acesso à Internet para continuar verificando à potenciais exposições.",
"AppName": "COVID Shield",
"ExternalLinkHint": "Abre em uma nova janela",
"LastCheckedMinutes": {
"One": "Última verificação há {number} minuto",
"Other": "Última verificação há {number} minutos"
Expand Down
33 changes: 31 additions & 2 deletions src/screens/privacy/Privacy.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {useCallback} from 'react';
import {ScrollView, StyleSheet} from 'react-native';
import {Linking, ScrollView, StyleSheet, Text, TouchableWithoutFeedback} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import {Box, Toolbar} from 'components';
import {SafeAreaView} from 'react-native-safe-area-context';
import {useI18n} from '@shopify/react-i18n';
import Markdown from 'react-native-markdown-display';
import Markdown, {RenderRules, RenderFunction} from 'react-native-markdown-display';
import privacyPolicyEn from 'assets/privacypolicy';
import privacyPolicyFr from 'assets/privacypolicy-fr';

Expand All @@ -13,6 +13,34 @@ export const PrivacyScreen = () => {
const [i18n] = useI18n();
const close = useCallback(() => navigation.goBack(), [navigation]);

const openUrl = (url: string) => {
Linking.openURL(url);
};

const renderHeader: RenderFunction = (node, children, styles: any) => (
<Text key={node.key} style={[styles.heading, styles.heading1]} accessibilityRole="header">
{children}
</Text>
);

const renderLink: RenderFunction = (node: any, children: React.ReactNode[], styles: any) => (
<TouchableWithoutFeedback
key={node.key}
style={styles.link}
onPress={() => openUrl(node.attributes.href)}
accessibilityLabel={children.toString()}
accessibilityHint={i18n.translate('Home.ExternalLinkHint')}
accessibilityRole="link"
>
<Text style={styles.link}>{children}</Text>
</TouchableWithoutFeedback>
);

const rules: RenderRules = {
link: renderLink,
heading1: renderHeader,
};

return (
<Box backgroundColor="overlayBackground" flex={1}>
<SafeAreaView style={styles.flex}>
Expand All @@ -29,6 +57,7 @@ export const PrivacyScreen = () => {
style={{
body: styles.bodyContent,
}}
rules={rules}
>
{i18n.locale === 'en' ? privacyPolicyEn : privacyPolicyFr}
</Markdown>
Expand Down