fix(chat): Preserve message text when sharing media from picker#2367
Conversation
When a user had already typed text in the chat input field and then selected an image, video, or document to share, the text was being lost instead of being used as the caption for the shared media. This fix transfers the existing chat message text to the ShareConfirmationViewController before clearing the input field, matching the behavior that already exists for pasted media content. If the user cancels the share, the text is restored to the chat input. Affected picker delegates: - PHPickerViewController (photo library) - UIImagePickerController (camera) - UIDocumentPickerViewController (files) Signed-off-by: Florian Ludwig <florian.ludwig@uninow.de>
6cd7fc2 to
02b6b3e
Compare
Ivansss
left a comment
There was a problem hiding this comment.
Really nice :)
Thanks for this PR!
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
Problem
When a user had already typed text in the chat input field and then selected an image, video, or document to share via the picker, the text was being wiped/cleared instead of being used as the caption for the shared media.
Solution
Added calls to
setChatMessage()in the picker delegate methods to transfer the existing text to the ShareConfirmationViewController before clearing the main input field. This mirrors the implementation that already exists indidPasteMediaContent().Affected picker delegates:
PHPickerViewControllerDelegate(photo library)UIImagePickerControllerDelegate(camera)UIDocumentPickerViewControllerDelegate(files)If the user cancels the share, the text is restored to the chat input (this was already implemented in
shareConfirmationViewControllerDidCancel).Test plan