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, Nov 25, 2:28 PM
Unknown Object (File)
Sun, Nov 17, 11:11 PM
Unknown Object (File)
Thu, Nov 14, 3:00 PM
Unknown Object (File)
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

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
No Lint Coverage
Unit
No Test Coverage

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.