Page MenuHomePhabricator

[web] Introduce onMessageSent callbacks
ClosedPublic

Authored by jacek on Jul 7 2022, 2:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 6, 7:57 PM
Unknown Object (File)
Sat, May 4, 6:42 AM
Unknown Object (File)
Wed, May 1, 11:43 PM
Unknown Object (File)
Apr 6 2024, 4:52 PM
Unknown Object (File)
Apr 2 2024, 12:04 AM
Unknown Object (File)
Mar 28 2024, 10:09 PM
Unknown Object (File)
Mar 5 2024, 2:52 AM
Unknown Object (File)
Mar 3 2024, 9:22 PM

Details

Summary

Introduce ability to register/unregister callbacks that are executed when user sends a message. This functionality exists in mobile app already.
The feature is required to detect sending message and change chat creation view to chat view automatically after sending message.

The code from input-state-container on web seems to be very similar to the native one (probably it could be copy-pasted at some point in the past).
Maybe it would be a good idea to refactor it so the platforms would share common code related to input state. However I think it is out of the scope of this diff.

Test Plan

Tested the callbacks after introducing chat creation view. It's not used yet.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek added inline comments.
web/input/input-state-container.react.js
112 ↗(On Diff #14243)

It's usually more convenient to have () => mixed callback when we don't care about returned value

This revision is now accepted and ready to land.Jul 19 2022, 5:53 AM
web/input/input-state-container.react.js
112 ↗(On Diff #14243)

Thanks, I'll replace the types

changed the types to () => mixed & wrap using useCallback

This revision was automatically updated to reflect the committed changes.