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

Lock profile when user leaves app on Ionic platform #1933

Merged
merged 4 commits into from
May 17, 2024

Conversation

lubej
Copy link
Collaborator

@lubej lubej commented May 14, 2024

Solution

Current behavior of mobile platform(for that matter also web/extensions) does not lock the user profile, when leaving the app. Meaning the app would stay indefinitely unlocked, if user does not explicitly lock the wallet. This PR locks the wallet in 30sec of inactivity - but the implementation is not ideal. As timers get "frozen" when put in background, it uses a check upon activating the app, by comparing the timestamps before it went to sleep. Ideal solution would have a background service, with timer implemented - but would add an overhead of additional capacitor plugin.

In combination with hiding app information upon switching between apps(mobile), should be good enough solution.

Resources

For demo purposes, this used 5sec timer(instead of 30sec):
https://github.com/oasisprotocol/oasis-wallet-web/assets/9722540/ef1cb6d9-3cf0-4dac-8345-8fddd1bbdbdf

Copy link

github-actions bot commented May 14, 2024

Deployed to Cloudflare Pages

Latest commit: 9ce6edaa132ea175de5d900f30d65995d0801c47
Status:✅ Deploy successful!
Preview URL: https://40b72356.oasis-wallet.pages.dev

@lubej lubej force-pushed the ml/lock-profile-when-user-leaves-app branch 3 times, most recently from 545c517 to f0b9b23 Compare May 14, 2024 05:02
@lubej lubej marked this pull request as ready for review May 14, 2024 05:13
@lubej lubej requested review from buberdds and lukaw3d May 14, 2024 05:14
src/app/components/Ionic/IonicProvider.tsx Outdated Show resolved Hide resolved
src/app/components/Ionic/IonicProvider.tsx Outdated Show resolved Hide resolved
src/app/components/Ionic/IonicProvider.tsx Outdated Show resolved Hide resolved
@lubej lubej force-pushed the ml/lock-profile-when-user-leaves-app branch from 6c5c594 to 8d98512 Compare May 15, 2024 03:29
Copy link

codecov bot commented May 15, 2024

Codecov Report

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

Project coverage is 80.56%. Comparing base (61181fe) to head (8d98512).
Report is 15 commits behind head on master.

Current head 8d98512 differs from pull request most recent head 9ce6eda

Please upload reports for the commit 9ce6eda to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1933      +/-   ##
==========================================
- Coverage   80.82%   80.56%   -0.27%     
==========================================
  Files         199      202       +3     
  Lines        5221     5247      +26     
  Branches      956      960       +4     
==========================================
+ Hits         4220     4227       +7     
- Misses       1001     1020      +19     
Flag Coverage Δ
cypress 44.54% <11.11%> (-0.15%) ⬇️
jest 76.59% <36.84%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/ionicConfig.ts 100.00% <100.00%> (ø)
src/app/components/Ionic/IonicProvider.tsx 69.23% <60.00%> (+24.23%) ⬆️
...mponents/Ionic/hooks/useIonicBackButtonListener.ts 30.76% <30.76%> (ø)
...nts/Ionic/hooks/useIonicAppStateChangeListener.tsx 31.57% <31.57%> (ø)

... and 2 files with indirect coverage changes

@lubej lubej requested a review from buberdds May 15, 2024 03:36
@lubej lubej force-pushed the ml/lock-profile-when-user-leaves-app branch from 8d98512 to 9ce6eda Compare May 17, 2024 08:41
@lubej lubej merged commit 8a7bf70 into master May 17, 2024
13 checks passed
@lubej lubej deleted the ml/lock-profile-when-user-leaves-app branch May 17, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants