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

replace userManager.currentUser usage by currentUserProvider usage #4695

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

mahibi
Copy link
Collaborator

@mahibi mahibi commented Feb 6, 2025

userManager.currentUser was called too often which created a lot of DB queries. I was not able to prove that a bug is related to it but i think it may fix some hidden bugs.

CurrentUserProviderImpl is now used throughout the code to access the current user. userManager.currentUser is only used from CurrentUserProviderImpl whenever the _currentUser was null (should only happen on app startup)

To avoid multiple initialization of CurrentUserProviderImpl it was changed to be a @singleton

The handling should soon be replaced with coroutine flows. However for the v21.0.0 release it's still done with RxJava to avoid bugs.


please test by adding & removing users & try out different screens. App must not crash or show any strange behavior that could be related to the currentuser handling.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@mahibi mahibi added the 3. to review Waiting for reviews label Feb 6, 2025
@mahibi mahibi added this to the 21.1.0 milestone Feb 6, 2025
@mahibi mahibi self-assigned this Feb 6, 2025
@mahibi
Copy link
Collaborator Author

mahibi commented Feb 6, 2025

/backport to stable-21.0

@sowjanyakch sowjanyakch force-pushed the accessCurrentUserOnlyByCurrentUserprovider branch from a003abe to 62f97e1 Compare February 7, 2025 11:09
@sowjanyakch sowjanyakch enabled auto-merge February 7, 2025 11:27
userManager.currentUser was called too often. I was not able to prove that a bug is related to it but i think it may fix some hidden bugs.

CurrentUserProviderImpl is now used throughout the code to access the current user.
userManager.currentUser is only used from CurrentUserProviderImpl whenever the _currentUser was null (should only happen on app startup)

To avoid multiple initialization of CurrentUserProviderImpl it was changed to be a @singleton

The handling should soon be replaced with coroutine flows. However for the v21.0.0 release it's still done with RxJava to avoid bugs.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi force-pushed the accessCurrentUserOnlyByCurrentUserprovider branch from 62f97e1 to 5219eeb Compare February 7, 2025 12:15
Copy link
Contributor

github-actions bot commented Feb 7, 2025

Codacy

Lint

TypemasterPR
Warnings104104
Errors3636

SpotBugs

CategoryBaseNew
Bad practice66
Correctness222222
Dodgy code7171
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total310310

Copy link
Contributor

github-actions bot commented Feb 7, 2025

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4695-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@sowjanyakch sowjanyakch merged commit 40bcf74 into master Feb 7, 2025
17 checks passed
@sowjanyakch sowjanyakch deleted the accessCurrentUserOnlyByCurrentUserprovider branch February 7, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants