-
Notifications
You must be signed in to change notification settings - Fork 1.1k
SERP Settings Sync: Add event when Duck Ai setting changed #7052
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
SERP Settings Sync: Add event when Duck Ai setting changed #7052
Conversation
e58b586 to
31ad0bd
Compare
marcosholgado
left a comment
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.
LGTM and pre-approving. Two things before merging:
- Needs tests
- The events are sent even if the serp settings sync feature flag is disabled which I guess is wrong?
31ad0bd to
c85fcc2
Compare
Tested and works as expected. |
c85fcc2 to
b9538f5
Compare
…terface and point
…nEventPlugin for nativeDuckAiSettingChanged
…serTabFragment and ViewModel We create a new channel so subscriptionEventData events are not lost
…ebViewActivity and ViewModel Same as BrowserTabViewModel and Activity
b9538f5 to
62f1e89
Compare
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 introduces a plugin system for sending subscription events from content scope scripts to web views in both the Settings and Browser contexts. The implementation enables SERP settings synchronization through a feature-flagged subscription event mechanism.
Key changes:
- New plugin interface (
ContentScopeScriptsSubscriptionEventPlugin) for providing subscription event data - Integration in both
SettingsWebViewViewModelandBrowserTabViewModelto process and emit subscription events - DuckChat implementation providing enabled state through the new plugin system
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ContentScopeScriptsSubscriptionEventPlugin.kt | Defines plugin interface for subscription events |
| ContentScopeScriptsSubscriptionEventPluginPoint.kt | Plugin point for subscription event plugins |
| DuckChatContentScopeJsMessageHandler.kt | Implements plugin to provide DuckChat enabled state |
| SettingsWebViewViewModel.kt | Processes plugins and emits subscription events on resume |
| SettingsWebViewActivity.kt | Observes subscription events and sends to content scope scripts |
| BrowserTabViewModel.kt | Similar subscription event processing in browser context |
| BrowserTabFragment.kt | Observes and forwards subscription events in browser |
| SettingsWebViewViewModelTest.kt | Test coverage for settings subscription events |
| BrowserTabViewModelTest.kt | Test coverage for browser subscription events |
| BrowserViewModel.kt | Removed unused DuckChat dependency |
| BrowserViewModelTest.kt | Removed unused DuckChat mock |
...a/com/duckduckgo/contentscopescripts/impl/ContentScopeScriptsSubscriptionEventPluginPoint.kt
Outdated
Show resolved
Hide resolved
...ngs/settings-impl/src/test/java/com/duckduckgo/settings/impl/SettingsWebViewViewModelTest.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt
Outdated
Show resolved
Hide resolved
...in/java/com/duckduckgo/contentscopescripts/api/ContentScopeScriptsSubscriptionEventPlugin.kt
Outdated
Show resolved
Hide resolved
settings/settings-impl/src/main/java/com/duckduckgo/settings/impl/SettingsWebViewViewModel.kt
Show resolved
Hide resolved
187cef7 to
146e33c
Compare
Task/Issue URL: https://app.asana.com/1/137249556945/project/1207908166761516/task/1211756086814103?focus=true
Description
Added support for sending subscription events to ContentScopeScripts. This enables real-time updates to the SERP settings when DuckChat settings change. The implementation includes:
ContentScopeScriptsSubscriptionEventPlugininterface to allow features to provide subscription event dataSteps to test this PR
DuckChat Settings Sync from Browser
serpSettingsSync feature toggleDuckChat Settings Sync from SettingsWebView
serpSettingsSync feature toggleUI changes
N/A