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 @@ -532,14 +532,14 @@ for (const uploadFileInput of uploadFileInputs) { const { localMediaID } = uploadFileInput.ids; pendingUploads[localMediaID] = { - failed: null, + failed: false, progressPercent: 0, processingStep: null, }; if (uploadFileInput.ids.type === 'video') { const { localThumbnailID } = uploadFileInput.ids; pendingUploads[localThumbnailID] = { - failed: null, + failed: false, progressPercent: 0, processingStep: null, }; @@ -620,7 +620,7 @@ }; const fail = (mediaID: string, message: string) => { errorMessage = message; - this.handleUploadFailure(localMessageID, mediaID, message); + this.handleUploadFailure(localMessageID, mediaID); userTime = Date.now() - start; }; @@ -926,11 +926,7 @@ }); }; - handleUploadFailure( - localMessageID: string, - localUploadID: string, - message: string, - ) { + handleUploadFailure(localMessageID: string, localUploadID: string) { this.setState(prevState => { const uploads = prevState.pendingUploads[localMessageID]; const upload = uploads[localUploadID]; @@ -945,7 +941,7 @@ ...uploads, [localUploadID]: { ...upload, - failed: message, + failed: true, progressPercent: 0, }, }, @@ -980,13 +976,9 @@ if (!pendingUploads) { return false; } - for (const localUploadID in pendingUploads) { - const { failed } = pendingUploads[localUploadID]; - if (failed) { - return true; - } - } - return false; + return Object.keys(pendingUploads).some( + localUploadID => pendingUploads[localUploadID].failed, + ); }; addReply = (message: string) => { @@ -1171,7 +1163,7 @@ // which makes the UI show pending status instead of error messages for (const singleMedia of retryMedia) { pendingUploads[singleMedia.id] = { - failed: null, + failed: false, progressPercent: 0, processingStep: null, }; @@ -1179,7 +1171,7 @@ const { thumbnailID } = singleMedia; invariant(thumbnailID, 'thumbnailID not null or undefined'); pendingUploads[thumbnailID] = { - failed: null, + failed: false, progressPercent: 0, processingStep: null, }; 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 @@ -9,7 +9,7 @@ export type MultimediaProcessingStep = 'transcoding' | 'uploading'; export type PendingMultimediaUpload = { - +failed: ?string, + +failed: boolean, +progressPercent: number, +processingStep: ?MultimediaProcessingStep, };