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

feat(IT Wallet): [SIW-1090] Add NFC enable instructions screen #5733

Merged
merged 48 commits into from
May 10, 2024

Conversation

mastro993
Copy link
Contributor

@mastro993 mastro993 commented Apr 30, 2024

Warning

This PR depends on #5745

Short description

This PR adds the screen to display the instructions to enable the NFC for Android users.

List of changes proposed in this pull request

  • Added ItwIdentificationNfcInstructionsScreen component
  • Added required locale keys

How to test

In order to test this PR on dev environment, make sure to add this flag to your .env:

# Enable CIE login flow with emulator and dev server
CIE_LOGIN_WITH_DEV_SERVER_ENABLED=YES

On a simulator

Go to Profile > IT Wallet > Issuing, clicking on CIE + PIN you should be able to see the NFC instructions screen.

On a physical Android device

Disable the NFC, then go to Profile > IT Wallet > Issuing, clicking on CIE + PIN you should be able to see the NFC instructions screen.

Preview

@pagopa-github-bot pagopa-github-bot changed the title [SIW-1090] Add NFC enable instructions screen feat(IT Wallet): [SIW-1090] Add NFC enable instructions screen Apr 30, 2024
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Apr 30, 2024

Affected stories

  • 🌟 SIW-1090: Come cittadino voglio sapere come attivare NFC per proseguire nel flusso di autenticazione
    subtask of
    • SIW-435: Inizializzazione wallet

Generated by 🚫 dangerJS against d7463e1

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

Attention: Patch coverage is 9.09091% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 48.86%. Comparing base (4f204b4) to head (d7463e1).
Report is 63 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5733      +/-   ##
==========================================
+ Coverage   48.42%   48.86%   +0.43%     
==========================================
  Files        1488     1605     +117     
  Lines       31617    32242     +625     
  Branches     7669     7809     +140     
==========================================
+ Hits        15311    15755     +444     
- Misses      16238    16420     +182     
+ Partials       68       67       -1     
Files Coverage Δ
...features/itwallet/navigation/ItwStackNavigator.tsx 66.66% <ø> (ø)
ts/features/itwallet/navigation/routes.ts 100.00% <ø> (ø)
...n/screens/ItwIdentificationModeSelectionScreen.tsx 4.34% <0.00%> (ø)
...screens/ItwIdentificationNfcInstructionsScreen.tsx 14.28% <14.28%> (ø)

... and 227 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba22fac...d7463e1. Read the comment docs.

@mastro993 mastro993 marked this pull request as ready for review May 3, 2024 14:52
@mastro993 mastro993 requested review from thisisjp and a team as code owners May 3, 2024 14:52
Copy link
Contributor

@hevelius hevelius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mastro993
Copy link
Contributor Author

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

@LazyAfternoons
Copy link
Contributor

LazyAfternoons commented May 9, 2024

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

This approach doesn't seem to consider the edge case where you already have NFC enabled when landing on the authentication method screen and then you disable it. Pressing the "CIE + PIN" button will still yield a "Not implemented" alert. That's because we are dispatching the check when rendering the list. Do you think we should consider this edge case or can we leave this out in this PR?

Beside this edge case, it seems to work fine now.

@mastro993
Copy link
Contributor Author

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

This approach doesn't seem to consider the edge case where you already have NFC enabled when landing on the authentication method screen and then you disable it. Pressing the "CIE + PIN" button will still yield a "Not implemented" alert. That's because we are dispatching the check when rendering the list. Do you think we should consider this edge case or can we leave this out in this PR?

Beside this edge case, it seems to work fine now.

You are right. I didn't notice this edge case, I assumed that the user would activate the NFC after the navigation, so the useFocusEffect was enough. I think it's better to address this issue in this PR. Working on it!

@mastro993
Copy link
Contributor Author

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

This approach doesn't seem to consider the edge case where you already have NFC enabled when landing on the authentication method screen and then you disable it. Pressing the "CIE + PIN" button will still yield a "Not implemented" alert. That's because we are dispatching the check when rendering the list. Do you think we should consider this edge case or can we leave this out in this PR?

Beside this edge case, it seems to work fine now.

After some testing I found that we can't tell if the user enables NFC from the notification bar settings..
According to this open issue, AppState onChange listener does not know if the notification bar has been pulled down, so the only way to refresh the NFC state is to wait for the user to go to another screen or app.
Some considerations:

  • We could check the NFC status when the user presses the button and goes to the next screen. This will inevitably add some lag which will cause worse UX, imho.
  • We could add NFC status polling, but I think this is an over-engineered solution for this case.
  • In most cases the user discovers that their NFC is disabled after pressing the button. So the chances of a user turning NFC on/off from this screen are very low. That said, the probability exists, so we should keep this edge case in mind.

I think we can merge this PR and think about it later. What do you think?

Not related to the above issue: i pushed this commit to add the correct settings screen linking: 80592f0

@LazyAfternoons
Copy link
Contributor

