Conversation
- Implemented WBlockZapperInjector class to manage the injection of the zapper interface into web pages. - Added message handling for communication between the main script and the zapper interface. - Created an iframe to host the zapper UI and handle user interactions for hiding elements. - Developed CSS and JavaScript for the zapper interface, including element selection, rule saving, and application. - Integrated localStorage for persistent rule management across sessions. - Enabled keyboard shortcuts for quick activation of the zapper.
…persistent rule handling
…tion functionality
…improved CSS selector suggestions
Removed redundant or legacy security entitlements from all .entitlements files, consolidating permissions. Updated project.pbxproj to set sandbox, network, and file access via build settings instead of entitlements, and enabled dead code stripping. Also updated Xcode scheme and workspace files to reflect the latest Xcode version.
Replaces unnecessary MainActor.run calls with direct property access for currentPlatform and filterLists, improving clarity and thread safety. Refactors variable naming for clarity in FilterListUpdater and fixes an actor method call in ConcurrentLogManager. Also updates UI logic to remove unnecessary async/await in ContentView and UpdatePopupView.
There was a problem hiding this comment.
Summary of Changes
Hello @0xCUB3, 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 significantly enhances the application's content filtering capabilities by introducing an interactive 'Element Zapper' feature. Users can now directly hide specific elements on web pages, and these custom rules are saved per-site for persistent application. The feature is seamlessly integrated into the existing UI and relies on a robust communication architecture between the Safari extension and the web page's content. Additionally, the project's build configurations have been updated for improved performance and compatibility.
Highlights
- New Feature: Element Zapper: This pull request introduces an interactive 'Element Zapper' tool, allowing users to select and hide unwanted elements directly on web pages. This provides a highly customizable content filtering experience.
- Persistent Custom Rules: User-defined element hiding rules are now persistently stored for each website, ensuring that unwanted elements remain hidden across browsing sessions without manual re-application.
- Integrated User Interface: A new 'Element Zapper' button and a 'Zapper Rules' management section have been added to the application's popover, providing a clear and accessible way for users to activate and manage their custom rules.
- Enhanced Cross-Process Communication: The implementation includes a sophisticated communication bridge between the Safari extension's Swift code, the main content script, and an injected iframe, enabling seamless interaction and data persistence for the zapper functionality.
- Build System Modernization: Various Xcode project settings, including entitlements and build configurations, have been updated to align with newer Xcode versions, optimize builds (e.g., dead code stripping), and explicitly configure sandbox permissions within the project file.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'Element Zapper' feature, allowing users to visually select and hide elements on web pages. The implementation includes UI changes in SwiftUI, view model logic, a Safari extension handler, and significant JavaScript for the in-page tool. While the feature is comprehensive, the review identified several critical and high-severity issues. These include a potential crash in the UI due to unsafe collection handling, a critical concurrency bug in the logging mechanism, insecure use of localStorage for storing rules, and significant maintainability problems due to large blocks of code being embedded as strings. Several medium-severity issues related to performance, modern API usage, and code cleanliness were also noted.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the "Element Zapper" feature. The Swift-side changes, especially the refactoring to use modern concurrency with async/await, are well done.
However, the JavaScript implementation of the zapper has some architectural issues. There appear to be multiple, conflicting implementations of the zapper logic across different files (element-zapper.js, element-zapper-complete.js, and a large embedded string in script.js). This makes the code confusing and hard to maintain.
My main concerns are:
- The embedding of a very large JavaScript class as a string literal in
script.js. - The presence of extensive debugging code in
script.jsthat should be conditionally compiled. - The use of the deprecated
synchronize()method forUserDefaults.
I recommend unifying the zapper implementation into a single, clean approach and addressing the other points to improve code quality and maintainability.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
No description provided.