Skip to content

Conversation

@mikescamell
Copy link
Contributor

@mikescamell mikescamell commented Oct 28, 2025

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.

  • Added domain validation to properly handle subdomains in content scope scripts
  • Added bidirectional communication between SERP and native app for Duck.ai settings
  • Created message handlers to respond to SERP requests about Duck.ai 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.

@mikescamell mikescamell force-pushed the feature/mike/serp-settings-sync/add-js-message-handlers branch 4 times, most recently from 413b71f to 17690e9 Compare October 29, 2025 12:02
@mikescamell mikescamell changed the title [WIP] SERP Setting Sync SERP Settings Sync: Add initial js message handlers Oct 29, 2025
@mikescamell mikescamell force-pushed the feature/mike/serp-settings-sync/add-js-message-handlers branch 2 times, most recently from 9ebdf81 to 8d6e583 Compare October 30, 2025 11:15
@mikescamell mikescamell requested a review from Copilot October 30, 2025 11:47
Copy link
Contributor

Copilot AI left a 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
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
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@duckduckgo duckduckgo deleted a comment from Copilot AI Oct 30, 2025
@mikescamell mikescamell force-pushed the feature/mike/serp-settings-sync/add-js-message-handlers branch 2 times, most recently from b525fc3 to 19918fc Compare October 30, 2025 12:27
@mikescamell mikescamell marked this pull request as ready for review October 30, 2025 12:51
@mikescamell mikescamell force-pushed the feature/mike/serp-settings-sync/add-js-message-handlers branch from 19918fc to c41620e Compare October 30, 2025 13:22
Copy link
Contributor

@marcosholgado marcosholgado left a 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()) {
Copy link
Contributor

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.

Copy link
Contributor Author

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

@mikescamell mikescamell merged commit f9de3fb into develop Oct 30, 2025
15 of 16 checks passed
@mikescamell mikescamell deleted the feature/mike/serp-settings-sync/add-js-message-handlers branch October 30, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants