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

Extract the logic from MediaRouteChooserDialog #34

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MGaetan89
Copy link
Member

@MGaetan89 MGaetan89 commented Feb 19, 2025

Description

This PR extracts all the logic from MediaRouteChooserDialog into a dedicated ViewModel. This greatly simplifies the Compose code and eases testing of the logic.

Changes made

  • Move logic from MediaRouteChooserDialog to MediaRouteChooserDialogViewModel.
  • Create a TestMediaRouteProvider class to provide fake routes.
  • Improve support on rotation so the state is not reset.
  • Add tests to MediaRouteChooserDialogViewModel.
  • Update Kover exclusion rules to ignore the Icons class, since it's a copy/paste from Compose Material.
  • Update the "Release" badge in the README.md file to allow pre-releases:
Before After
Screenshot 2025-02-21 at 07 58 23 Screenshot 2025-02-21 at 07 57 10

@MGaetan89 MGaetan89 requested a review from StaehliJ February 19, 2025 16:05
@MGaetan89 MGaetan89 self-assigned this Feb 19, 2025
@MGaetan89 MGaetan89 linked an issue Feb 19, 2025 that may be closed by this pull request
Copy link

github-actions bot commented Feb 19, 2025

Code Coverage

Overall Project 20.32% -8.44% 🟢
Files changed 52.59% 🟢

File Coverage
MediaRouteChooserDialogViewModel.kt 94.12% -5.88% 🟢
MediaRouteButtonViewModel.kt 93.22% 🟢
MediaRouteChooserDialog.kt 0% -42.25% 🟢

@MGaetan89 MGaetan89 force-pushed the 24-mediaroutechooserdialog-extract-the-logic-from-the-composables branch from db32d2b to bac973b Compare February 20, 2025 14:44
@MGaetan89
Copy link
Member Author

I've addressed the points we discussed this morning:

  • The state is now preserved upon rotation.
  • Changing the locale works as expected.

@MGaetan89 MGaetan89 force-pushed the 24-mediaroutechooserdialog-extract-the-logic-from-the-composables branch from 5ce01a9 to 26df02a Compare February 21, 2025 13:40
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.

[MediaRouteChooserDialog] Extract the logic from the Composables
1 participant