Changeset View
Changeset View
Standalone View
Standalone View
native/input/input-state-container.react.js
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | import { | ||||
type SendMessageResult, | type SendMessageResult, | ||||
type SendMessagePayload, | type SendMessagePayload, | ||||
} from 'lib/types/message-types'; | } from 'lib/types/message-types'; | ||||
import type { RawImagesMessageInfo } from 'lib/types/messages/images'; | import type { RawImagesMessageInfo } from 'lib/types/messages/images'; | ||||
import type { | import type { | ||||
MediaMessageServerDBContent, | MediaMessageServerDBContent, | ||||
RawMediaMessageInfo, | RawMediaMessageInfo, | ||||
} from 'lib/types/messages/media'; | } from 'lib/types/messages/media'; | ||||
import { getMediaMessageServerDBContentsFromMedia } from 'lib/types/messages/media'; | |||||
import type { RawTextMessageInfo } from 'lib/types/messages/text'; | import type { RawTextMessageInfo } from 'lib/types/messages/text'; | ||||
import type { Dispatch } from 'lib/types/redux-types'; | import type { Dispatch } from 'lib/types/redux-types'; | ||||
import { | import { | ||||
type MediaMissionReportCreationRequest, | type MediaMissionReportCreationRequest, | ||||
reportTypes, | reportTypes, | ||||
} from 'lib/types/report-types'; | } from 'lib/types/report-types'; | ||||
import type { | import type { | ||||
ClientNewThreadRequest, | ClientNewThreadRequest, | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | class InputStateContainer extends React.PureComponent<Props, State> { | ||||
async sendMultimediaMessageAction( | async sendMultimediaMessageAction( | ||||
messageInfo: RawMultimediaMessageInfo, | messageInfo: RawMultimediaMessageInfo, | ||||
): Promise<SendMessagePayload> { | ): Promise<SendMessagePayload> { | ||||
const { localID, threadID } = messageInfo; | const { localID, threadID } = messageInfo; | ||||
invariant( | invariant( | ||||
localID !== null && localID !== undefined, | localID !== null && localID !== undefined, | ||||
'localID should be set', | 'localID should be set', | ||||
); | ); | ||||
const mediaMessageContents: MediaMessageServerDBContent[] = messageInfo.media.map( | const mediaMessageContents = getMediaMessageServerDBContentsFromMedia( | ||||
media => { | messageInfo.media, | ||||
if (media.type === 'photo') { | |||||
return { type: 'photo', uploadID: media.id }; | |||||
} else { | |||||
return { | |||||
type: 'video', | |||||
uploadID: media.id, | |||||
thumbnailUploadID: media.thumbnailID, | |||||
}; | |||||
} | |||||
}, | |||||
); | ); | ||||
try { | try { | ||||
const result = await this.props.sendMultimediaMessage( | const result = await this.props.sendMultimediaMessage( | ||||
threadID, | threadID, | ||||
localID, | localID, | ||||
mediaMessageContents, | mediaMessageContents, | ||||
); | ); | ||||
return { | return { | ||||
localID, | localID, | ||||
▲ Show 20 Lines • Show All 1,076 Lines • Show Last 20 Lines |