Skip to content

Refactor: Consolidate _openCategory() Methods into Unified Dialog #491

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 2 commits into from
Jun 19, 2025

Conversation

NBA2K1
Copy link
Contributor

@NBA2K1 NBA2K1 commented Jun 16, 2025

Summary:
Replaced three separate _openCategory() implementations with a single, flexible showCategorySelectionDialog() function.

Details:
Previously, there were three distinct _openCategory() methods used in different contexts (bulk manga selection, single manga update, and library addition). All three shared nearly identical UI logic and structure, leading to duplicated code and maintenance complexity.

This PR introduces showCategorySelectionDialog(), a unified, parameterized function that:

  • Supports both single manga and bulk manga inputs via assertion logic
  • Conditionally shows/hides hidden categories (just like before, shows hidden categories, when adding to library)
  • Replaces all redundant methods with a reusable, streamlined implementation

Benefits:

  • Simplifies codebase by removing duplication
  • Improves maintainability and readability
  • Reduces future bugs due to logic divergence

Testing:

  • Verified behavior with both single manga updates and bulk selection
  • Ensured sync operations are preserved for both update and add scenarios
  • Confirmed categories render and update as expected in all entry points

NBA2K1 added 2 commits June 16, 2025 01:50
Not needed for this dialog, as the items here are already in the library (favorite = true) and dateAdded don't have to be updated.
@kodjodevf kodjodevf merged commit e635e49 into kodjodevf:main Jun 19, 2025
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