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

Improve session db and improve deleted session behavior #1520

Merged
merged 18 commits into from
Oct 11, 2023

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Oct 9, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Motivation and context

Working on element-hq/element-android#8663, I realized that some fields was missing to migrate data properly. This PR adds 2 fields to SessionData. Also adding unit test for the database migration (automatically added to the gradle test task).

Part of #1154 (no soft logout support)

Will add string to localazy once the wording will be approved.

Screenshots / GIFs

See recorded screenshot

Tests

  • Sign in to an account;
  • Delete the session from another device;
  • Observe the new screen

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner October 9, 2023 19:05
@bmarty bmarty requested review from ganfra and removed request for a team October 9, 2023 19:05
@bmarty bmarty changed the title Improve session db Improve session db and improve deleted session behavior Oct 9, 2023
@ElementBot
Copy link
Collaborator

ElementBot commented Oct 9, 2023

Messages
📖 Sign-off not required, allow-list

Generated by 🚫 dangerJS against 33943b2

rustMatrixClientFactory.create(sessionData)
} else {
error("Token is not valid")
}
Copy link
Member Author

@bmarty bmarty Oct 9, 2023

Choose a reason for hiding this comment

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

Sometimes a Push can trigger this, and the Sdk ends up in a messed up state. So avoid restoring a MatrixClient if we know that the token is not valid anymore.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2023

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/XmtNQv

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Attention: 90 lines in your changes are missing coverage. Please review.

Comparison is base (096d575) 58.98% compared to head (33943b2) 58.99%.
Report is 10 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1520      +/-   ##
===========================================
+ Coverage    58.98%   58.99%   +0.01%     
===========================================
  Files         1133     1142       +9     
  Lines        30316    30479     +163     
  Branches      6215     6245      +30     
===========================================
+ Hits         17882    17982     +100     
- Misses        9761     9801      +40     
- Partials      2673     2696      +23     
Files Coverage Δ
...android/features/signedout/impl/SignedOutEvents.kt 100.00% <100.00%> (ø)
.../android/features/signedout/impl/SignedOutState.kt 100.00% <100.00%> (ø)
...roid/libraries/sessionstorage/api/LoggedInState.kt 100.00% <100.00%> (ø)
...ndroid/libraries/sessionstorage/api/SessionData.kt 100.00% <100.00%> (ø)
...droid/libraries/sessionstorage/api/SessionStore.kt 0.00% <ø> (ø)
...lin/io/element/android/appnav/root/RootNavState.kt 0.00% <0.00%> (ø)
.../features/signedout/impl/SignedOutStateProvider.kt 95.00% <95.00%> (ø)
...ries/matrix/test/auth/FakeAuthenticationService.kt 75.00% <0.00%> (ø)
...sessionstorage/impl/memory/InMemorySessionStore.kt 54.54% <0.00%> (+54.54%) ⬆️
...roid/features/signedout/api/SignedOutEntryPoint.kt 0.00% <0.00%> (ø)
... and 10 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Good work thanks!

@sonarcloud
Copy link

sonarcloud bot commented Oct 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bmarty bmarty merged commit 88ca379 into develop Oct 11, 2023
13 of 14 checks passed
@bmarty bmarty deleted the feature/bma/sessionDb branch October 11, 2023 14:56
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