- Notifications
You must be signed in to change notification settings - Fork 1.1k
SERP Settings Sync: Add initial js message handlers #7013
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 initial js message handlers #7013
Conversation
413b71f to 17690e9 Compare …ttings synchronization
9ebdf81 to 8d6e583 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 implements SERP (Search Engine Results Page) settings synchronization between web-based DuckDuckGo search pages and the native Android app. It introduces message handlers for bidirectional communication about settings and AI feature states.
Key changes:
- Adds JS message handlers for getting, updating, and opening native settings from SERP pages
- Implements Duck.ai setting synchronization between native app and SERP
- Updates domain validation logic to support subdomain matching using TLD+1
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| UpdateNativeSettingsHandler.kt | Handler to persist SERP setting changes to native storage |
| OpenNativeSettingsHandler.kt | Handler to open native settings screens from SERP |
| GetNativeSettingsHandler.kt | Handler to retrieve stored native settings for SERP |
| NativeDuckAiSettingChangedHandler.kt | Subscription handler to push native Duck.ai setting changes to SERP |
| IsNativeDuckAiEnabledHandler.kt | Handler to query Duck.ai toggle state from SERP |
| ContentScopeScriptsJsMessaging.kt | Updates domain validation to support subdomains via TLD+1 matching |
| SettingsWebViewClient.kt | New WebView client to inject JS plugins for settings pages |
| SettingsWebViewActivity.kt | Wires up the new WebView client when feature is enabled |
| build.gradle | Adds duckchat-api dependency for Duck.ai settings access |
| *HandlerTest.kt files | Test files validating handler configurations |
| ContentScopeScriptsJsMessagingTest.kt | Tests for subdomain matching and null URL handling |
...pl/src/main/java/com/duckduckgo/duckchat/impl/messaging/NativeDuckAiSettingChangedHandler.kt Outdated Show resolved Hide resolved
...ain/java/com/duckduckgo/contentscopescripts/impl/messaging/ContentScopeScriptsJsMessaging.kt Show resolved Hide resolved
.../java/com/duckduckgo/settings/impl/serpsettings/messaging/UpdateNativeSettingsHandlerTest.kt Outdated Show resolved Hide resolved
This has been changed to check against the eTLD+1 of the URL which will allow us to more easily use test urls such as someperson.duckduckgo.com a form of `isUrlAllowed()` is already being used in SubscriptionMessagingInterface
b525fc3 to 19918fc Compare …om SERP Placeholder for now, adding persistence and the rest in another PR
19918fc to c41620e 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.
LGTM
| setSupportZoom(true) | ||
| } | ||
| | ||
| if (settingsPageFeature.serpSettingsSync().isEnabled()) { |
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.
You also will need to eventually call register within the feature flag, I assume that's left for another PR, etc.
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.
Yep will do that in a future PR
Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1211756086814099?focus=true
Description
Adds handlers to sync settings between SERP and Native settings.
Steps to test this PR
See asana task for testing steps: https://app.asana.com/1/137249556945/project/72649045549333/task/1211783183780068?focus=true
UI changes
No UI changes in this PR. The feature is focused on backend integration between SERP and native settings.