Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3364888
D4980.id16338.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D4980.id16338.diff
View Options
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
@@ -651,7 +651,10 @@
const { hasWiFi } = this.props;
const uploadStart = Date.now();
- let uploadExceptionMessage, uploadResult, mediaMissionResult;
+ let uploadExceptionMessage,
+ uploadResult,
+ uploadThumbnailResult,
+ mediaMissionResult;
try {
const uploadPromises = [];
uploadPromises.push(
@@ -695,7 +698,7 @@
),
);
}
- [uploadResult] = await Promise.all(uploadPromises);
+ [uploadResult, uploadThumbnailResult] = await Promise.all(uploadPromises);
mediaMissionResult = { success: true };
} catch (e) {
uploadExceptionMessage = getMessageForException(e);
@@ -707,27 +710,47 @@
};
}
- if (uploadResult) {
+ if (
+ (processedMedia.mediaType === 'photo' && uploadResult) ||
+ (processedMedia.mediaType === 'video' &&
+ uploadResult &&
+ uploadThumbnailResult)
+ ) {
const { id, uri, dimensions, loop } = uploadResult;
serverID = id;
+
+ let updateMediaPayload = {
+ messageID: localMessageID,
+ currentMediaID: localMediaID,
+ mediaUpdate: {
+ id,
+ type: uploadResult.mediaType,
+ uri,
+ dimensions,
+ localMediaSelection: undefined,
+ loop: uploadResult.mediaType === 'video' ? loop : undefined,
+ },
+ };
+
+ if (processedMedia.mediaType === 'video') {
+ invariant(uploadThumbnailResult, 'uploadThumbnailResult exists');
+ const { uri: thumbnailURI } = uploadThumbnailResult;
+ updateMediaPayload = {
+ ...updateMediaPayload,
+ mediaUpdate: {
+ ...updateMediaPayload.mediaUpdate,
+ thumbnailURI,
+ },
+ };
+ }
+
// When we dispatch this action, it updates Redux and triggers the
// componentDidUpdate in this class. componentDidUpdate will handle
// calling dispatchMultimediaMessageAction once all the uploads are
// complete, and does not wait until this function concludes.
this.props.dispatch({
type: updateMultimediaMessageMediaActionType,
- payload: {
- messageID: localMessageID,
- currentMediaID: localMediaID,
- mediaUpdate: {
- id,
- type: uploadResult.mediaType,
- uri,
- dimensions,
- localMediaSelection: undefined,
- loop: uploadResult.mediaType === 'video' ? loop : undefined,
- },
- },
+ payload: updateMediaPayload,
});
userTime = Date.now() - start;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 5:38 AM (4 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2583130
Default Alt Text
D4980.id16338.diff (2 KB)
Attached To
Mode
D4980: [native] Update local video messages with realized `thumbnailURI` upon successful upload
Attached
Detach File
Event Timeline
Log In to Comment