-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
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 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
orSubmitChat
) 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) {
...kchat-impl/src/main/java/com/duckduckgo/duckchat/impl/inputscreen/ui/view/InputModeWidget.kt
Show resolved
Hide resolved
...ckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/inputscreen/ui/InputScreenFragment.kt
Show resolved
Hide resolved
...ckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/inputscreen/ui/InputScreenFragment.kt
Show resolved
Hide resolved
...kchat-impl/src/main/java/com/duckduckgo/duckchat/impl/inputscreen/ui/view/InputModeWidget.kt
Show resolved
Hide resolved
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.
🚢
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1210823147637789?focus=true
Description
Steps to test this PR