Skip to content

Handle URLs on Duck.ai Input Mode #6416

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

Merged
merged 2 commits into from
Jul 18, 2025
Merged

Conversation

joshliebe
Copy link
Contributor

@joshliebe joshliebe commented Jul 17, 2025

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

Description

  • Sets the icon to a globe when a URL is entered on the Duck.ai tab.
  • Submits a web search when a URL is entered and a Duck.ai prompt otherwise.

Steps to test this PR

  • Go to the Duck.ai tab
  • Type a URL
  • Verify that the icon changes to a globe
  • Tap the button
  • Verify that a web search is performed

Copy link
Contributor Author

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

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 enhances the Duck.ai chat input to detect URLs and switch the submit behavior and icon accordingly.

  • Updates ViewModel to change the send icon to a globe for URL inputs and emits distinct commands (SubmitSearch or SubmitChat) based on content.
  • Introduces new commands (SubmitSearch, SubmitChat) and wires them through the Fragment, extracting submission logic into dedicated methods.
  • Extends the input widget to notify chat text changes and adds corresponding tests in InputScreenViewModelTest.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
InputScreenViewModel.kt Added onChatInputTextChanged, onSearchSubmitted, onChatSubmitted methods to handle URL detection and command emission.
Command.kt Defined new SubmitSearch and SubmitChat commands.
InputModeWidget.kt Added onChatTextChanged callback and updated the tab‐based text change handler.
InputScreenFragment.kt Refactored submission setup to call ViewModel, implemented submitSearchQuery and submitChatQuery helpers, and handled new commands.
InputScreenViewModelTest.kt Added tests for globe icon state and correct command emission for both search and chat submissions.
Comments suppressed due to low confidence (1)

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/inputscreen/ui/viewmodel/InputScreenViewModel.kt:287

  • [nitpick] Add KDoc to public methods like onChatInputTextChanged to explain their purpose and expected behavior, improving maintainability and easing future onboarding.
    fun onChatInputTextChanged(query: String) {

Copy link
Contributor

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@joshliebe joshliebe merged commit 290d9ff into develop Jul 18, 2025
16 checks passed
@joshliebe joshliebe deleted the feature/josh/globe-duck-ai branch July 18, 2025 10:54
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy