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

Fix incorrect 'device verified' screen when app was opened with no network connection #3110

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

jmartinesp
Copy link
Member

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Fix checking for session verification status after session restoration, a different check is needed.
  • Fix deadlock when reading the skipVerification preference. I'd rather just remove it, but it's needed as a workaround on AppMigration02.

Motivation and context

It turns out encryptionService.verificationState() runs a network request that will cause a deadlock when it fails and that will trigger a timeout that will assume your session needs to be verified.

Also fixed another deadlock that caused the screen to remain blank sometimes after logging in, because DataStore got stuck when checking the skipVerification state for some reason I don't fully understand. We'll have to keep an eye on similar behaviours through the app.

Tests

  • Open your app with no network connection, it should load just fine.
  • Restore network connection, then log out.
  • Log in again.
  • You should see the session verification screen again.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

…n the user opened the app with no network connection.

It turns out `encryptionService.verificationState()` runs a network request that will cause a deadlock when it fails.

Also fixed another deadlock that caused the screen to remain blank sometimes after logging in, because DataStore got stuck when checking the `skipVerification` state for some reason I don't fully understand.
@jmartinesp jmartinesp requested a review from a team as a code owner June 28, 2024 09:35
@jmartinesp jmartinesp requested review from bmarty and removed request for a team June 28, 2024 09:35
@jmartinesp jmartinesp force-pushed the fix/jme/session-verification-state-with-no-network branch from faaeff3 to f421f94 Compare June 28, 2024 09:35
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Jun 28, 2024
Copy link
Contributor

📱 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/ZbqYkX

Copy link

sonarcloud bot commented Jun 28, 2024

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.96%. Comparing base (0c543ab) to head (f421f94).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3110   +/-   ##
========================================
  Coverage    75.96%   75.96%           
========================================
  Files         1636     1636           
  Lines        38617    38618    +1     
  Branches      7463     7463           
========================================
+ Hits         29335    29336    +1     
  Misses        5393     5393           
  Partials      3889     3889           

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

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jun 28, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jun 28, 2024
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing those annoying bugs!

Timber.d("Updating verification status: flow just finished")
runCatching {
encryptionService.waitForE2eeInitializationTasks()
}.onSuccess {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe do something on failure?

@bmarty bmarty merged commit 3749c8d into develop Jul 1, 2024
30 checks passed
@bmarty bmarty deleted the fix/jme/session-verification-state-with-no-network branch July 1, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants