stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

Optimistic image upload

Open bscharfstein opened this issue 6 years ago • 8 comments

Describe the bug You can't send a message / image if there is an image uploading

To Reproduce Try and upload an image and send it to chat. Even compressed this takes ~5 seconds.

Expected behavior Should optimistically send image to chat and upload in the background (like iMessage or any other chat tool)

bscharfstein avatar Jun 10 '20 19:06 bscharfstein

Hey @bscharfstein we are planning to implement this once offline support for react-native sdk is published (which is still couple of months away from publishing)

vishalnarkhede avatar Jun 16 '20 08:06 vishalnarkhede

why do you need offline support to implement this?

bscharfstein avatar Jun 19 '20 00:06 bscharfstein

@bscharfstein maybe I misunderstood the question/request. But could you please shade more details on what UX are you expecting exactly?

vishalnarkhede avatar Jun 22 '20 07:06 vishalnarkhede

Sure, happy to. *UX today When I try to send an image, the UI blocks me from pressing the send button (and thus sending any other messages) until the image has been uploaded to the server.

*Desired UX When I try to send an image, it immediately is put in chat on my screen even before it is uploaded. I can continue to send other messages.

I've attached a video of how this works on iMessages. Notice that the image is not marked as "delivered" for a few seconds. I'd expect stream could do the same -- continue to upload the image and just not mark it as delivered until it is...but allow me to compose and send other messages in the meantime. I understand this might lead to 'unsent' images but I'd prefer that to the feelingly broken (locked) UX today.

final_5ef0d91e681fe7001549a495_576852

bscharfstein avatar Jun 22 '20 16:06 bscharfstein

can you add an option to resize the image?

manhncse02926 avatar Jun 27 '20 10:06 manhncse02926

Hi @bscharfstein ,

Thanks for the details

*Desired UX When I try to send an image, it immediately is put in chat on my screen even before it is uploaded. I can continue to send other messages.

The problem here is, if I put the message on chat screen and if the user leaves chat screen (component unmounts) before the message is actually sent to server, it might be confusing. Since enduser saw the message in sending state already. Once we have offline storage, we can simply put this message in offline storage and wait for attachment to upload and then sync it with server.

vishalnarkhede avatar Jun 29 '20 08:06 vishalnarkhede

Hi @manhncse02926

can you add an option to resize the image?

please check this example for cropping/resizing - https://github.com/GetStream/stream-chat-react-native/blob/master/docs/cookbook.md#image-upload-takes-too-long-how-can-i-fix-it

vishalnarkhede avatar Jun 29 '20 08:06 vishalnarkhede

@vishalnarkhede understood. I actually still think this would be better than it is today although I understand that for many users it would not.

One relatively easy solution would be to pop a modal if a user tries to navigate away telling them that they need to wait or else not send their message. Something like "Your photo has not yet been delivered. If you leave this screen you'll need to resend later".

bscharfstein avatar Jun 29 '20 15:06 bscharfstein