sceyt-chat-react-uikit 1.9.2-beta.4 → 1.9.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +61 -7
- package/index.modern.js +61 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9785,6 +9785,19 @@ function _finallyRethrows(body, finalizer) {
|
|
|
9785
9785
|
var CustomUploader;
|
|
9786
9786
|
var sendAttachmentsAsSeparateMessages = false;
|
|
9787
9787
|
var pendingUploaders = {};
|
|
9788
|
+
var notStartedUploads = new Map();
|
|
9789
|
+
var markUploadNotStarted = function markUploadNotStarted(attachmentId) {
|
|
9790
|
+
notStartedUploads.set(attachmentId, {
|
|
9791
|
+
paused: false
|
|
9792
|
+
});
|
|
9793
|
+
};
|
|
9794
|
+
var isUploadNotStarted = function isUploadNotStarted(attachmentId) {
|
|
9795
|
+
return notStartedUploads.has(attachmentId);
|
|
9796
|
+
};
|
|
9797
|
+
var isUploadPausedBeforeStart = function isUploadPausedBeforeStart(attachmentId) {
|
|
9798
|
+
var _notStartedUploads$ge;
|
|
9799
|
+
return !!((_notStartedUploads$ge = notStartedUploads.get(attachmentId)) !== null && _notStartedUploads$ge !== void 0 && _notStartedUploads$ge.paused);
|
|
9800
|
+
};
|
|
9788
9801
|
var setCustomUploader = function setCustomUploader(uploader) {
|
|
9789
9802
|
CustomUploader = uploader;
|
|
9790
9803
|
};
|
|
@@ -9824,7 +9837,12 @@ var customUpload = function customUpload(attachment, progress, messageType, getU
|
|
|
9824
9837
|
resume: function resume() {}
|
|
9825
9838
|
};
|
|
9826
9839
|
pendingUploaders[attachment.tid] = uploadTask;
|
|
9840
|
+
var pausedBeforeStart = isUploadPausedBeforeStart(attachment.tid);
|
|
9841
|
+
notStartedUploads["delete"](attachment.tid);
|
|
9827
9842
|
CustomUploader.upload(attachment, uploadTask, messageType);
|
|
9843
|
+
if (pausedBeforeStart) {
|
|
9844
|
+
uploadTask.stop();
|
|
9845
|
+
}
|
|
9828
9846
|
} else {
|
|
9829
9847
|
reject(new Error('No Custom uploader'));
|
|
9830
9848
|
}
|
|
@@ -9833,6 +9851,11 @@ var customUpload = function customUpload(attachment, progress, messageType, getU
|
|
|
9833
9851
|
var pauseUpload = function pauseUpload(attachmentId) {
|
|
9834
9852
|
if (pendingUploaders[attachmentId]) {
|
|
9835
9853
|
return pendingUploaders[attachmentId].stop();
|
|
9854
|
+
} else if (notStartedUploads.has(attachmentId)) {
|
|
9855
|
+
notStartedUploads.set(attachmentId, {
|
|
9856
|
+
paused: true
|
|
9857
|
+
});
|
|
9858
|
+
return true;
|
|
9836
9859
|
} else {
|
|
9837
9860
|
log.info('Unknown uploading task');
|
|
9838
9861
|
return false;
|
|
@@ -9841,12 +9864,18 @@ var pauseUpload = function pauseUpload(attachmentId) {
|
|
|
9841
9864
|
var resumeUpload = function resumeUpload(attachmentId) {
|
|
9842
9865
|
if (pendingUploaders[attachmentId]) {
|
|
9843
9866
|
return pendingUploaders[attachmentId].resume();
|
|
9867
|
+
} else if (notStartedUploads.has(attachmentId)) {
|
|
9868
|
+
notStartedUploads.set(attachmentId, {
|
|
9869
|
+
paused: false
|
|
9870
|
+
});
|
|
9871
|
+
return true;
|
|
9844
9872
|
} else {
|
|
9845
9873
|
log.info('Unknown uploading task');
|
|
9846
9874
|
return false;
|
|
9847
9875
|
}
|
|
9848
9876
|
};
|
|
9849
9877
|
var cancelUpload = function cancelUpload(attachmentId) {
|
|
9878
|
+
notStartedUploads["delete"](attachmentId);
|
|
9850
9879
|
var task = pendingUploaders[attachmentId];
|
|
9851
9880
|
if (task) {
|
|
9852
9881
|
delete pendingUploaders[attachmentId];
|
|
@@ -18548,10 +18577,13 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
18548
18577
|
var fileType = (_attachment$url = attachment.url) === null || _attachment$url === void 0 ? void 0 : (_attachment$url$type = _attachment$url.type) === null || _attachment$url$type === void 0 ? void 0 : _attachment$url$type.split('/')[0];
|
|
18549
18578
|
var _temp12 = function () {
|
|
18550
18579
|
if (attachment.type === attachmentTypes.video) {
|
|
18580
|
+
if (!attachment.cachedUrl) {
|
|
18581
|
+
markUploadNotStarted(attachment.tid);
|
|
18582
|
+
}
|
|
18551
18583
|
return Promise.resolve(prepareAndUploadVideoPreview(attachment, message.type)).then(function (_prepareAndUploadVide) {
|
|
18552
18584
|
attachment = _prepareAndUploadVide;
|
|
18553
18585
|
if (!attachment.cachedUrl) {
|
|
18554
|
-
store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachment.tid));
|
|
18586
|
+
store.dispatch(updateAttachmentUploadingStateAC(isUploadPausedBeforeStart(attachment.tid) ? UPLOAD_STATE.PAUSED : UPLOAD_STATE.UPLOADING, attachment.tid));
|
|
18555
18587
|
}
|
|
18556
18588
|
});
|
|
18557
18589
|
}
|
|
@@ -23985,7 +24017,7 @@ function pauseAttachmentUploading(action) {
|
|
|
23985
24017
|
}, _marked48, null, [[0, 2]]);
|
|
23986
24018
|
}
|
|
23987
24019
|
function resumeAttachmentUploading(action) {
|
|
23988
|
-
var attachmentId, isResumed, _t46;
|
|
24020
|
+
var attachmentId, preparing, isResumed, _t46;
|
|
23989
24021
|
return _regenerator().w(function (_context58) {
|
|
23990
24022
|
while (1) switch (_context58.p = _context58.n) {
|
|
23991
24023
|
case 0:
|
|
@@ -23996,13 +24028,14 @@ function resumeAttachmentUploading(action) {
|
|
|
23996
24028
|
_context58.n = 1;
|
|
23997
24029
|
break;
|
|
23998
24030
|
}
|
|
24031
|
+
preparing = isUploadNotStarted(attachmentId);
|
|
23999
24032
|
isResumed = resumeUpload(attachmentId);
|
|
24000
24033
|
if (!isResumed) {
|
|
24001
24034
|
_context58.n = 1;
|
|
24002
24035
|
break;
|
|
24003
24036
|
}
|
|
24004
24037
|
_context58.n = 1;
|
|
24005
|
-
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
|
|
24038
|
+
return effects.put(updateAttachmentUploadingStateAC(preparing ? UPLOAD_STATE.PREPARING : UPLOAD_STATE.UPLOADING, attachmentId));
|
|
24006
24039
|
case 1:
|
|
24007
24040
|
_context58.n = 3;
|
|
24008
24041
|
break;
|
|
@@ -42476,13 +42509,14 @@ var Attachment = function Attachment(_ref) {
|
|
|
42476
42509
|
setDownloadIsCancelled(true);
|
|
42477
42510
|
}
|
|
42478
42511
|
};
|
|
42512
|
+
var pauseResumeUploadLabel = downloadingFile ? 'Cancel file download' : attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING ? 'Stop upload' : 'Resume upload';
|
|
42479
42513
|
var handlePauseResumeUpload = function handlePauseResumeUpload(e) {
|
|
42480
42514
|
e.stopPropagation();
|
|
42481
42515
|
if (downloadingFile) {
|
|
42482
42516
|
handleStopStartDownloadFile(attachment);
|
|
42483
42517
|
} else {
|
|
42484
42518
|
if (attachmentCompilationState[attachment.tid]) {
|
|
42485
|
-
if (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING) {
|
|
42519
|
+
if (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING) {
|
|
42486
42520
|
dispatch(pauseAttachmentUploadingAC(attachment.tid));
|
|
42487
42521
|
} else {
|
|
42488
42522
|
dispatch(resumeAttachmentUploadingAC(attachment.tid));
|
|
@@ -42853,6 +42887,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
42853
42887
|
}, [attachment.id, attachment.type, attachment.url, attachment.metadata, attachment.attachmentUrl, isDetailsView, originalVideoUrlFromMap, connectionStatus, dispatch, messageType, attachment.size, videoDownloadRetry, isSharedOriginalVideoCancelled, sharedOriginalVideoDownload.state]);
|
|
42854
42888
|
var handleResumeOriginalVideoDownload = function handleResumeOriginalVideoDownload(event) {
|
|
42855
42889
|
event.stopPropagation();
|
|
42890
|
+
restartOriginalVideoDownload();
|
|
42891
|
+
};
|
|
42892
|
+
var restartOriginalVideoDownload = function restartOriginalVideoDownload() {
|
|
42856
42893
|
if (!attachment.url) return;
|
|
42857
42894
|
var _getVideoAttachmentCa2 = getVideoAttachmentCacheKeys(attachment.url, attachment.metadata),
|
|
42858
42895
|
originalVideoCacheKey = _getVideoAttachmentCa2.originalVideo;
|
|
@@ -42889,6 +42926,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
42889
42926
|
};
|
|
42890
42927
|
var handleResumeOriginalImageDownload = function handleResumeOriginalImageDownload(event) {
|
|
42891
42928
|
event.stopPropagation();
|
|
42929
|
+
restartOriginalImageDownload();
|
|
42930
|
+
};
|
|
42931
|
+
var restartOriginalImageDownload = function restartOriginalImageDownload() {
|
|
42892
42932
|
if (!attachment.url) return;
|
|
42893
42933
|
var imageDownloadRequest = imageDownloadRequestRef.current + 1;
|
|
42894
42934
|
imageDownloadRequestRef.current = imageDownloadRequest;
|
|
@@ -42932,6 +42972,17 @@ var Attachment = function Attachment(_ref) {
|
|
|
42932
42972
|
log.error('Error restarting image attachment download:', error);
|
|
42933
42973
|
});
|
|
42934
42974
|
};
|
|
42975
|
+
var previousConnectionStatusRef = React.useRef(connectionStatus);
|
|
42976
|
+
React.useEffect(function () {
|
|
42977
|
+
var reconnected = connectionStatus === CONNECTION_STATUS.CONNECTED && previousConnectionStatusRef.current !== CONNECTION_STATUS.CONNECTED;
|
|
42978
|
+
previousConnectionStatusRef.current = connectionStatus;
|
|
42979
|
+
if (!reconnected) return;
|
|
42980
|
+
if (attachment.type === attachmentTypes.video && isSharedOriginalVideoFailed) {
|
|
42981
|
+
restartOriginalVideoDownload();
|
|
42982
|
+
} else if (attachment.type === attachmentTypes.image && sharedOriginalImageDownload.state === 'failed') {
|
|
42983
|
+
restartOriginalImageDownload();
|
|
42984
|
+
}
|
|
42985
|
+
}, [connectionStatus]);
|
|
42935
42986
|
var handleCancelOriginalVideoDownload = function handleCancelOriginalVideoDownload(event) {
|
|
42936
42987
|
event.stopPropagation();
|
|
42937
42988
|
if (isSharedOriginalVideoDownloading && originalVideoDownloadKey) {
|
|
@@ -43201,7 +43252,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
43201
43252
|
isDetailsView: isDetailsView,
|
|
43202
43253
|
backgroundColor: overlayBackground2
|
|
43203
43254
|
}, isInUploadingState ? (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43204
|
-
onClick: handlePauseResumeUpload
|
|
43255
|
+
onClick: handlePauseResumeUpload,
|
|
43256
|
+
"aria-label": pauseResumeUploadLabel
|
|
43205
43257
|
}, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : (/*#__PURE__*/React__default.createElement(SvgUpload, null)))) : !isCached && (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43206
43258
|
"aria-label": 'Cancel image download',
|
|
43207
43259
|
onClick: function onClick(e) {
|
|
@@ -43283,7 +43335,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
43283
43335
|
isDetailsView: isDetailsView,
|
|
43284
43336
|
backgroundColor: overlayBackground2
|
|
43285
43337
|
}, isInUploadingState ? (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43286
|
-
onClick: handlePauseResumeUpload
|
|
43338
|
+
onClick: handlePauseResumeUpload,
|
|
43339
|
+
"aria-label": pauseResumeUploadLabel
|
|
43287
43340
|
}, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || isPreparingVideo ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : (/*#__PURE__*/React__default.createElement(SvgUpload, null)))) : (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43288
43341
|
onClick: handleCancelOriginalVideoDownload,
|
|
43289
43342
|
"aria-label": 'Cancel video download'
|
|
@@ -43435,7 +43488,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
43435
43488
|
isDetailsView: isDetailsView,
|
|
43436
43489
|
backgroundColor: overlayBackground2
|
|
43437
43490
|
}, (isInUploadingState || downloadingFile) && (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43438
|
-
onClick: handlePauseResumeUpload
|
|
43491
|
+
onClick: handlePauseResumeUpload,
|
|
43492
|
+
"aria-label": pauseResumeUploadLabel
|
|
43439
43493
|
}, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || downloadingFile ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : isInUploadingState && /*#__PURE__*/React__default.createElement(SvgUpload, null))), (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || downloadingFile) && (/*#__PURE__*/React__default.createElement(ProgressWrapper, null, /*#__PURE__*/React__default.createElement(reactCircularProgressbar.CircularProgressbar, {
|
|
43440
43494
|
minValue: 0,
|
|
43441
43495
|
maxValue: 100,
|
package/index.modern.js
CHANGED
|
@@ -9766,6 +9766,19 @@ function _finallyRethrows(body, finalizer) {
|
|
|
9766
9766
|
var CustomUploader;
|
|
9767
9767
|
var sendAttachmentsAsSeparateMessages = false;
|
|
9768
9768
|
var pendingUploaders = {};
|
|
9769
|
+
var notStartedUploads = new Map();
|
|
9770
|
+
var markUploadNotStarted = function markUploadNotStarted(attachmentId) {
|
|
9771
|
+
notStartedUploads.set(attachmentId, {
|
|
9772
|
+
paused: false
|
|
9773
|
+
});
|
|
9774
|
+
};
|
|
9775
|
+
var isUploadNotStarted = function isUploadNotStarted(attachmentId) {
|
|
9776
|
+
return notStartedUploads.has(attachmentId);
|
|
9777
|
+
};
|
|
9778
|
+
var isUploadPausedBeforeStart = function isUploadPausedBeforeStart(attachmentId) {
|
|
9779
|
+
var _notStartedUploads$ge;
|
|
9780
|
+
return !!((_notStartedUploads$ge = notStartedUploads.get(attachmentId)) !== null && _notStartedUploads$ge !== void 0 && _notStartedUploads$ge.paused);
|
|
9781
|
+
};
|
|
9769
9782
|
var setCustomUploader = function setCustomUploader(uploader) {
|
|
9770
9783
|
CustomUploader = uploader;
|
|
9771
9784
|
};
|
|
@@ -9805,7 +9818,12 @@ var customUpload = function customUpload(attachment, progress, messageType, getU
|
|
|
9805
9818
|
resume: function resume() {}
|
|
9806
9819
|
};
|
|
9807
9820
|
pendingUploaders[attachment.tid] = uploadTask;
|
|
9821
|
+
var pausedBeforeStart = isUploadPausedBeforeStart(attachment.tid);
|
|
9822
|
+
notStartedUploads["delete"](attachment.tid);
|
|
9808
9823
|
CustomUploader.upload(attachment, uploadTask, messageType);
|
|
9824
|
+
if (pausedBeforeStart) {
|
|
9825
|
+
uploadTask.stop();
|
|
9826
|
+
}
|
|
9809
9827
|
} else {
|
|
9810
9828
|
reject(new Error('No Custom uploader'));
|
|
9811
9829
|
}
|
|
@@ -9814,6 +9832,11 @@ var customUpload = function customUpload(attachment, progress, messageType, getU
|
|
|
9814
9832
|
var pauseUpload = function pauseUpload(attachmentId) {
|
|
9815
9833
|
if (pendingUploaders[attachmentId]) {
|
|
9816
9834
|
return pendingUploaders[attachmentId].stop();
|
|
9835
|
+
} else if (notStartedUploads.has(attachmentId)) {
|
|
9836
|
+
notStartedUploads.set(attachmentId, {
|
|
9837
|
+
paused: true
|
|
9838
|
+
});
|
|
9839
|
+
return true;
|
|
9817
9840
|
} else {
|
|
9818
9841
|
log.info('Unknown uploading task');
|
|
9819
9842
|
return false;
|
|
@@ -9822,12 +9845,18 @@ var pauseUpload = function pauseUpload(attachmentId) {
|
|
|
9822
9845
|
var resumeUpload = function resumeUpload(attachmentId) {
|
|
9823
9846
|
if (pendingUploaders[attachmentId]) {
|
|
9824
9847
|
return pendingUploaders[attachmentId].resume();
|
|
9848
|
+
} else if (notStartedUploads.has(attachmentId)) {
|
|
9849
|
+
notStartedUploads.set(attachmentId, {
|
|
9850
|
+
paused: false
|
|
9851
|
+
});
|
|
9852
|
+
return true;
|
|
9825
9853
|
} else {
|
|
9826
9854
|
log.info('Unknown uploading task');
|
|
9827
9855
|
return false;
|
|
9828
9856
|
}
|
|
9829
9857
|
};
|
|
9830
9858
|
var cancelUpload = function cancelUpload(attachmentId) {
|
|
9859
|
+
notStartedUploads["delete"](attachmentId);
|
|
9831
9860
|
var task = pendingUploaders[attachmentId];
|
|
9832
9861
|
if (task) {
|
|
9833
9862
|
delete pendingUploaders[attachmentId];
|
|
@@ -18529,10 +18558,13 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
18529
18558
|
var fileType = (_attachment$url = attachment.url) === null || _attachment$url === void 0 ? void 0 : (_attachment$url$type = _attachment$url.type) === null || _attachment$url$type === void 0 ? void 0 : _attachment$url$type.split('/')[0];
|
|
18530
18559
|
var _temp12 = function () {
|
|
18531
18560
|
if (attachment.type === attachmentTypes.video) {
|
|
18561
|
+
if (!attachment.cachedUrl) {
|
|
18562
|
+
markUploadNotStarted(attachment.tid);
|
|
18563
|
+
}
|
|
18532
18564
|
return Promise.resolve(prepareAndUploadVideoPreview(attachment, message.type)).then(function (_prepareAndUploadVide) {
|
|
18533
18565
|
attachment = _prepareAndUploadVide;
|
|
18534
18566
|
if (!attachment.cachedUrl) {
|
|
18535
|
-
store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachment.tid));
|
|
18567
|
+
store.dispatch(updateAttachmentUploadingStateAC(isUploadPausedBeforeStart(attachment.tid) ? UPLOAD_STATE.PAUSED : UPLOAD_STATE.UPLOADING, attachment.tid));
|
|
18536
18568
|
}
|
|
18537
18569
|
});
|
|
18538
18570
|
}
|
|
@@ -23966,7 +23998,7 @@ function pauseAttachmentUploading(action) {
|
|
|
23966
23998
|
}, _marked48, null, [[0, 2]]);
|
|
23967
23999
|
}
|
|
23968
24000
|
function resumeAttachmentUploading(action) {
|
|
23969
|
-
var attachmentId, isResumed, _t46;
|
|
24001
|
+
var attachmentId, preparing, isResumed, _t46;
|
|
23970
24002
|
return _regenerator().w(function (_context58) {
|
|
23971
24003
|
while (1) switch (_context58.p = _context58.n) {
|
|
23972
24004
|
case 0:
|
|
@@ -23977,13 +24009,14 @@ function resumeAttachmentUploading(action) {
|
|
|
23977
24009
|
_context58.n = 1;
|
|
23978
24010
|
break;
|
|
23979
24011
|
}
|
|
24012
|
+
preparing = isUploadNotStarted(attachmentId);
|
|
23980
24013
|
isResumed = resumeUpload(attachmentId);
|
|
23981
24014
|
if (!isResumed) {
|
|
23982
24015
|
_context58.n = 1;
|
|
23983
24016
|
break;
|
|
23984
24017
|
}
|
|
23985
24018
|
_context58.n = 1;
|
|
23986
|
-
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
|
|
24019
|
+
return put(updateAttachmentUploadingStateAC(preparing ? UPLOAD_STATE.PREPARING : UPLOAD_STATE.UPLOADING, attachmentId));
|
|
23987
24020
|
case 1:
|
|
23988
24021
|
_context58.n = 3;
|
|
23989
24022
|
break;
|
|
@@ -42457,13 +42490,14 @@ var Attachment = function Attachment(_ref) {
|
|
|
42457
42490
|
setDownloadIsCancelled(true);
|
|
42458
42491
|
}
|
|
42459
42492
|
};
|
|
42493
|
+
var pauseResumeUploadLabel = downloadingFile ? 'Cancel file download' : attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING ? 'Stop upload' : 'Resume upload';
|
|
42460
42494
|
var handlePauseResumeUpload = function handlePauseResumeUpload(e) {
|
|
42461
42495
|
e.stopPropagation();
|
|
42462
42496
|
if (downloadingFile) {
|
|
42463
42497
|
handleStopStartDownloadFile(attachment);
|
|
42464
42498
|
} else {
|
|
42465
42499
|
if (attachmentCompilationState[attachment.tid]) {
|
|
42466
|
-
if (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING) {
|
|
42500
|
+
if (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING) {
|
|
42467
42501
|
dispatch(pauseAttachmentUploadingAC(attachment.tid));
|
|
42468
42502
|
} else {
|
|
42469
42503
|
dispatch(resumeAttachmentUploadingAC(attachment.tid));
|
|
@@ -42834,6 +42868,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
42834
42868
|
}, [attachment.id, attachment.type, attachment.url, attachment.metadata, attachment.attachmentUrl, isDetailsView, originalVideoUrlFromMap, connectionStatus, dispatch, messageType, attachment.size, videoDownloadRetry, isSharedOriginalVideoCancelled, sharedOriginalVideoDownload.state]);
|
|
42835
42869
|
var handleResumeOriginalVideoDownload = function handleResumeOriginalVideoDownload(event) {
|
|
42836
42870
|
event.stopPropagation();
|
|
42871
|
+
restartOriginalVideoDownload();
|
|
42872
|
+
};
|
|
42873
|
+
var restartOriginalVideoDownload = function restartOriginalVideoDownload() {
|
|
42837
42874
|
if (!attachment.url) return;
|
|
42838
42875
|
var _getVideoAttachmentCa2 = getVideoAttachmentCacheKeys(attachment.url, attachment.metadata),
|
|
42839
42876
|
originalVideoCacheKey = _getVideoAttachmentCa2.originalVideo;
|
|
@@ -42870,6 +42907,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
42870
42907
|
};
|
|
42871
42908
|
var handleResumeOriginalImageDownload = function handleResumeOriginalImageDownload(event) {
|
|
42872
42909
|
event.stopPropagation();
|
|
42910
|
+
restartOriginalImageDownload();
|
|
42911
|
+
};
|
|
42912
|
+
var restartOriginalImageDownload = function restartOriginalImageDownload() {
|
|
42873
42913
|
if (!attachment.url) return;
|
|
42874
42914
|
var imageDownloadRequest = imageDownloadRequestRef.current + 1;
|
|
42875
42915
|
imageDownloadRequestRef.current = imageDownloadRequest;
|
|
@@ -42913,6 +42953,17 @@ var Attachment = function Attachment(_ref) {
|
|
|
42913
42953
|
log.error('Error restarting image attachment download:', error);
|
|
42914
42954
|
});
|
|
42915
42955
|
};
|
|
42956
|
+
var previousConnectionStatusRef = useRef(connectionStatus);
|
|
42957
|
+
useEffect(function () {
|
|
42958
|
+
var reconnected = connectionStatus === CONNECTION_STATUS.CONNECTED && previousConnectionStatusRef.current !== CONNECTION_STATUS.CONNECTED;
|
|
42959
|
+
previousConnectionStatusRef.current = connectionStatus;
|
|
42960
|
+
if (!reconnected) return;
|
|
42961
|
+
if (attachment.type === attachmentTypes.video && isSharedOriginalVideoFailed) {
|
|
42962
|
+
restartOriginalVideoDownload();
|
|
42963
|
+
} else if (attachment.type === attachmentTypes.image && sharedOriginalImageDownload.state === 'failed') {
|
|
42964
|
+
restartOriginalImageDownload();
|
|
42965
|
+
}
|
|
42966
|
+
}, [connectionStatus]);
|
|
42916
42967
|
var handleCancelOriginalVideoDownload = function handleCancelOriginalVideoDownload(event) {
|
|
42917
42968
|
event.stopPropagation();
|
|
42918
42969
|
if (isSharedOriginalVideoDownloading && originalVideoDownloadKey) {
|
|
@@ -43182,7 +43233,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
43182
43233
|
isDetailsView: isDetailsView,
|
|
43183
43234
|
backgroundColor: overlayBackground2
|
|
43184
43235
|
}, isInUploadingState ? (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43185
|
-
onClick: handlePauseResumeUpload
|
|
43236
|
+
onClick: handlePauseResumeUpload,
|
|
43237
|
+
"aria-label": pauseResumeUploadLabel
|
|
43186
43238
|
}, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : (/*#__PURE__*/React__default.createElement(SvgUpload, null)))) : !isCached && (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43187
43239
|
"aria-label": 'Cancel image download',
|
|
43188
43240
|
onClick: function onClick(e) {
|
|
@@ -43264,7 +43316,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
43264
43316
|
isDetailsView: isDetailsView,
|
|
43265
43317
|
backgroundColor: overlayBackground2
|
|
43266
43318
|
}, isInUploadingState ? (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43267
|
-
onClick: handlePauseResumeUpload
|
|
43319
|
+
onClick: handlePauseResumeUpload,
|
|
43320
|
+
"aria-label": pauseResumeUploadLabel
|
|
43268
43321
|
}, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || isPreparingVideo ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : (/*#__PURE__*/React__default.createElement(SvgUpload, null)))) : (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43269
43322
|
onClick: handleCancelOriginalVideoDownload,
|
|
43270
43323
|
"aria-label": 'Cancel video download'
|
|
@@ -43416,7 +43469,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
43416
43469
|
isDetailsView: isDetailsView,
|
|
43417
43470
|
backgroundColor: overlayBackground2
|
|
43418
43471
|
}, (isInUploadingState || downloadingFile) && (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
|
|
43419
|
-
onClick: handlePauseResumeUpload
|
|
43472
|
+
onClick: handlePauseResumeUpload,
|
|
43473
|
+
"aria-label": pauseResumeUploadLabel
|
|
43420
43474
|
}, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || downloadingFile ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : isInUploadingState && /*#__PURE__*/React__default.createElement(SvgUpload, null))), (attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || downloadingFile) && (/*#__PURE__*/React__default.createElement(ProgressWrapper, null, /*#__PURE__*/React__default.createElement(CircularProgressbar, {
|
|
43421
43475
|
minValue: 0,
|
|
43422
43476
|
maxValue: 100,
|