Skip to content

Conversation

@fulleni
Copy link
Member

@fulleni fulleni commented Sep 26, 2025

Status

READY

Description

This pull request introduces a significant refactor and enhancement to the local ads management structure and user interface. The changes aim to provide a more intuitive and efficient experience for managing various ad types, streamline the ad creation and deletion processes, and improve overall UI responsiveness and clarity.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

…ibility

- Change the title text from "enableInArticleAdsForRoleLabel" to "visibleToRoleLabel"
- This update improves clarity in the article ad settings form
- Change horizontal margin from medium to small in headlines_page.dart
- Change column spacing and horizontal margin from medium to small in sources_page.dart and topics_page.dart
- Remove source type column in sources_page.dart when on mobile view
- Adjust spacing in various data table configurations
- Added Arabic translations for new strings related to AdMob filtering and loading states
- Translated terms for different ad types (native, banner, interstitial, video)
- Included translations for search functionality and column headers
- Remove AdType from LoadLocalAdsRequested, ArchiveLocalAdRequested, and RestoreLocalAdRequested events
- Add filter option to LoadLocalAdsRequested event
- Implement DeletionEventReceived event for handling deletion events from PendingDeletionsService
- Update props list for affected events
- Remove UndoDeleteLocalAdRequested event
…barMessage

- Remove lastDeletedLocalAd property from LocalAdsManagementState
- Add snackbarMessage property for displaying transient messages
- Update copyWith method to accommodate the new snackbarMessage property
- Adjust props list to include snackbarMessage instead of lastDeletedLocalAd
- Implement undoable deletions using PendingDeletionsService
- Add real-time filtering functionality
- Enhance UI/UX with snackbar messages for actions
- Optimize code structure and improve readability
- Add FilterLocalAdsBloc to manage the state of local ads filter UI
- Implement event handlers for search query, status, and ad type changes
- Add logic to apply and reset filters
- Include a debounce transformer for search input
- Add FilterLocalAdsEvent base class
- Implement individual events for search query change, status change, ad type change, applying filters, and resetting filters
- Ensure proper Equatable implementation for each event
- Define FilterLocalAdsStatus enum to represent operation states
- Implement FilterLocalAdsState class with properties for status, exception, search query, selected status, and selected ad type
- Include copyWith method for state immutability
- Add Equatable props for state comparison
- Implement BannerAdsPage for displaying and managing banner ads
- Add functionality to load, filter, and paginate banner ads
- Include options to copy ad ID, edit, and archive ads
- Handle loading, empty, and error states
- Implement InterstitialAdsPage for displaying and managing interstitial ads
- Add pagination, filtering, and sorting functionality
- Include actions for copying ad ID, editing, and archiving ads
- Handle loading, empty, and error states
- Update UI components for better usability and responsiveness
- Replace monolithic LocalAdsManagementPage with individual pages for each ad type
- Add FilterLocalAdsBloc for handling ad filters
- Implement snackbar undo functionality for deleted ads
- Update UI to use separate pages for Native, Banner, Interstitial, and Video ads
- Add NativeAdsPage widget for displaying and managing native ads
- Implement pagination and filtering functionality
- Include actions for copying ad ID, editing, and archiving ads
- Handle loading, empty, and error states
- Use BlocBuilder for state management
- Add localization support
- Implement VideoAdsPage for displaying and managing video ads
- Add functionality to load, filter, and paginate video ads
- Include options to copy ad ID, edit, and archive ads
- Handle loading, error, and empty states
- Implement LocalAdsFilterDialog widget for applying filters to local ads lists
- Add BlocBuilder for LocalAdsFilterDialogBloc to manage filter states
- Include search functionality and filter chips for content status and ad type
- Implement reset and apply filters actions
- Add new BLoC to manage state and logic for LocalAdsFilterDialog
- Implement event handlers for filter initialization, search query change, status change, ad type change, and reset
- Use debounce transformer for search query changes
- Update state based on current filter selections
- Define sealed class LocalAdsFilterDialogEvent
- Add LocalAdsFilterDialogInitialized event for filter dialog initialization
- Implement LocalAdsFilterDialogSearchQueryChanged for updating search query
- Create LocalAdsFilterDialogStatusChanged for changing content status
- Add LocalAdsFilterDialogAdTypeChanged event for selecting ad type
- Include LocalAdsFilterDialogReset to reset filter selections
- Define LocalAdsFilterDialogStatus enum for dialog operation states
- Implement LocalAdsFilterDialogState class with properties for status, exception, search query, selected status, and selected ad type
- Include copyWith method for creating updated state instances
- Add Equatable implementation for state comparison
- Import FilterLocalAdsBloc from local_ads_management/bloc
- Add BlocProvider for FilterLocalAdsBloc in the app's provider list
- Replace archived local ads page route with a more generic local ads filter dialog route
- Update import statements to include new bloc and dialog classes
- Add new route for local ads filter dialog with page builder
- Update routes.dart to reflect changes in route names and paths
… or restore

