Changeset View
Changeset View
Standalone View
Standalone View
web/chat/multimedia-message.react.js
Show All 33 Lines | render() { | ||||
invariant(inputState, 'inputState should be set in MultimediaMessage'); | invariant(inputState, 'inputState should be set in MultimediaMessage'); | ||||
const pendingUploads = localID ? inputState.assignedUploads[localID] : null; | const pendingUploads = localID ? inputState.assignedUploads[localID] : null; | ||||
const multimedia = []; | const multimedia = []; | ||||
for (const singleMedia of media) { | for (const singleMedia of media) { | ||||
const pendingUpload = pendingUploads | const pendingUpload = pendingUploads | ||||
? pendingUploads.find(upload => upload.localID === singleMedia.id) | ? pendingUploads.find(upload => upload.localID === singleMedia.id) | ||||
: null; | : null; | ||||
const thumbHash = singleMedia.thumbHash ?? singleMedia.thumbnailThumbHash; | |||||
let mediaSource; | let mediaSource; | ||||
if (singleMedia.type === 'photo' || singleMedia.type === 'video') { | if (singleMedia.type === 'photo' || singleMedia.type === 'video') { | ||||
mediaSource = { | const { type, uri, thumbnailURI, dimensions } = singleMedia; | ||||
type: singleMedia.type, | mediaSource = { type, uri, thumbHash, thumbnailURI, dimensions }; | ||||
uri: singleMedia.uri, | |||||
}; | |||||
} else { | } else { | ||||
const { | |||||
type, | |||||
holder, | |||||
encryptionKey, | |||||
thumbnailHolder, | |||||
thumbnailEncryptionKey, | |||||
dimensions, | |||||
} = singleMedia; | |||||
mediaSource = { | mediaSource = { | ||||
type: singleMedia.type, | type, | ||||
holder: singleMedia.holder, | holder, | ||||
encryptionKey: singleMedia.encryptionKey, | encryptionKey, | ||||
thumbnailHolder, | |||||
thumbnailEncryptionKey, | |||||
dimensions, | |||||
thumbHash, | |||||
}; | }; | ||||
} | } | ||||
multimedia.push( | multimedia.push( | ||||
<Multimedia | <Multimedia | ||||
mediaSource={mediaSource} | mediaSource={mediaSource} | ||||
pendingUpload={pendingUpload} | pendingUpload={pendingUpload} | ||||
multimediaCSSClass={css.multimedia} | multimediaCSSClass={css.multimedia} | ||||
Show All 36 Lines |