EmbeddedChat icon indicating copy to clipboard operation
EmbeddedChat copied to clipboard

FEAT: Added draft-saving feature for messages, which automatically sends them when the internet is restored.

Open dhairyashiil opened this issue 1 year ago • 6 comments

Brief Title

Added draft-saving feature for messages, which automatically sends them when the internet is restored.

Acceptance Criteria fulfillment

  • [X] Add a draft-saving feature for messages, which automatically sends them when the internet is restored.
  • [X] If multiple messages are queued while offline, ensure that all of them are sent in order once the connection is restored, as long as the user remains on that screen.
  • [X] There is no need to send the messages if the user closes the tab.
  • [X] For the last unsent message that was typed, populate it back into the input box when the user returns to the page.

Also added the following:

  • [X] Added validation for the edit message functionality. When editing a message, if the internet is disconnected, a popup will appear saying, "Please try again after connecting to internet!".
  • [X] Added the same validation for the send file message functionality. When sending a file, if the internet is disconnected, a popup will appear.
  • [X] Added upsert message functionality for audio, video, and file messages, which was previously only available for text messages. This functionality ensures the UI remains consistent across online, offline, and slow internet scenarios.

Fixes #721

Video/Screenshots

  1. Demo video: click here

In the above video, I have not shown a demo for the video messages but that too works as expected.

Upsert message functionality for file messages (consistent UI). (To see the upsert message functionality for audio messages, refer to the demo video above.)

https://github.com/user-attachments/assets/3e75e9a0-70e4-4d87-83ae-87dfcf156af6

Validation for File Messages.

https://github.com/user-attachments/assets/64481555-b923-417e-8ef9-42dd326fb793

Validation for Edit Messages.

https://github.com/user-attachments/assets/3acb3ef8-d7d2-4f86-b22d-532405cf85f1

PR Test Details

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-722 after approval. Contributors are requested to replace <pr_number> with the actual PR number.

dhairyashiil avatar Dec 23 '24 21:12 dhairyashiil

Woah, this looks like a huge PR, i'll need some time to review this Thanks a lot @dhairyashiil

Spiral-Memory avatar Jan 01 '25 13:01 Spiral-Memory

Woah, this looks like a huge PR, i'll need some time to review this Thanks a lot @dhairyashiil

No problem! Take your time, and let me know if you need anything. Welcome! :)

dhairyashiil avatar Jan 01 '25 14:01 dhairyashiil

Hi @dhairyashiil No need to show toast message for that, maybe follow how whatsapp do it

Spiral-Memory avatar Jan 05 '25 11:01 Spiral-Memory

Hello @Spiral-Memory, I have removed the toast message logic as you suggested. Currently, if the user is offline, they can still see their messages on the screen due to the upsert message functionality.

Also, WhatsApp shows messages with a circle tick in the bottom-right corner. Do you think I should implement that too?

dhairyashiil avatar Jan 12 '25 11:01 dhairyashiil

Yes

Spiral-Memory avatar Jan 12 '25 11:01 Spiral-Memory

Yes

Okay, I will work on it

dhairyashiil avatar Jan 12 '25 11:01 dhairyashiil