Skip to content

Commit

Permalink
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
Browse files Browse the repository at this point in the history
  • Loading branch information
MosCD3 committed Jan 6, 2025
2 parents 016a7e2 + c27864a commit ccde877
Show file tree
Hide file tree
Showing 61 changed files with 532 additions and 406 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const LoadingIndicator: React.FC = () => {
<View style={{ alignItems: 'center', justifyContent: 'center' }} testID={testIdWithKey('LoadingActivityIndicator')}>
<Image
source={Assets.img.logoPrimary.src}
style={{ width: Assets.img.logoPrimary.width, height: Assets.img.logoPrimary.height }}
style={{ width: Assets.img.logoPrimary.width, height: Assets.img.logoPrimary.height, objectFit: 'contain' }}
testID={testIdWithKey('LoadingActivityIndicatorImage')}
/>
<Animated.View style={[style.animation, { transform: [{ rotate: rotation }] }]}>
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const TorchButton: React.FC<Props> = ({ active, onPress, children }) => {
return (
<TouchableOpacity
accessible={true}
accessibilityLabel={t('Scan.Torch')}
accessibilityLabel={active? t('Scan.TorchOn'): t('Scan.TorchOff')}
accessibilityRole={'button'}
testID={testIdWithKey('ScanTorch')}
style={[styles.container, { backgroundColor: active ? theme.ColorPallet.grayscale.white : undefined }]}
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: 1 addition & 1 deletion packages/legacy/core/App/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ export const hitSlop = { top: 44, bottom: 44, left: 44, right: 44 }

export const templateBundleStorageDirectory = 'templates'

export const templateCacheDataFileName = 'proof-templates.json'
export const templateCacheDataFileName = 'index.json'

export const templateBundleIndexFileName = 'proof-templates.json'
8 changes: 2 additions & 6 deletions packages/legacy/core/App/contexts/reducers/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { generateRandomWalletName } from '../../utils/helpers'
import { PersistentStorage } from '../../services/storage'

enum StateDispatchAction {
STATE_DISPATCH = 'state/stateDispatch',
STATE_LOADED = 'state/stateLoaded',
STATE_DISPATCH = 'state/stateDispatch'
}

enum OnboardingDispatchAction {
Expand Down Expand Up @@ -110,12 +109,9 @@ export interface ReducerAction<R> {

export const reducer = <S extends State>(state: S, action: ReducerAction<DispatchAction>): S => {
switch (action.type) {
case StateDispatchAction.STATE_LOADED: {
return { ...state, stateLoaded: true }
}
case StateDispatchAction.STATE_DISPATCH: {
const newState: State = (action?.payload || []).pop()
return { ...state, ...newState }
return { ...state, ...newState, stateLoaded: true }
}
case PreferencesDispatchAction.ENABLE_DEVELOPER_MODE: {
const choice = (action?.payload ?? []).pop() ?? false
Expand Down
6 changes: 5 additions & 1 deletion 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 Expand Up @@ -531,6 +533,8 @@ const translation = {
"UnableToHandleRedirection": "Unable to handle redirection",
"Close": "Close",
"Torch": "Flash",
"TorchOn": "Flash On",
"TorchOff": "Flash Off",
"ScanHelp": "Scan Help",
"ScanNow": "Scan Now",
"WhatToScan": "What QR Codes can be scanned?",
Expand Down Expand Up @@ -835,7 +839,7 @@ const translation = {
"CredentialReceived": "received a credential",
"ProofRequestSent": "sent a proof request",
"ProofPresentationReceived": "has sent you information",
"ProofRequestReceived": "received a proof request",
"ProofRequestReceived": "has sent you a proof request",
"ProofRequestRejected": "rejected a proof request",
"ProofRequestRejectReceived": "rejected a proof request",
"ProofRequestSatisfied": "shared information",
Expand Down
6 changes: 5 additions & 1 deletion 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 Expand Up @@ -530,6 +532,8 @@ const translation = {
"UnableToHandleRedirection": "Impossible de traiter la redirection",
"Close": "Fermer",
"Torch": "Flash",
"TorchOn": "Flash activé",
"TorchOff": "Flash désactivé",
"ScanHelp": "Aide à la numérisation",
"ScanNow": "Numériser maintenant",
"ScanOnySpecial": "Seuls les codes QR spéciaux peuvent être scannés par Bifold Wallet.",
Expand Down Expand Up @@ -812,7 +816,7 @@ const translation = {
"CredentialReceived": "reçu une attestation",
"ProofRequestSent": "envoyé une demande d'attestation",
"ProofPresentationReceived": "vous a envoyé des informations",
"ProofRequestReceived": "reçu une demande d'attestation",
"ProofRequestReceived": "has sent you a proof request (FR)",
"ProofRequestRejected": "rejeté une demande d'attestation",
"ProofRequestRejectReceived": "a rejeté une demande d'attestation",
"ProofRequestSatisfied": "informations partagées",
Expand Down
6 changes: 5 additions & 1 deletion 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 Expand Up @@ -505,6 +507,8 @@ const translation = {
"UnableToHandleRedirection": "Não foi possível tratar redirecionamento",
"Close": "Fechar",
"Torch": "Flash",
"TorchOn": "Flash ligado",
"TorchOff": "Flash desligado",
"ScanHelp": "Ajuda do Scan",
"ScanNow": "Scaneie Agora",
"ScanOnySpecial": "Apenas QR codes especiais podem ser escaneados pela Bifold Wallet.",
Expand Down Expand Up @@ -787,7 +791,7 @@ const translation = {
"CredentialReceived": "recebeu uma credencial",
"ProofRequestSent": "enviou uma solicitação de prova",
"ProofPresentationReceived": "te enviou informações",
"ProofRequestReceived": "recebeu uma solicitação de prova",
"ProofRequestReceived": "has sent you a proof request (PT-BR)",
"ProofRequestRejected": "rejeitou uma solicitação de prova",
"ProofRequestRejectReceived": "rejeitou um pedido de prova",
"ProofRequestSatisfied": "informações compartilhadas",
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: 0 additions & 4 deletions packages/legacy/core/App/navigators/RootStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { DeviceEventEmitter } from 'react-native'
import IconButton, { ButtonLocation } from '../components/buttons/IconButton'
import { EventTypes } from '../constants'
import { TOKENS, useServices } from '../container-api'
import { DispatchAction } from '../contexts/reducers/store'
import { useStore } from '../contexts/store'
import { useTheme } from '../contexts/theme'
import { useDeepLinks } from '../hooks/deep-links'
Expand Down Expand Up @@ -67,9 +66,6 @@ const RootStack: React.FC = () => {

useEffect(() => {
loadState(dispatch)
.then(() => {
dispatch({ type: DispatchAction.STATE_LOADED })
})
.catch((err: unknown) => {
const error = new BifoldError(t('Error.Title1044'), t('Error.Message1044'), (err as Error).message, 1001)
DeviceEventEmitter.emit(EventTypes.ERROR_ADDED, error)
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
Loading

0 comments on commit ccde877

Please sign in to comment.