-
Notifications
You must be signed in to change notification settings - Fork 61
feat: Add Auto Picture-in-Picture Feature and Refactor Favicon Handling #146
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
Conversation
- Introduced a new setting for enabling/disabling automatic Picture-in-Picture (PiP) mode on tab switch. - Updated SettingsStore to manage the autoPiPEnabled state and persist it. - Enhanced GeneralSettingsView to include a toggle for the auto PiP feature. - Modified TabManager to trigger PiP when switching to a new tab if the setting is enabled. - Implemented JavaScript function to handle PiP requests in WebViewNavigationDelegate.
- Updated Tab model to synchronize title changes with the media controller when a tab's title is set. - Refactored favicon handling in MediaPlayerCard to use AsyncImage for improved loading and display. - Modified FaviconService to cache favicons more efficiently and updated the favicon URL size for better resolution. - Enhanced MediaController to track whether media sessions were played and filter visible sessions accordingly. - Implemented session removal logic in TabManager to ensure proper cleanup of media sessions when tabs are closed. - Improved JavaScript integration for media state tracking, including handling of media play events and title updates.
- Aligned whitespace in the Tab model for better readability. - Updated favicon handling in FaviconService to streamline fetching and caching logic. - Introduced a new method for generating favicon URLs, enhancing maintainability. - Improved asynchronous favicon fetching with better error handling and completion callbacks. - Enhanced the average color computation for favicons to ensure accurate color representation.
- Updated instances of FaviconService to use the shared singleton instance across multiple files for consistency and improved memory management. - Removed unnecessary faviconService parameters from functions in SearchEngine and LauncherView to streamline code. - Cleaned up code by eliminating redundant faviconService declarations in various views.
- Updated opacity handling in BrowserSplitView to use a more concise comparison for active tab identification. - Added allowsHitTesting modifier to ensure user interactions are only enabled for the active tab, improving user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an auto picture-in-picture feature for video content with settings integration, refactors the FaviconService to use a shared singleton instance, and improves media handling across the application.
- Enhanced media tracking with "wasPlayed" state for better session filtering
- Added auto picture-in-picture functionality that activates when switching tabs
- Refactored FaviconService to use a shared singleton pattern for better performance
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| WebViewNavigationDelegate.swift | Added PiP trigger function and media element removal tracking |
| TabManager.swift | Integrated auto PiP feature with tab switching logic |
| MediaController.swift | Enhanced session tracking with wasPlayed state and improved title synchronization |
| FaviconService.swift | Refactored to singleton pattern and added favicon download functionality |
| GeneralSettingsView.swift | Added auto PiP toggle setting |
| Multiple UI files | Updated to use shared FaviconService instance |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ng (#146) * Add Auto Picture-in-Picture Feature and Settings Integration - Introduced a new setting for enabling/disabling automatic Picture-in-Picture (PiP) mode on tab switch. - Updated SettingsStore to manage the autoPiPEnabled state and persist it. - Enhanced GeneralSettingsView to include a toggle for the auto PiP feature. - Modified TabManager to trigger PiP when switching to a new tab if the setting is enabled. - Implemented JavaScript function to handle PiP requests in WebViewNavigationDelegate. * Enhance Media Playback Management and Favicon Handling - Updated Tab model to synchronize title changes with the media controller when a tab's title is set. - Refactored favicon handling in MediaPlayerCard to use AsyncImage for improved loading and display. - Modified FaviconService to cache favicons more efficiently and updated the favicon URL size for better resolution. - Enhanced MediaController to track whether media sessions were played and filter visible sessions accordingly. - Implemented session removal logic in TabManager to ensure proper cleanup of media sessions when tabs are closed. - Improved JavaScript integration for media state tracking, including handling of media play events and title updates. * Refactor Tab and Favicon Handling for Improved Code Clarity - Aligned whitespace in the Tab model for better readability. - Updated favicon handling in FaviconService to streamline fetching and caching logic. - Introduced a new method for generating favicon URLs, enhancing maintainability. - Improved asynchronous favicon fetching with better error handling and completion callbacks. - Enhanced the average color computation for favicons to ensure accurate color representation. * Refactor Favicon Handling to Use Shared Instance - Updated instances of FaviconService to use the shared singleton instance across multiple files for consistency and improved memory management. - Removed unnecessary faviconService parameters from functions in SearchEngine and LauncherView to streamline code. - Cleaned up code by eliminating redundant faviconService declarations in various views. * Enhance BrowserSplitView Opacity and Hit Testing Logic - Updated opacity handling in BrowserSplitView to use a more concise comparison for active tab identification. - Added allowsHitTesting modifier to ensure user interactions are only enabled for the active tab, improving user experience. * Fix Typo in FaviconService Completion Handler * chore: swiftformat --------- Co-authored-by: yonaries <[email protected]>
Summary