Skip to content

Commit

Permalink
feat: add helper text for changes in app settings (#1393)
Browse files Browse the repository at this point in the history
Signed-off-by: fc-santos <[email protected]>
fc-santos authored Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 002be5b commit 883c08a
Showing 6 changed files with 58 additions and 13 deletions.
6 changes: 5 additions & 1 deletion packages/legacy/core/App/localization/en/index.ts
Original file line number Diff line number Diff line change
@@ -269,7 +269,11 @@ const translation = {
"ReEnterPIN": "Re-enter your wallet PIN",
"BiometricsChanged": "Biometrics unlock has been disabled because your device biometrics changed.",
"BiometricsChangedEnterPIN": "Please enter your wallet PIN.",
"AttemptLockoutWarning": "Note: for your security, entering another incorrect PIN will temporarily lock the wallet."
"AttemptLockoutWarning": "Note: for your security, entering another incorrect PIN will temporarily lock the wallet.",
"AppSettingChanged": "The application setting has changed.",
"AppSettingChangedEnterPIN": "Please confirm your change by entering your wallet PIN.",
"AppSettingSave": "Save",
"AppSettingCancel": "Cancel",
},
"AttemptLockout": {
"Title": "Your wallet is temporarily locked",
7 changes: 6 additions & 1 deletion packages/legacy/core/App/localization/fr/index.ts
Original file line number Diff line number Diff line change
@@ -268,7 +268,12 @@ const translation = {
"ReEnterPIN": "Re-enter your wallet PIN (FR)",
"BiometricsChanged": "Le déverrouillage avec la biométrie a été désactivé, car les données biométriques de votre appareil ont changé.",
"BiometricsChangedEnterPIN": "Veuillez saisir le code NIP de votre portefeuille.",
"AttemptLockoutWarning": "Note: pour votre sécurité, la saisie d'un autre NIP incorrect verrouillera temporairement le portefeuille."
"AttemptLockoutWarning": "Note: pour votre sécurité, la saisie d'un autre NIP incorrect verrouillera temporairement le portefeuille.",
"AppSettingChanged": "Le paramètre de l'application a changé.",
"AppSettingsChangedEnterPIN": "Veuillez confirmer la modification en saisissant votre NIP.",
"AppSettingSave": "Enregistrer",
"AppSettingCancel": "Annuler",

},
"AttemptLockout": {
"Title": "Votre portefeuille est temporairement verrouillé",
8 changes: 6 additions & 2 deletions packages/legacy/core/App/localization/pt-br/index.ts
Original file line number Diff line number Diff line change
@@ -253,8 +253,12 @@ const translation = {
"ReEnterPIN": "Re-enter your wallet PIN (PT-BR)",
"EnableBiometrics": "Você deve habilitar a biometria para poder carregar a carteira.",
"BiometricsNotProvided": "Biometria não informada, você deve usar o PIN para carregar a carteira.",
"BiometricsError": "Biometrics were not successful.",
"BiometricsErrorEnterPIN": "Please enter your wallet PIN."
"BiometricsError": "A biometria não obteve sucesso.",
"BiometricsErrorEnterPIN": "Por favor, digite o PIN de sua carteira.",
"AppSettingsChanged": "A configuração do aplicativo foi alterada.",
"AppSettingsChangedEnterPIN": "Por favor, confirme sua alteração digitando o seu PIN.",
"AppSettingSave": "Salvar",
"AppSettingCancel": "Cancelar",
},
"Biometry": {
"Toggle": "Habilitar Biometria",
40 changes: 32 additions & 8 deletions packages/legacy/core/App/screens/PINEnter.tsx
Original file line number Diff line number Diff line change
@@ -30,14 +30,15 @@ import { InlineErrorType, InlineMessageProps } from '../components/inputs/Inline
interface PINEnterProps {
setAuthenticated: (status: boolean) => void
usage?: PINEntryUsage
onCancelAuth?: React.Dispatch<React.SetStateAction<boolean>>
}

export enum PINEntryUsage {
PINCheck,
WalletUnlock,
}

const PINEnter: React.FC<PINEnterProps> = ({ setAuthenticated, usage = PINEntryUsage.WalletUnlock }) => {
const PINEnter: React.FC<PINEnterProps> = ({ setAuthenticated, usage = PINEntryUsage.WalletUnlock, onCancelAuth }) => {
const { t } = useTranslation()
const { checkPIN, getWalletCredentials, isBiometricsActive, disableBiometrics } = useAuth()
const [store, dispatch] = useStore()
@@ -456,6 +457,10 @@ const PINEnter: React.FC<PINEnterProps> = ({ setAuthenticated, usage = PINEntryU
)
}

if (usage === PINEntryUsage.PINCheck) {
return <Text style={style.helpText}>{t('PINEnter.AppSettingChanged')}</Text>
}

return (
<>
<Text style={style.title}>{t('PINEnter.Title')}</Text>
@@ -471,6 +476,7 @@ const PINEnter: React.FC<PINEnterProps> = ({ setAuthenticated, usage = PINEntryU
style.subTitle,
style.title,
store.preferences.autoLockTime,
usage,
])

return (
@@ -484,28 +490,34 @@ const PINEnter: React.FC<PINEnterProps> = ({ setAuthenticated, usage = PINEntryU
) : (
displayHelpText()
)}
<Text style={style.subText}>{t('PINEnter.EnterPIN')}</Text>
<Text style={style.subText}>{`${
usage === PINEntryUsage.PINCheck ? t('PINEnter.AppSettingChangedEnterPIN') : t('PINEnter.EnterPIN')
}`}</Text>
<PINInput
onPINChanged={(p: string) => {
setPIN(p)
if (p.length === minPINLength) {
Keyboard.dismiss()
}
}}
testID={testIdWithKey('EnterPIN')}
accessibilityLabel={t('PINEnter.EnterPIN')}
testID={testIdWithKey(usage === PINEntryUsage.PINCheck ? 'AppSettingChangedEnterPIN' : 'EnterPIN')}
accessibilityLabel={
usage === PINEntryUsage.PINCheck ? t('PINEnter.AppSettingChangedEnterPIN') : t('PINEnter.EnterPIN')
}
autoFocus={true}
inlineMessage={inlineMessageField}
/>
</View>
<View style={style.controlsContainer}>
<View style={style.buttonContainer}>
<Button
title={t('PINEnter.Unlock')}
title={usage === PINEntryUsage.PINCheck ? t('PINEnter.AppSettingSave') : t('PINEnter.Unlock')}
buttonType={ButtonType.Primary}
testID={testIdWithKey('Enter')}
testID={testIdWithKey(usage === PINEntryUsage.PINCheck ? 'AppSettingSave' : 'Enter')}
disabled={isContinueDisabled()}
accessibilityLabel={t('PINEnter.Unlock')}
accessibilityLabel={
usage === PINEntryUsage.PINCheck ? t('PINEnter.AppSettingSave') : t('PINEnter.Unlock')
}
onPress={() => {
Keyboard.dismiss()
onPINInputCompleted(PIN)
@@ -522,14 +534,26 @@ const PINEnter: React.FC<PINEnterProps> = ({ setAuthenticated, usage = PINEntryU
<Button
title={t('PINEnter.BiometricsUnlock')}
buttonType={ButtonType.Secondary}
testID={testIdWithKey('Enter')}
testID={testIdWithKey('BiometricsUnlock')}
disabled={!continueEnabled}
accessibilityLabel={t('PINEnter.BiometricsUnlock')}
onPress={loadWalletCredentials}
/>
</View>
</>
)}

{usage === PINEntryUsage.PINCheck && (
<View style={[style.buttonContainer, { marginTop: 10 }]}>
<Button
title={t('PINEnter.AppSettingCancel')}
buttonType={ButtonType.Secondary}
testID={testIdWithKey('AppSettingCancel')}
accessibilityLabel={t('PINEnter.AppSettingCancel')}
onPress={() => onCancelAuth?.(false)}
/>
</View>
)}
</View>
</View>
{alertModalVisible && (
7 changes: 6 additions & 1 deletion packages/legacy/core/App/screens/UseBiometry.tsx
Original file line number Diff line number Diff line change
@@ -330,8 +330,13 @@ const UseBiometry: React.FC = () => {
visible={canSeeCheckPIN}
transparent={false}
animationType={'slide'}
presentationStyle="pageSheet"
>
<PINEnter usage={PINEntryUsage.PINCheck} setAuthenticated={onAuthenticationComplete} />
<PINEnter
usage={PINEntryUsage.PINCheck}
setAuthenticated={onAuthenticationComplete}
onCancelAuth={setCanSeeCheckPIN}
/>
</Modal>
</SafeAreaView>
)
Original file line number Diff line number Diff line change
@@ -289,6 +289,7 @@ exports[`UseBiometry Screen Renders correctly when biometry available 1`] = `
<Modal
animationType="slide"
hardwareAccelerated={false}
presentationStyle="pageSheet"
style={
Object {
"backgroundColor": "#000000",
@@ -577,6 +578,7 @@ exports[`UseBiometry Screen Renders correctly when biometry not available 1`] =
<Modal
animationType="slide"
hardwareAccelerated={false}
presentationStyle="pageSheet"
style={
Object {
"backgroundColor": "#000000",
@@ -918,6 +920,7 @@ exports[`UseBiometry Screen Toggles use biometrics ok 1`] = `
<Modal
animationType="slide"
hardwareAccelerated={false}
presentationStyle="pageSheet"
style={
Object {
"backgroundColor": "#000000",

0 comments on commit 883c08a

Please sign in to comment.