Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feat/fix local ads archiving undo #87

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
fulleni merged 12 commits into main from feat/fix-local-ads-archiving-undo
Sep 24, 2025
Merged

Conversation

@fulleni
Copy link
Member

@fulleni fulleni commented Sep 24, 2025
edited
Loading

Status

READY

Description

This pull request implements a significant refactoring of the local ads archiving feature, specifically enhancing the undo deletion mechanism. By introducing a dedicated PendingDeletionsService, the logic for managing temporary deletions with timed undo capabilities is centralized. This change simplifies the ArchiveLocalAdsBloc, making it more focused on state management rather than orchestrating deletion timers, and provides a more robust and consistent user experience for undoing archived ad deletions.

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

...bar functionality
- Remove lastDeletedLocalAd field and related logic
- Add lastPendingDeletionId and snackbarLocalAdTitle fields
- Update copyWith method to accommodate new fields
- Adjust equality and hashCode methods for new state structure
- Rename and restructure the _ConfirmDeleteLocalAdRequested event
- Implement a new _DeletionServiceStatusChanged event to handle updates from the pending deletions service
... undo functionality
- Replace local delete timer with PendingDeletionsService for managing pending deletions
- Update BLoC to handle deletion events from PendingDeletionsService
- Modify state to include last pending deletion ID and snackbar ad title
- Refactor deletion and undo logic to use the new service
- Update comments and documentation to reflect changes
...tionality
- Introduce PendingDeletionsService for better undo management
- Simplify snackbar logic in ArchivedLocalAdsPage
- Update ArchiveLocalAdsBloc to use pending deletions service
- Remove unnecessary null assignment for 'exception' and 'restoredLocalAd'
- Simplify state copying by removing redundant code
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 implements a significant refactoring of the local ads archiving feature, specifically enhancing the undo deletion mechanism. By introducing a dedicated PendingDeletionsService, the logic for managing temporary deletions with timed undo capabilities is centralized. This change simplifies the ArchiveLocalAdsBloc, making it more focused on state management rather than orchestrating deletion timers, and provides a more robust and consistent user experience for undoing archived ad deletions.

Highlights

  • Centralized Deletion Logic: The pull request introduces and integrates a PendingDeletionsService to centralize the management of timed deletions and undo functionality for archived local ads, moving this logic out of the BLoC.
  • BLoC Refactoring: The ArchiveLocalAdsBloc has been significantly refactored to delegate deletion and undo operations to the new PendingDeletionsService, removing internal timers and direct repository calls for delayed deletions.
  • Improved Undo Mechanism: The undo functionality is now handled by the PendingDeletionsService, which emits events that the BLoC listens to, ensuring a more robust and consistent undo experience across the application.
  • State Management Updates: The ArchiveLocalAdsState has been updated to remove lastDeletedLocalAd and introduce lastPendingDeletionId and snackbarLocalAdTitle for better UI feedback and state tracking of pending deletions.
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 refactors the "delete forever" functionality for archived local ads by introducing a reusable PendingDeletionsService, which is a great improvement for centralizing the undo logic. The changes in the ArchiveLocalAdsBloc and its related state and event files are mostly well-executed to support this new service. My review includes a critical issue regarding potential state corruption in copyWith, a high-severity issue about a functional regression where the archived list may become stale, and several medium-severity suggestions to improve code maintainability and adhere to common architectural patterns.

- Update the ArchiveLocalAdsState.copyWith constructor to properly handle null values for exception, restoredLocalAd, lastPendingDeletionId, and snackbarLocalAdTitle properties.
- This change prevents potential null dereference errors when these properties are not explicitly provided when copying the state.
- Remove direct dependency on PendingDeletionsService
- Use ArchiveLocalAdsBloc to handle undo delete action
- Improve adherence to business logic separation principles
- Remove unnecessary `restoredLocalAd` updates in multiple states
- This change simplifies the state management and improves performance
- Remove restoredLocalAd field from ArchiveLocalAdsState
- Adjust copyWith method to remove restoredLocalAd parameter
- Update ArchiveLocalAdsStateProps to exclude restoredLocalAd
... error
- Replace context.read in SnackBar action with direct service call
- Remove unnecessary state check for restoredLocalAd
- Update BlocListener to avoid redundant UI updates
@fulleni fulleni merged commit 029fbdf into main Sep 24, 2025
1 check failed
@fulleni fulleni deleted the feat/fix-local-ads-archiving-undo branch September 24, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /