Skip to content

Update DuckChat.isEnabled to check config flag and user pref #6605

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

joshliebe
Copy link
Contributor

@joshliebe joshliebe commented Aug 19, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1200204095367872/task/1211088838900418?focus=true

Description

  • Modifies DuckChat.isEnabled to check the config flag and user pref.

Steps to test this PR

Sanity check

  • Disable Duck.ai user setting
  • Verify that Duck.ai is disabled
  • Enable Duck.ai user setting
  • Verify that Duck.ai is enabled
  • In feature flag inventory, disable aiChat feature flag
  • Restart the app
  • Verify that Duck.ai is disabled

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@joshliebe joshliebe force-pushed the feature/josh/duck-ai-is-enabled branch 3 times, most recently from c4fb306 to 40013bd Compare August 19, 2025 08:57
@joshliebe joshliebe requested a review from Copilot August 19, 2025 09:16
Copy link
Contributor

@Copilot 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 modifies the DuckChat feature to properly check both the config flag and user preference to determine if Duck.ai is enabled. Previously, the isEnabled() method only checked the remote config flag, but now it combines both the feature flag and user setting to make the determination.

Key changes:

  • Updated DuckChat.isEnabled() to check both config flag and user preference
  • Introduced isDuckChatFeatureEnabled() method to check only the config flag
  • Updated URL detection logic to use the config flag check instead of the combined check

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
duckchat/duckchat-api/src/main/java/com/duckduckgo/duckchat/api/DuckChat.kt Updated documentation to reflect that isEnabled() now checks both config flag and user preference
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/RealDuckChat.kt Modified isEnabled() logic, added isDuckChatFeatureEnabled() method, and updated URL detection to use feature flag check
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/helper/DuckChatJSHelper.kt Updated JS helper to use isDuckChatFeatureEnabled() instead of isEnabled() for handoff data
app/src/main/java/com/duckduckgo/app/browser/SpecialUrlDetector.kt Simplified URL detection logic to rely on isDuckChatUrl() which now handles feature flag check internally
duckchat/duckchat-impl/src/test/kotlin/com/duckduckgo/duckchat/impl/RealDuckChatTest.kt Added comprehensive test coverage for all combinations of feature flag and user preference states
duckchat/duckchat-impl/src/test/kotlin/com/duckduckgo/duckchat/impl/helper/RealDuckChatJSHelperTest.kt Updated test mocks to use isDuckChatFeatureEnabled() instead of isEnabled()
app/src/test/java/com/duckduckgo/app/browser/SpecialUrlDetectorImplTest.kt Simplified tests to rely on isDuckChatUrl() handling feature enablement internally

@joshliebe joshliebe force-pushed the feature/josh/duck-ai-is-enabled branch from 40013bd to ec19fd4 Compare August 19, 2025 09:36
@joshliebe joshliebe force-pushed the feature/josh/duck-ai-is-enabled branch from ec19fd4 to 6c69b6b Compare August 19, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants