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

refactor: refactor WelcomeActivity and associated logic #6996

Merged
merged 7 commits into from
Feb 5, 2025

Conversation

Pittvandewitt
Copy link
Contributor

This PR does several things to improve the code quality:

  • Perform Database and Network requests in the ViewModel to make it survive configuration changes
  • InstanceHelper is now a class and not an object to make it eligible for GC
  • IO work is ensured to be performed in the IO dispatcher by defining it at function level
  • Next button is enabled with enabled=true instead of setting alpha
  • WelcomeActivity UI state now survives process death
  • Preparations are made to not use context in the ViewModel (No AndroidViewModel)

As a side question, do you appreciate these kind of PRs or is it just distracting you from the vision you have with the project? If yes, I'll continue making more improvements across different parts of the codebase.

@Bnyro
Copy link
Member

Bnyro commented Jan 22, 2025

As a side question, do you appreciate these kind of PRs or is it just distracting you from the vision you have with the project? If yes, I'll continue making more improvements across different parts of the codebase.

I really appreciate such PRs honestly, the code base is quite old and partially uses some older libraries and components (e.g. com.android instead of androidx). Apart from that we do almost never separate UI logic and the connection to the data via view models, I've been planning to make more refactors to use ViewModels more and more for all data handling. I've already refactored few components, but it's gonna be a long ride.

I've recently been refactoring a lot of the internal code as well, e.g. the MediaService logic or the handling of different subscription and feed extraction methods to make it more robust. Most of my refactors are not UI-related though because I'm not really working with Android UI that much at all and thus lack knowledge about the current state of new androidx ways of doing things and other improvements in the Android ecosystem.

Currently I'm however looking into creating a new release soon and thus work on fixing the most critical bugs before making a new release, because a new release is necessary due to YouTube changes.

Therefore I already apologize now for the delay on reviewing requests, I'm mostly spending the time I work on LibreTube to prepare everything for a new release now.

@Pittvandewitt
Copy link
Contributor Author

Good to know! I'll happily make a PR from time to time refactoring a few components to better separate the logic, in similar fashion as this PR.

I agree releasing the update is of much higher priority right now, especially with the iOS player response error.

@Pittvandewitt Pittvandewitt marked this pull request as draft January 29, 2025 09:27
@Pittvandewitt Pittvandewitt marked this pull request as ready for review January 29, 2025 15:34
@Bnyro
Copy link
Member

Bnyro commented Feb 3, 2025

I've added a comment about one small regression, apart from that good to merge from my side 👍

@Pittvandewitt Pittvandewitt requested a review from Bnyro February 5, 2025 16:57
Copy link
Member

@Bnyro Bnyro left a comment

Choose a reason for hiding this comment

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

Thank you!

@Bnyro Bnyro changed the title Refactor WelcomeActivity and associated logic refactor: refactor WelcomeActivity and associated logic Feb 5, 2025
@Bnyro Bnyro merged commit 3a09869 into libre-tube:master Feb 5, 2025
2 of 3 checks passed
@Pittvandewitt Pittvandewitt deleted the refactor/welcome branch February 5, 2025 19:45
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.

2 participants