Skip to content

Commit

Permalink
Merge branch 'main' into fix/proof-chat-role
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce McMath <[email protected]>
  • Loading branch information
bryce-mcmath committed Jan 3, 2025
2 parents 25c082d + 5c0f8ec commit ebef4bf
Show file tree
Hide file tree
Showing 44 changed files with 440 additions and 331 deletions.
4 changes: 3 additions & 1 deletion packages/legacy/core/App/components/buttons/ToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
import { Pressable, Animated } from 'react-native'
import Icon from 'react-native-vector-icons/MaterialIcons'
import { useTheme } from '../../contexts/theme'
import { useTranslation } from 'react-i18next'

interface ToggleButtonProps {
isEnabled: boolean
Expand All @@ -24,6 +25,7 @@ const ToggleButton: React.FC<ToggleButtonProps> = ({
}) => {
const { ColorPallet } = useTheme()
const [toggleAnim] = useState(new Animated.Value(isEnabled ? 1 : 0))
const { t } = useTranslation()

useEffect(() => {
Animated.timing(toggleAnim, {
Expand All @@ -47,7 +49,7 @@ const ToggleButton: React.FC<ToggleButtonProps> = ({
<Pressable
accessible
testID={testID}
accessibilityLabel="Toggle Button"
accessibilityLabel={isEnabled ? t('Biometry.On') : t('Biometry.Off')}
accessibilityRole="switch"
accessibilityState={{
checked: isEnabled,
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/components/chat/ActionSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const ActionSlider: React.FC<Props> = ({ actions, onDismiss }) => {
key={action.text}
testID={testIdWithKey(action.text)}
accessibilityLabel={testIdWithKey(action.text)}
accessibilityRole="button"
style={styles.drawerRow}
onPress={action.onPress}
>
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/components/chat/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const ChatMessage: React.FC<ChatMessageProps> = ({ messageProps }) => {
{message.messageOpensCallbackType && (
<TouchableOpacity
accessibilityLabel={textForCallbackType(message.messageOpensCallbackType)}
accessibilityRole="button"
testID={testIdForCallbackType(message.messageOpensCallbackType)}
onPress={() => {
if (message.onDetails) message.onDetails()
Expand Down
2 changes: 2 additions & 0 deletions packages/legacy/core/App/components/inputs/CheckBoxRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const CheckBoxRow: React.FC<Props> = ({
<TouchableOpacity
accessible={accessible}
accessibilityLabel={accessibilityLabel}
accessibilityRole="checkbox"
accessibilityState={{ checked }}
testID={testID}
onPress={onPress}
hitSlop={hitSlop}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const ContactListItem: React.FC<ContactListItemProps> = ({ contact, navigation }
onPress={navigateToContact}
testID={testIdWithKey('Contact')}
accessibilityLabel={t('ContactDetails.AContact')}
accessibilityRole="button"
>
<View style={styles.container}>
<View style={styles.avatarContainer}>
Expand Down
6 changes: 5 additions & 1 deletion packages/legacy/core/App/components/misc/InfoBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ const InfoBox: React.FC<InfoBoxProps> = ({
{message && !showDetails && (showDetailsInfo ?? true) && (
<TouchableOpacity
accessibilityLabel={t('Global.ShowDetails')}
accessibilityRole="button"
testID={testIdWithKey('ShowDetails')}
style={{ marginVertical: 14 }}
onPress={onShowDetailsTouched}
Expand Down Expand Up @@ -263,7 +264,10 @@ const InfoBox: React.FC<InfoBoxProps> = ({
</View>
)}
{showVersionFooter ? (
<Text style={[TextTheme.caption, { flex: 1, marginTop: 8, textAlign: 'center' }]} testID={testIdWithKey('VersionNumber')}>
<Text
style={[TextTheme.caption, { flex: 1, marginTop: 8, textAlign: 'center' }]}
testID={testIdWithKey('VersionNumber')}
>
{`${t('Settings.Version')} ${getVersion()} (${getBuildNumber()})`}
</Text>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/core/App/components/misc/NewQRView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ const NewQRView: React.FC<Props> = ({ defaultToConnect, handleCodeScan, error, e
</ScrollView>
)}

<View style={styles.tabContainer}>
<View accessible={true} style={styles.tabContainer} accessibilityRole="tablist">
<ScanTab
title={t('Scan.ScanQRCode')}
iconName={'crop-free'}
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/components/misc/ScanTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const ScanTab: React.FC<ScanTabProps> = ({ onPress, active, iconName, title }) =
style={styles.container}
onPress={onPress}
accessibilityLabel={title}
accessibilityRole="tab"
testID={testIdWithKey(title)}
>
<Icon name={iconName} size={30} color={styles.text.color}></Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const VerifierCredentialCard: React.FC<VerifierCredentialCardProps> = ({
language: i18n.language,
}
bundleResolver.resolveAllBundles(params).then((bundle) => {
setOverlay(o => ({
setOverlay((o) => ({
...o,
...bundle,
brandingOverlay: bundle.brandingOverlay as BrandingOverlay,
Expand Down Expand Up @@ -185,7 +185,7 @@ const VerifierCredentialCard: React.FC<VerifierCredentialCardProps> = ({
const [showImageModal, setShowImageModal] = useState(false)

useEffect(() => {
setValue(v => formatIfDate(item.format, v))
setValue((v) => formatIfDate(item.format, v))
}, [item.format])

return (
Expand All @@ -208,6 +208,7 @@ const VerifierCredentialCard: React.FC<VerifierCredentialCardProps> = ({
{isDataUrl(value) ? (
<TouchableOpacity
accessibilityLabel={t('Record.Zoom')}
accessibilityRole="imagebutton"
testID={testIdWithKey('zoom')}
onPress={() => setShowImageModal(true)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const AppGuideModal: React.FC<AppGuideModalProps> = ({
})

return (
<Modal transparent>
<Modal transparent accessibilityViewIsModal>
<View style={styles.modalCenter}>
<View style={styles.container}>
<View style={styles.headerContainer}>
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/components/record/Record.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const Record: React.FC<RecordProps> = ({ header, footer, fields, hideFieldValues
testID={testIdWithKey('HideAll')}
accessible={true}
accessibilityLabel={t('Record.HideAll')}
accessibilityRole="button"
>
<Text style={ListItems.recordLink}>{t('Record.HideAll')}</Text>
</TouchableOpacity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const RecordBinaryField: React.FC<RecordBinaryFieldProps> = ({ attributeValue, s
accessibilityLabel={t('Record.Zoom')}
testID={testIdWithKey('zoom')}
onPress={() => setShowImageModal(true)}
accessibilityRole="imagebutton"
>
<Image style={styles.image} source={{ uri: attributeValue }} />
</TouchableOpacity>
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/components/record/RecordField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const RecordField: React.FC<RecordFieldProps> = ({
<TouchableOpacity
accessible={true}
accessibilityLabel={shown ? t('Record.Hide') : t('Record.Show')}
accessibilityRole="button"
testID={testIdWithKey('ShowHide')}
activeOpacity={1}
onPress={onToggleViewPressed}
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/core/App/components/texts/HeaderTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const HeaderTitle: React.FC<Props> = ({ children }) => {
})

return (
<Text numberOfLines={1} ellipsizeMode="tail" style={styles.title}>
<Text accessibilityRole="header" numberOfLines={1} ellipsizeMode="tail" style={styles.title}>
{children}
</Text>
)
Expand Down
6 changes: 5 additions & 1 deletion packages/legacy/core/App/components/tour/TourOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export const TourOverlay = (props: TourOverlayProps) => {
}, [windowWidth, windowHeight])

return currentStep !== undefined ? (
<View style={{ position: 'absolute', top: 0, left: 0, height: windowHeight + 1, width: windowWidth + 1 }} testID={testIdWithKey('SpotlightOverlay')}>
<View
accessibilityViewIsModal
style={{ position: 'absolute', top: 0, left: 0, height: windowHeight + 1, width: windowWidth + 1 }}
testID={testIdWithKey('SpotlightOverlay')}
>
<Svg
testID={testIdWithKey('SpotOverlay')}
height={windowHeight + 1}
Expand Down
2 changes: 2 additions & 0 deletions packages/legacy/core/App/localization/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ const translation = {
},
"Biometry": {
"Toggle": "Toggle Biometrics",
"On": "Biomtrics On",
"Off": "Biometrics Off",
"EnabledText1": "Unlock the wallet with your phone's biometrics instead of your wallet PIN.",
"EnabledText2": "Using biometrics means that all fingerprints or face ID added on this phone will have access to your wallet.",
"NotEnabledText1": "Biometrics is not currently setup on this device and therefore cannot be enabled.",
Expand Down
2 changes: 2 additions & 0 deletions packages/legacy/core/App/localization/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ const translation = {
},
"Biometry": {
"Toggle": "Basculer la biométrie",
"On": "Biométrie Activée",
"Off": "Biométrie Desactivée",
"EnabledText1": "Déverrouiller votre portefeuille avec la biométrie de votre appareil au lieu d’utiliser le NIP du portefeuille.",
"EnabledText2": "Toute personne qui a des données biométriques enregistrées sur cet appareil pourra déverrouiller votre portefeuille et avoir accès à vos attestations.",
"NotEnabledText1": "La biométrie n'est pas actuellement configurée sur cet appareil et ne peut donc pas être activée.",
Expand Down
2 changes: 2 additions & 0 deletions packages/legacy/core/App/localization/pt-br/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ const translation = {
},
"Biometry": {
"Toggle": "Habilitar Biometria",
"On": "Biometria ativada",
"Off": "Biometria desativada",
"EnabledText1": "Destravar a carteira utilizando a biometria de seu telefone ao invés do seu PIN.",
"EnabledText2": "Usar a biometria significa que todas impressões digitais ou face ID adicionadas neste telefone terão acesso à sua carteira.",
"NotEnabledText1": "Biometria não está configurada nesse dispositivo e portanto não pode ser habilitada.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ export function OpenIDCredentialRowCard({ name, issuer, bgColor, bgImage, txtCol
//
return (
<View style={style.container}>
<TouchableOpacity onPress={onPress} style={style.rowContainer}>
<TouchableOpacity
onPress={onPress}
style={style.rowContainer}
accessibilityLabel={name}
accessibilityRole="button"
>
<View style={[style.issuerBadge, bgColor ? { backgroundColor: bgColor } : {}]}>
{bgImage ? <Image style={style.imageStyle} source={{ uri: bgImage }} resizeMode="cover" /> : null}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const OpenIDCredentialCard: React.FC<CredentialCardProps> = ({
accessibilityLabel={`${display?.issuer.name ? `${t('Credentials.IssuedBy')} ${display?.issuer.name}` : ''}, ${t(
'Credentials.Credential'
)}.`}
accessibilityRole="button"
disabled={typeof onPress === 'undefined' ? true : false}
onPress={onPress}
style={[styles.container, style]}
Expand Down
4 changes: 3 additions & 1 deletion packages/legacy/core/App/screens/Language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const Language = () => {
<View style={[styles.section, styles.sectionRow]}>
<Text style={TextTheme.title}>{value}</Text>
<BouncyCheckbox
accessibilityLabel={value}
accessibilityLabel={''} // To avoid Voice Over reading the value twice (one time from the text component and another time from the BouncyCheckbox component)
accessibilityRole="radio"
accessibilityState={{ checked: id === i18n.language }}
disableText
fillColor={ColorPallet.brand.secondaryBackground}
unfillColor={ColorPallet.brand.secondaryBackground}
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/screens/ListProofRequests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const ProofRequestsCard: React.FC<ProofRequestsCardProps> = ({ navigation, templ
style={style.card}
onPress={() => navigation.navigate(Screens.ProofRequestDetails, { templateId: template.id, connectionId })}
accessibilityLabel={t('Screens.ProofRequestDetails')}
accessibilityRole="button"
testID={testIdWithKey('ProofRequestsCard')}
>
<View style={style.textContainer}>
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/screens/ProofChangeCredential.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const ProofChangeCredential: React.FC<ProofChangeProps> = ({ route, navigation }
return (
<View style={styles.pageMargin}>
<TouchableOpacity
accessibilityRole="button"
testID={testIdWithKey(`select:${item.credId}`)}
onPress={() => changeCred(item.credId ?? '')}
style={[item.credId === selectedCred ? styles.selectedCred : undefined, { marginBottom: 10 }]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const ProofRequestUsageHistoryRecord: React.FC<ProofRequestUsageHistoryRecordPro
onPress={onDetails}
disabled={!presentationReceived}
accessibilityLabel={t('Screens.ProofDetails')}
accessibilityRole="button"
testID={testIdWithKey('ProofDetails')}
>
<View style={style.leftContainer}>
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/screens/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ const Settings: React.FC<SettingsProps> = ({ navigation }) => {
<TouchableOpacity
accessible={true}
accessibilityLabel={accessibilityLabel}
accessibilityRole="button"
testID={testID}
style={styles.sectionRow}
onPress={onPress}
Expand Down
46 changes: 24 additions & 22 deletions packages/legacy/core/App/screens/Terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ export const TermsVersion = true

const Terms: React.FC = () => {
const [store, dispatch] = useStore()
const [checked, setChecked] = useState(false)
const agreedToPreviousTerms = store.onboarding.didAgreeToTerms
const [checked, setChecked] = useState(agreedToPreviousTerms)
const { t } = useTranslation()
const navigation = useNavigation<StackNavigationProp<AuthenticateStackParams>>()
const { OnboardingTheme, TextTheme } = useTheme()
const [Button] = useServices([TOKENS.COMP_BUTTON])
const agreedToPreviousTerms = store.onboarding.didAgreeToTerms
const onSubmitPressed = useCallback(() => {
dispatch({
type: DispatchAction.DID_AGREE_TO_TERMS,
payload: [{ DidAgreeToTerms: TermsVersion }],
})

if (!agreedToPreviousTerms) {
if (!(agreedToPreviousTerms && store.onboarding.didCreatePIN)) {
navigation.navigate(Screens.CreatePIN)
} else if (store.onboarding.postAuthScreens.length) {
const screens: string[] = store.onboarding.postAuthScreens
Expand All @@ -44,7 +44,7 @@ const Terms: React.FC = () => {
dispatch({ type: DispatchAction.DID_COMPLETE_ONBOARDING, payload: [true] })
}
}
}, [dispatch, agreedToPreviousTerms, navigation, store.onboarding.postAuthScreens])
}, [dispatch, agreedToPreviousTerms, navigation, store.onboarding.postAuthScreens, store.onboarding.didCreatePIN])
const style = StyleSheet.create({
container: {
...OnboardingTheme.container,
Expand Down Expand Up @@ -95,25 +95,27 @@ const Terms: React.FC = () => {
est laborum.
</Text>
<View style={style.controlsContainer}>
{!agreedToPreviousTerms && (
<CheckBoxRow
title={t('Terms.Attestation')}
accessibilityLabel={t('Terms.IAgree')}
testID={testIdWithKey('IAgree')}
checked={checked}
onPress={() => setChecked(!checked)}
/>
{!(agreedToPreviousTerms && store.authentication.didAuthenticate) && (
<View style={{ marginBottom: agreedToPreviousTerms ? 20 : 0 }}>
<CheckBoxRow
title={t('Terms.Attestation')}
accessibilityLabel={t('Terms.IAgree')}
testID={testIdWithKey('IAgree')}
checked={!!checked}
onPress={() => setChecked(!checked)}
/>
<View style={{ paddingTop: 10 }}>
<Button
title={agreedToPreviousTerms ? t('Global.Accept') : t('Global.Continue')}
accessibilityLabel={agreedToPreviousTerms ? t('Global.Accept') : t('Global.Continue')}
testID={agreedToPreviousTerms ? testIdWithKey('Accept') : testIdWithKey('Continue')}
disabled={!checked}
onPress={onSubmitPressed}
buttonType={ButtonType.Primary}
/>
</View>
</View>
)}
<View style={{ paddingTop: 10 }}>
<Button
title={agreedToPreviousTerms ? t('Global.Accept') : t('Global.Continue')}
accessibilityLabel={agreedToPreviousTerms ? t('Global.Accept') : t('Global.Continue')}
testID={agreedToPreviousTerms ? testIdWithKey('Accept') : testIdWithKey('Continue')}
disabled={!checked && !agreedToPreviousTerms}
onPress={onSubmitPressed}
buttonType={ButtonType.Primary}
/>
</View>
{!agreedToPreviousTerms && (
<View style={{ paddingTop: 10, marginBottom: 20 }}>
<Button
Expand Down
9 changes: 5 additions & 4 deletions packages/legacy/core/App/screens/UseBiometry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const UseBiometry: React.FC = () => {
minHeight: 200,
marginBottom: 66,
},
biometryAvailableRowGap: {
rowGap: 20,
},
})

useEffect(() => {
Expand Down Expand Up @@ -281,18 +284,16 @@ const UseBiometry: React.FC = () => {
<Assets.svg.biometrics style={styles.image} />
</View>
{biometryAvailable ? (
<View>
<View style={styles.biometryAvailableRowGap}>
<Text style={TextTheme.normal}>{t('Biometry.EnabledText1')}</Text>
<Text></Text>
<Text style={TextTheme.normal}>
{t('Biometry.EnabledText2')}
<Text style={TextTheme.bold}> {t('Biometry.Warning')}</Text>
</Text>
</View>
) : (
<View>
<View style={styles.biometryAvailableRowGap}>
<Text style={TextTheme.normal}>{t('Biometry.NotEnabledText1')}</Text>
<Text></Text>
<Text style={TextTheme.normal}>{t('Biometry.NotEnabledText2')}</Text>
</View>
)}
Expand Down
Loading

0 comments on commit ebef4bf

Please sign in to comment.