LazyAfternoons commented May 10, 2024

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

This approach doesn't seem to consider the edge case where you already have NFC enabled when landing on the authentication method screen and then you disable it. Pressing the "CIE + PIN" button will still yield a "Not implemented" alert. That's because we are dispatching the check when rendering the list. Do you think we should consider this edge case or can we leave this out in this PR?
Beside this edge case, it seems to work fine now.

After some testing I found that we can't tell if the user enables NFC from the notification bar settings.. According to this open issue, AppState onChange listener does not know if the notification bar has been pulled down, so the only way to refresh the NFC state is to wait for the user to go to another screen or app. Some considerations:

  • We could check the NFC status when the user presses the button and goes to the next screen. This will inevitably add some lag which will cause worse UX, imho.
  • We could add NFC status polling, but I think this is an over-engineered solution for this case.
  • In most cases the user discovers that their NFC is disabled after pressing the button. So the chances of a user turning NFC on/off from this screen are very low. That said, the probability exists, so we should keep this edge case in mind.

I think we can merge this PR and think about it later. What do you think?

Not related to the above issue: i pushed this commit to add the correct settings screen linking: 80592f0

It's fine to leave this out from this PR.
Regarding the linking function, should we use openNFCSettings, as we already do in CieCardReaderScreen.tsx?

Thanks.

@mastro993
Copy link
Contributor Author

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

This approach doesn't seem to consider the edge case where you already have NFC enabled when landing on the authentication method screen and then you disable it. Pressing the "CIE + PIN" button will still yield a "Not implemented" alert. That's because we are dispatching the check when rendering the list. Do you think we should consider this edge case or can we leave this out in this PR?
Beside this edge case, it seems to work fine now.

After some testing I found that we can't tell if the user enables NFC from the notification bar settings.. According to this open issue, AppState onChange listener does not know if the notification bar has been pulled down, so the only way to refresh the NFC state is to wait for the user to go to another screen or app. Some considerations:

  • We could check the NFC status when the user presses the button and goes to the next screen. This will inevitably add some lag which will cause worse UX, imho.
  • We could add NFC status polling, but I think this is an over-engineered solution for this case.
  • In most cases the user discovers that their NFC is disabled after pressing the button. So the chances of a user turning NFC on/off from this screen are very low. That said, the probability exists, so we should keep this edge case in mind.

I think we can merge this PR and think about it later. What do you think?
Not related to the above issue: i pushed this commit to add the correct settings screen linking: 80592f0

It's fine to leave this out from this PR. Regarding the linking function, should we use openNFCSettings, as we already do in CieCardReaderScreen.tsx?

Thanks.

Yes, could be better but does not respect what the screen says: Settings -> Search NFC -> Enable. @thisisjp should be ignore what the screen says and prefer a shorter path for the user?

@LazyAfternoons
Copy link
Contributor

LazyAfternoons commented May 10, 2024

The screen looks good but is it supposed to pop-up even when NFC is enabled? That's the behaviour I'm noticing on my Android device.

The screen was still using the wrong actions/selectors I was using for testing purposes. Now it should be working as expected. See 242f664 and 6542478

This approach doesn't seem to consider the edge case where you already have NFC enabled when landing on the authentication method screen and then you disable it. Pressing the "CIE + PIN" button will still yield a "Not implemented" alert. That's because we are dispatching the check when rendering the list. Do you think we should consider this edge case or can we leave this out in this PR?
Beside this edge case, it seems to work fine now.

After some testing I found that we can't tell if the user enables NFC from the notification bar settings.. According to this open issue, AppState onChange listener does not know if the notification bar has been pulled down, so the only way to refresh the NFC state is to wait for the user to go to another screen or app. Some considerations:

  • We could check the NFC status when the user presses the button and goes to the next screen. This will inevitably add some lag which will cause worse UX, imho.
  • We could add NFC status polling, but I think this is an over-engineered solution for this case.
  • In most cases the user discovers that their NFC is disabled after pressing the button. So the chances of a user turning NFC on/off from this screen are very low. That said, the probability exists, so we should keep this edge case in mind.

I think we can merge this PR and think about it later. What do you think?
Not related to the above issue: i pushed this commit to add the correct settings screen linking: 80592f0

It's fine to leave this out from this PR. Regarding the linking function, should we use openNFCSettings, as we already do in CieCardReaderScreen.tsx?
Thanks.

Yes, could be better but does not respect what the screen says: Settings -> Search NFC -> Enable. @thisisjp should be ignore what the screen says and prefer a shorter path for the user?

My bad, that's true, I'd rather stick to the instructions on the screen. It makes sense. LGTM.

EDIT: We went for opening the NFC settings directly

@LazyAfternoons LazyAfternoons self-requested a review May 10, 2024 10:22
@mastro993 mastro993 merged commit 4201c97 into master May 10, 2024
13 checks passed
@mastro993 mastro993 deleted the SIW-1090-add-nfc-instructions-screen branch May 10, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants