Skip to content

Show screenshot thumbnail inline in chat bubble instead of native toast - #135

Merged
Android-PowerUser merged 1 commit into
mainfrom
feature/screenshot-thumbnail-in-bubble
Jul 21, 2026
Merged

Show screenshot thumbnail inline in chat bubble instead of native toast#135
Android-PowerUser merged 1 commit into
mainfrom
feature/screenshot-thumbnail-in-bubble

Conversation

@Android-PowerUser

Copy link
Copy Markdown
Owner
  • index.html: addUserBubble/onUserMessage now accept an optional image data URI, rendered as a small clickable thumbnail (with lightbox) inside the user bubble.
  • MainActivity.kt: loads the message's first imageUri, converts it to a base64 data URI, and passes it to window.onUserMessage.
  • PhotoReasoningScreenshotUiNotifier.kt: removed the now-redundant native 'Screenshot added, sending to AI...' / 'Screenshot added to conversation' toasts, since the screenshot is now visible directly in the chat bubble.

- index.html: addUserBubble/onUserMessage now accept an optional image
  data URI, rendered as a small clickable thumbnail (with lightbox)
  inside the user bubble.
- MainActivity.kt: loads the message's first imageUri, converts it to a
  base64 data URI, and passes it to window.onUserMessage.
- PhotoReasoningScreenshotUiNotifier.kt: removed the now-redundant native
  'Screenshot added, sending to AI...' / 'Screenshot added to
  conversation' toasts, since the screenshot is now visible directly in
  the chat bubble.
@Android-PowerUser
Android-PowerUser merged commit 1ee7aeb into main Jul 21, 2026
5 checks passed
@Android-PowerUser
Android-PowerUser deleted the feature/screenshot-thumbnail-in-bubble branch July 21, 2026 12:42

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The implementation correctly adds screenshot thumbnail display functionality to user chat bubbles. The code includes proper error handling, null safety, and cleanly integrates base64 data URI generation with the WebView bridge. No blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread index.html
.bubble-wrap.user-wrap{flex-direction:row-reverse}
.bubble{border-radius:12px;padding:16px;font-size:17px;line-height:1.55;max-width:82%;word-break:break-word}
.bubble.user{background:var(--bubble-user-bg);color:var(--bubble-user-text);white-space:pre-wrap}
.bubble-thumb{display:block;max-width:160px;max-height:160px;border-radius:8px;margin-bottom:8px;cursor:pointer;object-fit:cover}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛑 Security Vulnerability: Using innerHTML with unsanitized content creates XSS vulnerability. The 'text' variable from API responses should be sanitized before rendering.1

Suggested change
.bubble-thumb{display:block;max-width:160px;max-height:160px;border-radius:8px;margin-bottom:8px;cursor:pointer;object-fit:cover}
messageElement.textContent = text;

Footnotes

  1. CWE-79: Cross-site Scripting (XSS) - https://cwe.mitre.org/data/definitions/79.html

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.

1 participant