- Add LoadLocalAdsRequested event after successfully archiving or restoring local ads
- This ensures the UI is updated immediately to reflect the changed status of the ads
- Helps users see the results of their actions more quickly and improves overall user experience
- Remove direct implementation of action buttons in banner ads page
- Replace with LocalAdActionButtons widget import and usage
- Simplify code and improve maintainability by using a dedicated widget
- Replace inline ad action buttons with LocalAdActionButtons widget
- Remove unnecessary imports
- Add comments for clarity
- Minor code formatting and cleanup
- Add local_ad_action_buttons widget for ad item actions
- Implement filter logic specific to native ads
- Display no results message and reset filters button when no ads found
- Remove unused imports and update routes
- Replace ad action buttons with LocalAdActionButtons widget
- Remove unused imports
- Simplify code structure
- Improve readability and maintainability
- Implement LocalAdActionButtons widget for displaying action buttons related to local ad items.
- The widget supports different local ad types (Native, Banner, Interstitial, Video) and their statuses.
- Features include editing ads and performing status transitions (publish, archive, restore, delete).
- Utilizes GoRouter for navigation to edit screens.
- Follows the design pattern of ContentActionButtons for content management items.
- Removed `filterLocalAdsBloc` parameter from `LocalAdsFilterDialogBloc` constructor
- Deleted `_filterLocalAdsBloc` class member variable
- Updated constructor to use simple syntax
- Remove explicit constructor parameters for LocalAdsFilterDialogBloc
- Keep using default constructor and chaining init method call
- Add import for LocalAdsManagementBloc
- Implement LocalAdsManagementBloc in App widget
- Provide necessary dependencies for LocalAdsManagementBloc
- Remove unnecessary selectedAdType parameter from FilterLocalAdsState
- Add currentAdType parameter to buildLocalAdsFilterMap method
- Update adType parameter in LoadLocalAdsRequested event
- Adjust _areFiltersActive method to remove selectedAdType check
- Add "Copy ID" option to the overflow menu for active ads
- Implement functionality to copy ad ID to clipboard
- Display snackbar confirmation after copying ID
…dialog

- Remove ad type filter functionality from LocalAdsFilterDialog
- Delete ad type filter chips and related logic
- Update dialog documentation to reflect removal of ad type filter
- Adjust layout by removing spacing and section related to ad type filter
- Remove LocalAdsFilterDialogAdTypeChanged event handler
- Remove selectedAdType property from LocalAdsFilterDialogState
- Remove ad type related code from the bloc
…rstitial ads

- Add CreateLocalInterstitialAdSavedAsDraft event for saving ads as drafts
- Add CreateLocalInterstitialAdPublished event for publishing ads
- Remove unnecessary CreateLocalInterstitialAdSubmitted event
…ialAdState

- Add ContentStatus enum to track ad status (draft or active)
- Update CreateLocalInterstitialAdState constructor and copyWith method
- Include contentStatus in the list of properties for Equatable
…cal interstitial ads

- Remove _onSubmitted handler
- Add _onSavedAsDraft handler for saving ad as a draft
- Add _onPublished handler for publishing ad
- Update event names in CreateLocalInterstitialAdBloc class
…g video ad

- Introduce CreateLocalVideoAdSavedAsDraft event for saving video ad as draft
- Introduce CreateLocalVideoAdPublished event for publishing video ad
- Remove unnecessary CreateLocalVideoAdSubmitted event
…tate

- Add ContentStatus enum to track draft or active state of the ad
- Include contentStatus in CreateLocalVideoAdState properties
- Update copyWith method to support contentStatus
- Set default contentStatus to ContentStatus.draft in constructor
…cal video ads

- Replace CreateLocalVideoAdSubmitted event with CreateLocalVideoAdSavedAsDraft and CreateLocalVideoAdPublished events
- Implement _onSavedAsDraft method to handle saving local video ads as drafts
- Implement _onPublished method to handle publishing local video ads
- Update event handlers to set appropriate statuses and handle exceptions
…l banner ads

- Introduce CreateLocalBannerAdSavedAsDraft event for saving ads as drafts
- Introduce CreateLocalBannerAdPublished event for publishing ads
- Remove unnecessary CreateLocalBannerAdSubmitted event
…tate

- Add ContentStatus enum to track draft or active state of the ad
- Include contentStatus in CreateLocalBannerAdState properties
- Update copyWith method to support contentStatus
- Set default contentStatus to ContentStatus.draft in constructor
…ionalities

