Skip to content

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

Merged
merged 13 commits into from
May 30, 2025

Conversation

joshliebe
Copy link
Contributor

@joshliebe joshliebe commented May 28, 2025

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

Copy link
Contributor Author

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

@joshliebe joshliebe requested a review from Copilot May 28, 2025 23:23
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

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>

@joshliebe joshliebe force-pushed the feature/josh/duck-ai-image-upload-l10n branch from c001e59 to 4dd357d Compare May 29, 2025 11:12
@0nko 0nko self-assigned this May 29, 2025
0nko

This comment was marked as resolved.

Copy link
Member

@0nko 0nko left a 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! 🏅

@joshliebe joshliebe merged commit 49a0387 into develop May 30, 2025
6 checks passed
@joshliebe joshliebe deleted the feature/josh/duck-ai-image-upload-l10n branch May 30, 2025 20:00
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.

3 participants