diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js --- a/native/input/input-state-container.react.js +++ b/native/input/input-state-container.react.js @@ -94,6 +94,7 @@ import { useIsReportEnabled } from 'lib/utils/report-utils.js'; import { + type EditState, InputStateContext, type PendingMultimediaUploads, type MultimediaProcessingStep, @@ -152,10 +153,14 @@ }; type State = { +pendingUploads: PendingMultimediaUploads, + +editState: EditState, }; class InputStateContainer extends React.PureComponent { state: State = { pendingUploads: {}, + editState: { + editedMessageID: null, + }, }; sendCallbacks: Array<() => void> = []; activeURIs = new Map(); @@ -380,7 +385,8 @@ inputStateSelector = createSelector( (state: State) => state.pendingUploads, - (pendingUploads: PendingMultimediaUploads) => ({ + (state: State) => state.editState, + (pendingUploads: PendingMultimediaUploads, editState: EditState) => ({ pendingUploads, sendTextMessage: this.sendTextMessage, sendMultimediaMessage: this.sendMultimediaMessage, @@ -394,6 +400,8 @@ uploadInProgress: this.uploadInProgress, reportURIDisplayed: this.reportURIDisplayed, setPendingThreadUpdateHandler: this.setPendingThreadUpdateHandler, + editState, + setEditedMessageID: this.setEditedMessageID, }), ); @@ -1201,6 +1209,12 @@ this.replyCallbacks.push(callbackReply); }; + setEditedMessageID = (messageID: ?string) => { + this.setState({ + editState: { editedMessageID: messageID }, + }); + }; + removeReplyListener = (callbackReply: (message: string) => void) => { this.replyCallbacks = this.replyCallbacks.filter( candidate => candidate !== callbackReply, diff --git a/native/input/input-state.js b/native/input/input-state.js --- a/native/input/input-state.js +++ b/native/input/input-state.js @@ -22,6 +22,10 @@ [localMessageID: string]: MessagePendingUploads, }; +export type EditState = { + +editedMessageID: ?string, +}; + export type InputState = { +pendingUploads: PendingMultimediaUploads, +sendTextMessage: ( @@ -50,6 +54,8 @@ threadID: string, pendingThreadUpdateHandler: ?(ThreadInfo) => mixed, ) => void, + +editState: EditState, + +setEditedMessageID: (editedMessageID: ?string) => void, }; const InputStateContext: React.Context =