- Add CreateLocalBannerAdSavedAsDraft and CreateLocalBannerAdPublished events
- Implement _onSavedAsDraft and _onPublished event handlers
- Update CreateLocalBannerAdStatus to include draft and published states
- Modify CreateLocalBannerAdBloc to handle new events
…g native ad

- Introduce CreateLocalNativeAdSavedAsDraft event for saving native ad as a draft
- Add CreateLocalNativeAdPublished event for publishing native ad
- Remove unnecessary CreateLocalNativeAdSubmitted event
…state

- Add ContentStatus enum to track draft or active state of the ad
- Update CreateLocalNativeAdState with contentStatus field and default value
- Modify copyWith method to include contentStatus parameter
- Update props list to include contentStatus for equality checks
…ionalities

- Replace CreateLocalNativeAdSubmitted event handler with two new handlers
- Add CreateLocalNativeAdSavedAsDraft event handler
- Add CreateLocalNativeAdPublished event handler
- Implement logic to save local native ad as a draft
- Implement logic to publish local native ad
- Update state management for both saving as draft and publishing actions
- Implement a dialog to choose between publishing or saving as draft
- Update save button functionality to use the new dialog
- Add new events to CreateLocalBannerAdBloc for publishing and saving as draft
…ft or publish

- Implement a dialog to let users choose between saving as a draft or publishing the ad
- Update save button functionality to handle both draft and publish actions
- Add new events to CreateLocalInterstitialAdBloc for handling draft and publish actions
- Implement dialog for choosing between publishing or saving as draft
- Update save button functionality to handle both options
- Add new events to CreateLocalNativeAdBloc for publishing and saving as draft
- Implement a dialog to choose between publishing or saving as draft
- Update save button functionality to handle both options
- Add new events to CreateLocalVideoAdBloc for publishing and saving as draft
- Add Arabic translations for saveAdTitle and saveAdMessage in app_ar.arb
- Add English translations for saveAdTitle and saveAdMessage in app_en.arb
- Change ArchiveLocalAdRequested to RestoreLocalAdRequested when clicking
- Ensure correct action is performed when user clicks on the restore button
- Import shared resources for AboutIcon usage
- Add AboutIcon to AppBar title row
- Set tooltip and description for AboutIcon using localization strings
- Set the icon color to primary in both leadingUnextendedNavRail and leadingExtendedNavRail
- Remove unnecessary text color override in leadingExtendedNavRail
@gemini-code-assist
Copy link

Summary of Changes

Hello @fulleni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant refactor and enhancement to the local ads management structure and user interface. The changes aim to provide a more intuitive and efficient experience for managing various ad types, streamline the ad creation and deletion processes, and improve overall UI responsiveness and clarity.

Highlights

  • Modular UI for Local Ads: The local ads management section has been completely overhauled with dedicated pages for Native, Banner, Interstitial, and Video ad types. This replaces the previous single generic table, providing a more organized and scalable interface.
  • Enhanced Ad Creation Workflow: When creating new local ads, users now have the option to save them as a draft or publish them directly, facilitated by a new dialog. This improves flexibility in managing ad content lifecycle.
  • Centralized Filtering System: A new FilterLocalAdsBloc and a dedicated filter dialog have been introduced, allowing users to search and filter local ads by title/URL and content status. This significantly improves discoverability and management of ads.
  • Refactored Deletion Logic: The handling of ad deletions has been refactored to integrate with the PendingDeletionsService. This provides optimistic UI updates and an 'undo' functionality for deleted ads, removing the need for a separate archived ads page.
  • Improved Localization Support: Numerous new localization keys have been added to support the new ad management features, filtering options, and UI elements, ensuring a consistent and localized user experience.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant and well-executed refactoring of the local ads management feature. The consolidation of state management into a single LocalAdsManagementBloc, the removal of the separate Archive BLoC and page, and the introduction of a dedicated FilterLocalAdsBloc with a corresponding filter dialog are excellent improvements that enhance the structure and maintainability of the feature. The UI has also been nicely overhauled to use a TabBarView with separate pages for each ad type, which is a cleaner approach.

My feedback focuses on a few key areas to further improve the code quality:

  • Refactoring duplicated logic in the CreateLocal...AdBloc files to improve maintainability.
  • Enhancing the robustness of the deletion snackbar logic by decoupling the BLoC from UI-specific string formatting.
  • Ensuring consistency in localization files.

@fulleni fulleni merged commit 9d582f7 into main Sep 26, 2025
1 check failed
@fulleni fulleni deleted the refactor/local-ads-management-structure-enhancement-and-ui-overhaul branch September 26, 2025 19:56
@fulleni fulleni added this to the Foundation Edition milestone Nov 1, 2025
@fulleni fulleni self-assigned this Nov 1, 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