sceyt-chat-react-uikit 1.9.2-beta.4 → 1.9.2-beta.5

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 CHANGED
@@ -42853,6 +42853,9 @@ var Attachment = function Attachment(_ref) {
42853
42853
  }, [attachment.id, attachment.type, attachment.url, attachment.metadata, attachment.attachmentUrl, isDetailsView, originalVideoUrlFromMap, connectionStatus, dispatch, messageType, attachment.size, videoDownloadRetry, isSharedOriginalVideoCancelled, sharedOriginalVideoDownload.state]);
42854
42854
  var handleResumeOriginalVideoDownload = function handleResumeOriginalVideoDownload(event) {
42855
42855
  event.stopPropagation();
42856
+ restartOriginalVideoDownload();
42857
+ };
42858
+ var restartOriginalVideoDownload = function restartOriginalVideoDownload() {
42856
42859
  if (!attachment.url) return;
42857
42860
  var _getVideoAttachmentCa2 = getVideoAttachmentCacheKeys(attachment.url, attachment.metadata),
42858
42861
  originalVideoCacheKey = _getVideoAttachmentCa2.originalVideo;
@@ -42889,6 +42892,9 @@ var Attachment = function Attachment(_ref) {
42889
42892
  };
42890
42893
  var handleResumeOriginalImageDownload = function handleResumeOriginalImageDownload(event) {
42891
42894
  event.stopPropagation();
42895
+ restartOriginalImageDownload();
42896
+ };
42897
+ var restartOriginalImageDownload = function restartOriginalImageDownload() {
42892
42898
  if (!attachment.url) return;
42893
42899
  var imageDownloadRequest = imageDownloadRequestRef.current + 1;
42894
42900
  imageDownloadRequestRef.current = imageDownloadRequest;
@@ -42932,6 +42938,17 @@ var Attachment = function Attachment(_ref) {
42932
42938
  log.error('Error restarting image attachment download:', error);
42933
42939
  });
42934
42940
  };
42941
+ var previousConnectionStatusRef = React.useRef(connectionStatus);
42942
+ React.useEffect(function () {
42943
+ var reconnected = connectionStatus === CONNECTION_STATUS.CONNECTED && previousConnectionStatusRef.current !== CONNECTION_STATUS.CONNECTED;
42944
+ previousConnectionStatusRef.current = connectionStatus;
42945
+ if (!reconnected) return;
42946
+ if (attachment.type === attachmentTypes.video && isSharedOriginalVideoFailed) {
42947
+ restartOriginalVideoDownload();
42948
+ } else if (attachment.type === attachmentTypes.image && sharedOriginalImageDownload.state === 'failed') {
42949
+ restartOriginalImageDownload();
42950
+ }
42951
+ }, [connectionStatus]);
42935
42952
  var handleCancelOriginalVideoDownload = function handleCancelOriginalVideoDownload(event) {
42936
42953
  event.stopPropagation();
42937
42954
  if (isSharedOriginalVideoDownloading && originalVideoDownloadKey) {
package/index.modern.js CHANGED
@@ -42834,6 +42834,9 @@ var Attachment = function Attachment(_ref) {
42834
42834
  }, [attachment.id, attachment.type, attachment.url, attachment.metadata, attachment.attachmentUrl, isDetailsView, originalVideoUrlFromMap, connectionStatus, dispatch, messageType, attachment.size, videoDownloadRetry, isSharedOriginalVideoCancelled, sharedOriginalVideoDownload.state]);
42835
42835
  var handleResumeOriginalVideoDownload = function handleResumeOriginalVideoDownload(event) {
42836
42836
  event.stopPropagation();
42837
+ restartOriginalVideoDownload();
42838
+ };
42839
+ var restartOriginalVideoDownload = function restartOriginalVideoDownload() {
42837
42840
  if (!attachment.url) return;
42838
42841
  var _getVideoAttachmentCa2 = getVideoAttachmentCacheKeys(attachment.url, attachment.metadata),
42839
42842
  originalVideoCacheKey = _getVideoAttachmentCa2.originalVideo;
@@ -42870,6 +42873,9 @@ var Attachment = function Attachment(_ref) {
42870
42873
  };
42871
42874
  var handleResumeOriginalImageDownload = function handleResumeOriginalImageDownload(event) {
42872
42875
  event.stopPropagation();
42876
+ restartOriginalImageDownload();
42877
+ };
42878
+ var restartOriginalImageDownload = function restartOriginalImageDownload() {
42873
42879
  if (!attachment.url) return;
42874
42880
  var imageDownloadRequest = imageDownloadRequestRef.current + 1;
42875
42881
  imageDownloadRequestRef.current = imageDownloadRequest;
@@ -42913,6 +42919,17 @@ var Attachment = function Attachment(_ref) {
42913
42919
  log.error('Error restarting image attachment download:', error);
42914
42920
  });
42915
42921
  };
42922
+ var previousConnectionStatusRef = useRef(connectionStatus);
42923
+ useEffect(function () {
42924
+ var reconnected = connectionStatus === CONNECTION_STATUS.CONNECTED && previousConnectionStatusRef.current !== CONNECTION_STATUS.CONNECTED;
42925
+ previousConnectionStatusRef.current = connectionStatus;
42926
+ if (!reconnected) return;
42927
+ if (attachment.type === attachmentTypes.video && isSharedOriginalVideoFailed) {
42928
+ restartOriginalVideoDownload();
42929
+ } else if (attachment.type === attachmentTypes.image && sharedOriginalImageDownload.state === 'failed') {
42930
+ restartOriginalImageDownload();
42931
+ }
42932
+ }, [connectionStatus]);
42916
42933
  var handleCancelOriginalVideoDownload = function handleCancelOriginalVideoDownload(event) {
42917
42934
  event.stopPropagation();
42918
42935
  if (isSharedOriginalVideoDownloading && originalVideoDownloadKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.9.2-beta.4",
3
+ "version": "1.9.2-beta.5",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",