Skip to content
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

Add support for pasting images into composer text input #754

Conversation

anh-ngquang
Copy link
Contributor

🔗 Issue Link

N/A

🎯 Goal

Allow pasting images into composer text input, which is a common feature in messaging apps.

🛠 Implementation

Allow paste action on InputTextView, and call a closure named onImagePasted to pass the pasted image up to the MessageComposerView, then handle the image with the imagePasted method on MessageComposerViewModel, which save the image to a local temporary file, create a new AddedAsset and insert it to the addedAssets array.

🧪 Testing

Copy an image into the clipboard and paste into message composer text input. The image should be added into the composer view the same way as choosing an image from Photo library.

🎨 Changes

Screen.Recording.2025-02-12.at.16.41.13.480.mov

☑️ Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@anh-ngquang anh-ngquang requested a review from a team as a code owner February 12, 2025 10:31
@@ -637,7 +637,8 @@ public protocol ViewFactory: AnyObject {
placeholder: String,
editable: Bool,
maxMessageLength: Int?,
currentHeight: CGFloat
currentHeight: CGFloat,
onImagePasted: ((UIImage) -> Void)?
Copy link
Member

Choose a reason for hiding this comment

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

@anh-ngquang Thanks for the PR 👍 The implementation will probably require some changes because this is a breaking change. We will take it from here once we have time. We are planning on working on this in the next sprint.

@nuno-vieira nuno-vieira changed the base branch from develop to add/allow-pasting-images-to-composer April 2, 2025 23:33
@nuno-vieira nuno-vieira merged commit 72a66b9 into GetStream:add/allow-pasting-images-to-composer Apr 2, 2025
@nuno-vieira
Copy link
Member

New PR without breaking changes available here: #797

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.

2 participants