Show screenshot thumbnail inline in chat bubble instead of native toast - #135
Conversation
Android-PowerUser
commented
Jul 21, 2026
- 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.
There was a problem hiding this comment.
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.
| .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} |
There was a problem hiding this comment.
🛑 Security Vulnerability: Using innerHTML with unsanitized content creates XSS vulnerability. The 'text' variable from API responses should be sanitized before rendering.1
| .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
-
CWE-79: Cross-site Scripting (XSS) - https://cwe.mitre.org/data/definitions/79.html ↩