-
Notifications
You must be signed in to change notification settings - Fork 994
Add camera / image upload capability to Duck.ai WebView #6156
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
Adds the ability to capture or select images (and other media) in the Duck.ai WebView, handling permissions, moving files into cache, and cleaning them up afterward.
- Integrates a file chooser that supports camera, gallery, and audio capture with proper permission flow
- Introduces dialog strings for capture permission rationale and error messages
- Post-processes captured media by moving it into a cache subdirectory and scheduling its deletion via WorkManager
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
duckchat-impl/src/test/kotlin/com/duckduckgo/duckchat/impl/ui/filechooser/FileChooserIntentBuilderTest.kt | Added tests for intent flags, MIME type normalization, and URI extraction |
duckchat-impl/src/main/res/values/strings-duckchat.xml | Added string resources for camera/gallery disambiguation, permission rationale, and errors |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/postprocess/MediaCaptureImageMover.kt | Implements moving captured media into a cache subdirectory |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/postprocess/MediaCaptureDelayedDeleter.kt | Schedules deletion of captured files using WorkManager |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/postprocess/DeleteMediaCaptureWorker.kt | Worker that deletes the temporary media file after a delay |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/permission/RealExternalMediaSystemPermissionsHelper.kt | Handles runtime permission checks and requests for camera and audio |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/launcher/UploadFromExternalMediaAppLauncher.kt | Core launcher tying permission, capture intent, and post-processing into one flow |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/camera/CameraHardwareChecker.kt | Checks device support for camera capture |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/capture/MediaCaptureResultHandler.kt | Defines an ActivityResultContract for external media capture |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/filechooser/FileChooserIntentBuilder.kt | Builds ACTION_GET_CONTENT intents with MIME filters and extracts selected URIs from results |
duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewActivity.kt | Integrates the new file chooser/capture flow into the WebView’s WebChromeClient |
duckchat-impl/build.gradle | Added WorkManager runtime KTX dependency |
Comments suppressed due to low confidence (1)
duckchat/duckchat-impl/src/main/res/values/strings-duckchat.xml:24
- [nitpick] This resource key uses camelCase and lacks the project prefix; consider following the existing snake_case convention (e.g.,
duck_chat_image_capture_camera_unavailable
).
<string name="imageCaptureCameraUnavailable">Could not access camera</string>
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewActivity.kt
Outdated
Show resolved
Hide resolved
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewActivity.kt
Show resolved
Hide resolved
c001e59
to
4dd357d
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.
Works as expected, nice work! 🏅
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1210402314987796?focus=true
Description
Add camera / image upload capability to Duck.ai WebView.
Steps to test this PR
Follow the testing steps in the task