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: [IOPID-2687] Offline wallet: no internet connection scenario #6767

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

Ladirico
Copy link
Contributor

@Ladirico Ladirico commented Feb 28, 2025

Short description

This PR implements the logic that allows users to access the offline version of the wallet when there is no internet connection.

List of changes proposed in this pull request

  • Implemented the logic that redirects users from the ingress screen to the identification process and then to the offline wallet when no internet connection is available.
  • Replaced the custom connection-checking logic with the isConnectedSelector provided by the platform, ensuring a more consistent and standardized approach.
  • Created a new Redux state offlineAccessReason, two action setOfflineAccessReason and resetOfflineAccessReason, and a selector
    offlineAccessReasonSelector to track the reason why a user is accessing the offline wallet. All three cases have been mapped:
    • No internet connection (the only case implemented in this PR).
    • Session refresh failure (not yet integrated).
    • User logout (not yet integrated).
  • Added a missing title for the offline mode. Previously, this was an edge case where no title was displayed.
  • Added logics to stop startup saga when offline flow starts
  • Add logic to back online in ts/features/itwallet/wallet/utils/withOfflineAlert.tsx

Demo

With wallet instance Without wallet instance Local feature flag disabled back online from wallet
with_wi.mov
no_wi.mov
no_FF.mov
back_online_flow.mov

How to test

Warning

Currently, there is no way to perform dev mode testing of the offline scenario on iOS device (either physical or emulator) so I suggest using a physical Android device

  1. Launch the app using either the development or production environment (both work).
  2. Log in and enable the local feature flag in the developer section: Settings > Documents on IO > Enable offline access
  3. To test the behavior with or without an active wallet instance, manually modify the value of itwLifecycleIsOperationalOrValid:
  • Set to true if you need an active wallet instance.
  • Set to false if you want to test the flow without a wallet instance.
  1. Close the app.
  2. Put the device in offline mode.
  3. Open the app.
    If the wallet instance is active and the feature flag is enabled, you should be redirected to the offline flow.
    Otherwise, you should see the default ("as-is") screen.

@Ladirico Ladirico added the IO-A&I IO - Autenticazione e Identità label Feb 28, 2025
@Ladirico Ladirico self-assigned this Feb 28, 2025
Copy link
Contributor

github-actions bot commented Feb 28, 2025

Jira Pull Request Link

This Pull Request refers to Jira issues:

Copy link
Contributor

PR Title Validation for conventional commit type

All good! PR title follows the conventional commit type.

Copy link

codecov bot commented Feb 28, 2025

Codecov Report

Attention: Patch coverage is 58.97436% with 16 lines in your changes missing coverage. Please review.

Project coverage is 50.97%. Comparing base (f591e0a) to head (7ee5644).

Files with missing lines Patch % Lines
...eatures/itwallet/wallet/utils/withOfflineAlert.tsx 0.00% 5 Missing ⚠️
ts/features/ingress/store/reducer/index.ts 0.00% 4 Missing ⚠️
ts/features/ingress/screens/IngressScreen.tsx 86.66% 2 Missing ⚠️
ts/navigation/AppStackNavigator.tsx 60.00% 2 Missing ⚠️
ts/features/ingress/store/selectors/index.ts 50.00% 1 Missing ⚠️
ts/navigation/OfflineStackNavigator.tsx 66.66% 1 Missing ⚠️
ts/sagas/startup.ts 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6767      +/-   ##
==========================================
+ Coverage   46.40%   50.97%   +4.57%     
==========================================
  Files        1453     1580     +127     
  Lines       30546    32717    +2171     
  Branches     6913     7363     +450     
==========================================
+ Hits        14176    16679    +2503     
+ Misses      16320    15991     -329     
+ Partials       50       47       -3     
Files with missing lines Coverage Δ
ts/features/ingress/store/actions/index.ts 100.00% <100.00%> (ø)
...features/itwallet/navigation/ItwStackNavigator.tsx 29.41% <ø> (ø)
ts/screens/modal/IdentificationModal.tsx 39.24% <100.00%> (ø)
ts/store/reducers/startup.ts 73.91% <ø> (ø)
ts/features/ingress/store/selectors/index.ts 50.00% <50.00%> (ø)
ts/navigation/OfflineStackNavigator.tsx 66.66% <66.66%> (ø)
ts/sagas/startup.ts 35.00% <50.00%> (ø)
ts/features/ingress/screens/IngressScreen.tsx 94.11% <86.66%> (-2.55%) ⬇️
ts/navigation/AppStackNavigator.tsx 49.05% <60.00%> (+3.77%) ⬆️
ts/features/ingress/store/reducer/index.ts 53.84% <0.00%> (-46.16%) ⬇️
... and 1 more

... and 322 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 f591e0a...7ee5644. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO-A&I IO - Autenticazione e Identità
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants