Skip to content

Fix coroutine scope #4820

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

Merged
merged 3 commits into from
Jun 4, 2025
Merged

Fix coroutine scope #4820

merged 3 commits into from
Jun 4, 2025

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jun 4, 2025

Content

Use the CoroutineScope tight to the session when appropriate.
Introduce a AppCoroutineScope annotation so that we do not inject the app coroutine scope by mistake.

Motivation and context

Use the correct coroutine scope in all the classes.

Screenshots / GIFs

No change

Tests

There should have no effect, but signing out should cancel any pending operation in the session coroutine scope.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • 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
  • You've made a self review of your PR

@bmarty bmarty requested a review from a team as a code owner June 4, 2025 14:10
@bmarty bmarty requested review from jmartinesp and removed request for a team June 4, 2025 14:10
@bmarty bmarty added the PR-Misc For other changes label Jun 4, 2025
Copy link
Contributor

github-actions bot commented Jun 4, 2025

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

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 85.24590% with 9 lines in your changes missing coverage. Please review.

Project coverage is 80.46%. Comparing base (36c7c7a) to head (b52593e).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...all/impl/receivers/DeclineCallBroadcastReceiver.kt 0.00% 2 Missing ⚠️
...roid/features/call/impl/ui/IncomingCallActivity.kt 0.00% 2 Missing ⚠️
...player/impl/DefaultVoiceMessagePresenterFactory.kt 0.00% 2 Missing ⚠️
...atures/lockscreen/impl/DefaultLockScreenService.kt 0.00% 1 Missing ⚠️
.../biometric/DefaultBiometricAuthenticatorManager.kt 0.00% 1 Missing ⚠️
...raries/push/impl/push/OnNotifiableEventReceived.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4820   +/-   ##
========================================
  Coverage    80.45%   80.46%           
========================================
  Files         2141     2141           
  Lines        56736    56737    +1     
  Branches      7110     7110           
========================================
+ Hits         45649    45652    +3     
  Misses        8637     8637           
+ Partials      2450     2448    -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

Thanks, this should also solve some issues where the coroutine scope outlived the component 🤞 .

jmartinesp

This comment was marked as duplicate.

@bmarty bmarty enabled auto-merge (squash) June 4, 2025 15:08
Copy link

sonarqubecloud bot commented Jun 4, 2025

@bmarty bmarty merged commit 5f191d9 into develop Jun 4, 2025
28 of 29 checks passed
@bmarty bmarty deleted the feature/bma/fixCoroutineScope branch June 4, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Misc For other changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants