Page MenuHomePhabricator

[web] Introduce onMessageSent callbacks
ClosedPublic

Authored by jacek on Jul 7 2022, 2:57 AM.
Tags
None
Referenced Files
F3242829: D4463.diff
Thu, Nov 14, 5:03 AM
Unknown Object (File)
Sat, Nov 2, 7:01 PM
Unknown Object (File)
Sat, Nov 2, 7:01 PM
Unknown Object (File)
Sat, Nov 2, 7:01 PM
Unknown Object (File)
Sat, Nov 2, 7:00 PM
Unknown Object (File)
Sat, Nov 2, 6:55 PM
Unknown Object (File)
Thu, Oct 24, 9:50 AM
Unknown Object (File)
Wed, Oct 23, 3:59 AM

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.