Skip to content

Fixes#77

Merged
phoneuooyd merged 10 commits intomainfrom
Fixes
Aug 29, 2025
Merged

Fixes#77
phoneuooyd merged 10 commits intomainfrom
Fixes

Conversation

@phoneuooyd
Copy link
Owner

This pull request introduces significant improvements to the application's database reliability, data seeding performance, and UI theming. The most notable changes include the addition of robust database migration and schema validation logic, batching for ingredient seeding, theme-aware color logic in converters, and new value converters for UI binding. Below are the most important changes grouped by theme:

Database Migration, Validation, and Seeding Improvements

  • Added comprehensive methods for database migration, schema validation, and full database reset in MauiProgram.cs, including logic to validate table schemas, add missing columns, manage schema versions, and apply migrations safely. This ensures the database structure is always up-to-date and resilient to schema drift. [1] [2]
  • Optimized ingredient seeding in SeedData.cs by batching inserts for better performance and UI responsiveness, and improved logging for batch progress and errors.
  • Set a shorter HTTP timeout (10 seconds) for OpenFoodFacts API calls to make ingredient data updates more responsive.
  • Increased the update threshold for ingredient nutrition fields to 0.5 (from 0.1) to avoid unnecessary updates for minor differences, and improved logging for update actions and errors.

UI and Theming Enhancements

  • Updated BoolToColorConverter to provide theme-aware color responses for various UI elements, including text, tab backgrounds, and borders, ensuring consistent appearance in both light and dark modes.
  • Added new colors, such as SecondaryDark, to the color resources for improved dark mode support.

Converters and Styles

  • Introduced a new IsNotNullOrEmptyConverter for use in XAML bindings, and registered multiple converters in Styles.xaml for streamlined UI development. [1] [2]

Introduces caching for ingredients in IngredientService and AddRecipeViewModel to reduce database calls and improve performance. Adds cache invalidation after ingredient modifications and debounced nutritional value calculations to prevent redundant computations during rapid changes. Updates AddRecipePage to use debounced async recalculation, and refactors related methods to leverage the new caching and debouncing mechanisms.
Introduces async database migration and reset logic in MauiProgram and exposes them via new commands in SettingsViewModel. Updates SettingsPage UI to provide migration and reset controls with status feedback, adds related styles, and integrates new converters. Also improves AddRecipeViewModel validation and logging, and minor style/color resource updates.
Updated BoolToColorConverter to provide theme-aware colors for text, borders, and backgrounds, supporting both light and dark modes. Refactored AddRecipePage.xaml and IngredientFormPage.xaml to use a modern tab bar style with underline indicators, improved color handling, and increased tab button font size for better usability and visual consistency.
Replaced the default SearchBar on IngredientsPage and RecipesPage with a custom modern search bar using Frame, Entry, and a clear button. Added new styles for the modern search bar components in Styles.xaml. Introduced ClearSearchCommand in both IngredientsViewModel and RecipeViewModel to support clearing the search text.
Introduced a reusable FloatingActionButton style in Styles.xaml and replaced the top action buttons on IngredientsPage and RecipesPage with floating action buttons. Updated the RecipesPage code-behind to remove the now-unnecessary OnAddRecipeClicked handler, switching to command-based navigation for consistency.
Introduced reusable styles for list items, nutrition info, and delete buttons in Styles.xaml. Refactored IngredientsPage.xaml and RecipesPage.xaml to use these styles, improving visual consistency and maintainability across the app.
@phoneuooyd phoneuooyd self-assigned this Aug 29, 2025
@phoneuooyd phoneuooyd merged commit 5a85942 into main Aug 29, 2025
1 check passed
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.

1 participant