Skip to content

Commit

Permalink
Merge branch 'master' into chore-remove-native-base
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnplb committed May 14, 2024
2 parents 7d9b8a9 + 9287ace commit cb2bc47
Show file tree
Hide file tree
Showing 8 changed files with 305 additions and 236 deletions.
11 changes: 2 additions & 9 deletions locales/de/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,7 @@ authentication:
hint: "Gib in diesem Feld die 8-stellige PIN deiner elektronischen Identitätskarte ein."
pinCardTitle: "Gib die PIN deiner Identitätskarte ein"
pinCardHeader: "Anmeldung mit CIE"
pinCardContent: "Der PIN-Code besteht aus 8 Ziffern. Vier Ziffern wurden dir beim Meldeamt ausgehändigt und weitere vier Ziffern wurden dir mit der Karte nach Hause geschickt. Setze diese in dieser Reihenfolge zusammen und trage sie bitte hier ein."
incorrectCiePinTitle: "Falsche PIN, du hast noch {{remainingCount}} Versuche"
incorrectCiePinHeaderTitle: "Falsche PIN"
incorrectCiePinContent1: "Zu deiner Sicherheit kannst du die PIN der Identitätskarte maximal dreimal eingeben. Danach musst du die Karte durch Eingabe des PUK-Codes entsperren."
incorrectCiePinContent2: "Beachte, dass der PIN-Code deiner elektronischen Identitätskarte (CIE) aus 8 Ziffern besteht. Vier Ziffern, die dir im Meldeamt ausgehändigt wurden und weitere vier Ziffern, die dir zusammen mit der Karte nach Hause geschickt wurden."
pinCardContent: "Der PIN-Code besteht aus 8 Ziffern. Vier Ziffern wurden dir beim Meldeamt ausgehändigt und weitere vier Ziffern wurden dir mit der Karte nach Hause geschickt. Setze diese in dieser Reihenfolge zusammen und trage sie bitte hier ein."
alert: "Möchtest du wirklich zurückgehen?"
subtitleHelp: "Die PIN ist ein 8-stelliger Code."
subtitleCTA: "Wo finde ich ihn?"
Expand Down Expand Up @@ -626,10 +622,7 @@ authentication:
readingInProgress: "WIRD GELESEN \nHalte die Karte einige Sekunden lang still..."
readingSuccess: "Das Auslesen war erfolgreich.\nDu kannst die Karte entfernen während wir die Datenüberprüfung abschließen."
invalidCard: "Die verwendete Karte scheint keine elektronische Identitätskarte (CIE) zu sein."
tagLost: "Du hast die Karte zu früh entfernt."
cardLocked: "Identitätskarte gesperrt"
wrongPin1AttemptLeft: "Falsche PIN, du hast noch einen Versuch"
wrongPin2AttemptLeft: "Falsche PIN, du hast noch zwei Versuche"
tagLost: "Du hast die Karte zu früh entfernt."
genericError: "Es ist ein unerwarteter Fehler aufgetreten. Bitte versuche es erneut."
error:
readerCardLostTitle: "Karte neu lesen"
Expand Down
18 changes: 11 additions & 7 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,14 @@ authentication:
pinCardTitle: Enter the PIN of your ID Card
pinCardHeader: Login with CIE
pinCardContent: The PIN code consists of 8 digits. Four digits have been delivered to you at the registry office and another four digits have been sent to your home along with the card. Put them together, in that order, and enter them here please.
incorrectCiePinTitle: Incorrect PIN, you still have {{remainingCount}} attempts
incorrectCiePinHeaderTitle: Wrong PIN
incorrectCiePinContent1: For your security, you can try entering the card PIN no more than three times. Then you will have to unlock the card by entering the PUK.
incorrectCiePinContent2: Keep in mind that the PIN code of your Electronic Identity Card (CIE) is composed of 8 digits. Four digits that were given to you at the registry office and another four digits that were sent to you at home, along with the card.
incorrectCiePinTitle1: Wrong PIN
incorrectCiePinTitle2: You have entered a wrong PIN twice
lockedCiePinTitle: You have entered a wrong PIN too many times
incorrectCiePinContent1: You still have 2 attempts left, check it and try again.
incorrectCiePinContent2: After the third incorrect attempt, the PIN will be blocked. To unlock it and set a new one, you will need to enter the PUK code into the CieID app.
incorrectCiePinSecondaryActionLabel2: Lost your PIN?
lockedCiePinContent: The PIN of your CIE has been blocked. To unlock it and set a new one, you will need to enter the PUK code into the CieID app.
lockedSecondaryActionLabel: Lost your PUK?
alert: Are you sure you want to go back?
subtitleHelp: The PIN code consists of 8 digits.
subtitleCTA: Where can I find it?
Expand Down Expand Up @@ -661,9 +665,9 @@ authentication:
readingSuccess: "Successful reading.\nYou can remove the card while we complete the data verification."
invalidCard: It seems that this card is not an Electronic Identity Card (CIE).
tagLost: You removed the card too soon.
cardLocked: CIE card locked
wrongPin1AttemptLeft: Wrong PIN, you still have 1 attempt
wrongPin2AttemptLeft: Wrong PIN, you still have 2 attempts
cardLocked: The CIE PIN is blocked.
wrongPin1AttemptLeft: You have entered a wrong PIN twice
wrongPin2AttemptLeft: Wrong PIN
genericError: Something went wrong! Please try again.
error:
readerCardLostTitle: Hold the card again for a few seconds
Expand Down
18 changes: 11 additions & 7 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,14 @@ authentication:
pinCardTitle: Inserisci il PIN della CIE
pinCardHeader: Entra con CIE
pinCardContent: Il codice PIN è composto da 8 cifre. Quattro cifre che ti sono state consegnate all'anagrafe e altre 4 cifre ti sono state spedite a casa, insieme alla carta. Mettile insieme, in quest'ordine, e inseriscile qui per favore.
incorrectCiePinTitle: PIN errato, hai ancora {{remainingCount}} tentativi
incorrectCiePinHeaderTitle: PIN errato
incorrectCiePinContent1: Per la tua sicurezza puoi provare ad inserire il PIN della carta non più di tre volte. Poi dovrai sbloccare la carta inserendo il PUK.
incorrectCiePinContent2: Ricorda che il codice PIN della tua Carta d'Identità Elettronica (CIE) è composto da 8 cifre. Quattro cifre che ti sono state consegnate all'anagrafe e altre quattro cifre che ti sono state spedite a casa, insieme alla carta.
incorrectCiePinTitle1: Il PIN non è corretto
incorrectCiePinTitle2: Hai inserito un PIN errato per 2 volte
lockedCiePinTitle: Hai inserito un PIN errato per troppe volte
incorrectCiePinContent1: Hai ancora 2 tentativi, controllalo e riprova.
incorrectCiePinContent2: Al terzo tentativo errato, il PIN verrà bloccato. Per sbloccarlo e impostarne un nuovo, dovrai inserire il codice PUK nell’app CieID.
incorrectCiePinSecondaryActionLabel2: Hai dimenticato il PIN?
lockedCiePinContent: Il PIN della tua CIE è stato bloccato. Per sbloccarlo e impostarne un nuovo, dovrai inserire il codice PUK nell’app CieID.
lockedSecondaryActionLabel: Hai dimenticato il PUK?
alert: Vuoi davvero tornare indietro?
subtitleHelp: Il PIN è un codice di 8 cifre.
subtitleCTA: Dove lo trovo?
Expand Down Expand Up @@ -661,9 +665,9 @@ authentication:
readingSuccess: "Lettura avvenuta con successo.\nPuoi rimuovere la carta mentre completiamo la verifica dei dati."
invalidCard: La carta utilizzata non sembra essere una Carta di Identità Elettronica (CIE).
tagLost: Hai rimosso la carta troppo presto.
cardLocked: Carta CIE bloccata
wrongPin1AttemptLeft: PIN errato, hai ancora 1 tentativo
wrongPin2AttemptLeft: PIN errato, hai ancora 2 tentativi
cardLocked: Il PIN della CIE è stato bloccato
wrongPin1AttemptLeft: Hai inserito un PIN errato per due volte
wrongPin2AttemptLeft: Il PIN non è corretto
genericError: Si è verificato un errore imprevisto. Riprova.
error:
readerCardLostTitle: Avvicina nuovamente la carta
Expand Down
22 changes: 12 additions & 10 deletions ts/navigation/AuthenticationNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import CieAuthorizeDataUsageScreen from "../screens/authentication/cie/CieAuthor
import CieCardReaderScreen from "../screens/authentication/cie/CieCardReaderScreen";
import CieConsentDataUsageScreen from "../screens/authentication/cie/CieConsentDataUsageScreen";
import CieExpiredOrInvalidScreen from "../screens/authentication/cie/CieExpiredOrInvalidScreen";
import CiePinLockedTemporarilyScreen from "../screens/authentication/cie/CiePinLockedTemporarilyScreen";
import CiePinScreen from "../screens/authentication/cie/CiePinScreen";
import CieWrongCiePinScreen from "../screens/authentication/cie/CieWrongCiePinScreen";
import { AuthSessionPage } from "../screens/authentication/idpAuthSessionHandler";
Expand Down Expand Up @@ -115,15 +114,18 @@ const AuthenticationStackNavigator = () => (
component={CieConsentDataUsageScreen}
/>

<Stack.Screen
name={ROUTES.CIE_WRONG_PIN_SCREEN}
component={CieWrongCiePinScreen}
/>

<Stack.Screen
name={ROUTES.CIE_PIN_TEMP_LOCKED_SCREEN}
component={CiePinLockedTemporarilyScreen}
/>
<Stack.Group
screenOptions={{
gestureEnabled: false,
headerShown: false,
...TransitionPresets.ModalSlideFromBottomIOS
}}
>
<Stack.Screen
name={ROUTES.CIE_WRONG_PIN_SCREEN}
component={CieWrongCiePinScreen}
/>
</Stack.Group>

<Stack.Group
screenOptions={{
Expand Down
113 changes: 113 additions & 0 deletions ts/screens/authentication/__tests__/cie/CieWrongCiePinScreen.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { createStore } from "redux";
import I18n from "../../../../i18n";
import ROUTES from "../../../../navigation/routes";
import { applicationChangeState } from "../../../../store/actions/application";
import { appReducer } from "../../../../store/reducers";
import { renderScreenWithNavigationStoreContext } from "../../../../utils/testWrapper";
import CieWrongCiePinScreen from "../../cie/CieWrongCiePinScreen";

const closeLabel = I18n.t("global.buttons.close");
const retryLabel = I18n.t("global.buttons.retry");

type Test = {
remainingCount: number;
title: string;
subtitle: string;
actionLabel: string;
actionTestID: string;
secondaryActionLabel: string;
secondaryActionTestID: string;
};

const tests = Array<Test>(
{
remainingCount: 2,
title: I18n.t("authentication.cie.pin.incorrectCiePinTitle1"),
subtitle: I18n.t("authentication.cie.pin.incorrectCiePinContent1"),
actionLabel: retryLabel,
actionTestID: `message-action-${retryLabel}`,
secondaryActionLabel: closeLabel,
secondaryActionTestID: `message-action-${closeLabel}`
},
{
remainingCount: 1,
title: I18n.t("authentication.cie.pin.incorrectCiePinTitle2"),
subtitle: I18n.t("authentication.cie.pin.incorrectCiePinContent2"),
actionLabel: retryLabel,
actionTestID: `message-action-${retryLabel}`,
secondaryActionLabel: I18n.t(
"authentication.cie.pin.incorrectCiePinSecondaryActionLabel2"
),
secondaryActionTestID: `message-action-${I18n.t(
"authentication.cie.pin.incorrectCiePinSecondaryActionLabel2"
)}`
},
{
remainingCount: 0,
title: I18n.t("authentication.cie.pin.lockedCiePinTitle"),
subtitle: I18n.t("authentication.cie.pin.lockedCiePinContent"),
actionLabel: closeLabel,
actionTestID: `message-action-${closeLabel}`,
secondaryActionLabel: I18n.t(
"authentication.cie.pin.lockedSecondaryActionLabel"
),
secondaryActionTestID: `message-action-${I18n.t(
"authentication.cie.pin.lockedSecondaryActionLabel"
)}`
}
);

const useCaseThatShouldNotHappen: Test = {
remainingCount: -1,
title: I18n.t("global.genericError"),
subtitle: "-1",
actionLabel: retryLabel,
actionTestID: `message-action-${retryLabel}`,
secondaryActionLabel: closeLabel,
secondaryActionTestID: `message-action-${closeLabel}`
};

describe("CieWrongCiePinScreen", () => {
tests.forEach(test => {
it(`it should render correctly, with ${test.remainingCount} remainig attemps`, () => {
const component = renderComponent(test.remainingCount);
expect(component).toBeDefined();
expect(component.getByText(test.title)).toBeDefined();
expect(component.getByText(test.subtitle)).toBeDefined();
expect(component.getByText(test.actionLabel)).toBeDefined();
expect(component.getByText(test.secondaryActionLabel)).toBeDefined();
expect(component.getByTestId(test.actionTestID)).toBeDefined();
expect(component.getByTestId(test.secondaryActionTestID)).toBeDefined();
});
});
it("it should render the default message, in case of unexpetect values", () => {
const component = renderComponent(
useCaseThatShouldNotHappen.remainingCount
);
expect(component).toBeDefined();
expect(component.queryByText(tests[0].title)).toBeNull();
expect(component.queryByText(tests[0].subtitle)).toBeNull();
expect(component.getByText(I18n.t("global.genericError"))).toBeDefined();
expect(
component.getByText(useCaseThatShouldNotHappen.actionLabel)
).toBeDefined();
expect(
component.getByText(useCaseThatShouldNotHappen.secondaryActionLabel)
).toBeDefined();
expect(
component.getByText(useCaseThatShouldNotHappen.subtitle)
).toBeDefined();
});
});

const renderComponent = (remainingCount: number) => {
const globalState = appReducer(undefined, applicationChangeState("active"));
const store = createStore(appReducer, globalState as any);

return renderScreenWithNavigationStoreContext(
CieWrongCiePinScreen,
ROUTES.AUTHENTICATION_OPT_IN,
{ remainingCount },
store
);
};
13 changes: 2 additions & 11 deletions ts/screens/authentication/cie/CieCardReaderScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,24 +278,15 @@ class CieCardReaderScreen extends React.PureComponent<Props, State> {
// The card is temporarily locked. Unlock is available by CieID app
case "PIN Locked":
case "ON_CARD_PIN_LOCKED":
this.setError({
eventReason: event.event,
navigation: () =>
this.props.navigation.navigate(ROUTES.AUTHENTICATION, {
screen: ROUTES.CIE_PIN_TEMP_LOCKED_SCREEN
})
});
break;

// The inserted pin is incorrect
case "ON_PIN_ERROR":
this.setError({
eventReason: event.event,
navigation: () =>
this.props.navigation.navigate(ROUTES.AUTHENTICATION, {
screen: ROUTES.CIE_WRONG_PIN_SCREEN,
params: {
remainingCount: event.attemptsLeft
remainingCount:
event.event === "ON_CARD_PIN_LOCKED" ? 0 : event.attemptsLeft
}
})
});
Expand Down
108 changes: 0 additions & 108 deletions ts/screens/authentication/cie/CiePinLockedTemporarilyScreen.tsx

This file was deleted.

0 comments on commit cb2bc47

Please sign in to comment.