wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.92k stars 1.3k forks source link

Fixes get post likes crash #20549

Closed antonis closed 1 month ago

antonis commented 1 month ago

Fixes #20548

Desctiption

Uses a CancelableContinuation to be able to check if it is active before resuming. This should prevent the following exception causing the crash:

Caused by java.lang.IllegalStateException: Already resumed
    at kotlin.coroutines.SafeContinuation.resumeWith (SafeContinuationJvm.kt:44)
    at org.wordpress.android.ui.engagement.GetLikesUseCase.onPostLikesChanged (GetLikesUseCase.kt:206)
    at java.lang.reflect.Method.invoke
    at org.greenrobot.eventbus.EventBus.invokeSubscriber (EventBus.java:517)

To Test:

I was not able to reproduce the crash thus I suggest a sanity check that the functionality is not broken

  1. Open a reader post with likes
  2. Open a posts like notification

https://github.com/wordpress-mobile/WordPress-Android/assets/304044/7a5c86d4-51bb-4620-b748-8a738fbd4223


Regression Notes

  1. Potential unintended areas of impact

    • Likes
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Manual testing
  3. What automated tests I added (or what prevented me from doing so)

    • Relied on the existing GetLikesUseCaseTest

PR Submission Checklist:


Testing Checklist (strike-out the not-applying and unnecessary ones):

dangermattic commented 1 month ago
1 Warning
:warning: This PR is assigned to the milestone 24.6. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by :no_entry_sign: Danger

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

wpmobilebot commented 1 month ago
WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20549-e46b23e
Commite46b23e231f5e96b4b3b8c988d23a434dd25da9d
Direct Downloadwordpress-prototype-build-pr20549-e46b23e.apk
Note: Google Login is not supported on these builds.
wpmobilebot commented 1 month ago
Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20549-e46b23e
Commite46b23e231f5e96b4b3b8c988d23a434dd25da9d
Direct Downloadjetpack-prototype-build-pr20549-e46b23e.apk
Note: Google Login is not supported on these builds.
codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 40.25%. Comparing base (084b2c5) to head (e46b23e). Report is 6 commits behind head on trunk.

Files Patch % Lines
...wordpress/android/ui/engagement/GetLikesUseCase.kt 75.00% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## trunk #20549 +/- ## ======================================= Coverage 40.24% 40.25% ======================================= Files 1463 1463 Lines 67596 67597 +1 Branches 11201 11201 ======================================= + Hits 27207 27208 +1 Misses 37928 37928 Partials 2461 2461 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.