stream-chat-react-native-core 5.6.0-beta.0 → 5.6.0-beta.2

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.
Files changed (171) hide show
  1. package/lib/commonjs/components/Attachment/Gallery.js +21 -16
  2. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/GalleryImage.js +3 -3
  4. package/lib/commonjs/components/Attachment/GalleryImage.js.map +1 -1
  5. package/lib/commonjs/components/Channel/Channel.js +43 -33
  6. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  7. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +5 -1
  8. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  9. package/lib/commonjs/components/Chat/Chat.js +1 -1
  10. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  11. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +51 -22
  12. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
  13. package/lib/commonjs/components/Chat/hooks/useIsOnline.js +1 -1
  14. package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
  15. package/lib/commonjs/components/Message/hooks/useMessageActions.js +2 -2
  16. package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
  17. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +18 -21
  18. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  19. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +7 -32
  20. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  21. package/lib/commonjs/components/index.js +1 -1
  22. package/lib/commonjs/components/index.js.map +1 -1
  23. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  24. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +128 -89
  25. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  26. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +1 -0
  27. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  28. package/lib/commonjs/store/QuickSqliteClient.js +46 -1
  29. package/lib/commonjs/store/QuickSqliteClient.js.map +1 -1
  30. package/lib/commonjs/store/QuickSqliteClient_v4.js +112 -0
  31. package/lib/commonjs/store/QuickSqliteClient_v4.js.map +1 -0
  32. package/lib/commonjs/store/apis/getAppSettings.js +23 -0
  33. package/lib/commonjs/store/apis/getAppSettings.js.map +1 -0
  34. package/lib/commonjs/store/apis/getPendingTasks.js.map +1 -1
  35. package/lib/commonjs/store/apis/index.js +26 -0
  36. package/lib/commonjs/store/apis/index.js.map +1 -1
  37. package/lib/commonjs/store/apis/queries/selectChannels.js.map +1 -1
  38. package/lib/commonjs/store/apis/queries/selectMembersForChannels.js.map +1 -1
  39. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  40. package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js.map +1 -1
  41. package/lib/commonjs/store/apis/queries/selectReadsForChannels.js.map +1 -1
  42. package/lib/commonjs/store/apis/upsertAppSettings.js +26 -0
  43. package/lib/commonjs/store/apis/upsertAppSettings.js.map +1 -0
  44. package/lib/commonjs/store/schema.js +1 -0
  45. package/lib/commonjs/store/schema.js.map +1 -1
  46. package/lib/commonjs/utils/DBSyncManager.js +16 -16
  47. package/lib/commonjs/utils/DBSyncManager.js.map +1 -1
  48. package/lib/commonjs/{components/Message/utils → utils}/removeReservedFields.js +1 -1
  49. package/lib/commonjs/utils/removeReservedFields.js.map +1 -0
  50. package/lib/commonjs/utils/utils.js +2 -2
  51. package/lib/commonjs/utils/utils.js.map +1 -1
  52. package/lib/commonjs/version.json +1 -1
  53. package/lib/module/components/Attachment/Gallery.js +21 -16
  54. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  55. package/lib/module/components/Attachment/GalleryImage.js +3 -3
  56. package/lib/module/components/Attachment/GalleryImage.js.map +1 -1
  57. package/lib/module/components/Channel/Channel.js +43 -33
  58. package/lib/module/components/Channel/Channel.js.map +1 -1
  59. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +5 -1
  60. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  61. package/lib/module/components/Chat/Chat.js +1 -1
  62. package/lib/module/components/Chat/Chat.js.map +1 -1
  63. package/lib/module/components/Chat/hooks/useAppSettings.js +51 -22
  64. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
  65. package/lib/module/components/Chat/hooks/useIsOnline.js +1 -1
  66. package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
  67. package/lib/module/components/Message/hooks/useMessageActions.js +2 -2
  68. package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
  69. package/lib/module/components/MessageInput/FileUploadPreview.js +18 -21
  70. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  71. package/lib/module/components/MessageInput/ImageUploadPreview.js +7 -32
  72. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  73. package/lib/module/components/index.js +1 -1
  74. package/lib/module/components/index.js.map +1 -1
  75. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  76. package/lib/module/contexts/messageInputContext/MessageInputContext.js +128 -89
  77. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  78. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +1 -0
  79. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  80. package/lib/module/store/QuickSqliteClient.js +46 -1
  81. package/lib/module/store/QuickSqliteClient.js.map +1 -1
  82. package/lib/module/store/QuickSqliteClient_v4.js +112 -0
  83. package/lib/module/store/QuickSqliteClient_v4.js.map +1 -0
  84. package/lib/module/store/apis/getAppSettings.js +23 -0
  85. package/lib/module/store/apis/getAppSettings.js.map +1 -0
  86. package/lib/module/store/apis/getPendingTasks.js.map +1 -1
  87. package/lib/module/store/apis/index.js +26 -0
  88. package/lib/module/store/apis/index.js.map +1 -1
  89. package/lib/module/store/apis/queries/selectChannels.js.map +1 -1
  90. package/lib/module/store/apis/queries/selectMembersForChannels.js.map +1 -1
  91. package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  92. package/lib/module/store/apis/queries/selectReactionsForMessages.js.map +1 -1
  93. package/lib/module/store/apis/queries/selectReadsForChannels.js.map +1 -1
  94. package/lib/module/store/apis/upsertAppSettings.js +26 -0
  95. package/lib/module/store/apis/upsertAppSettings.js.map +1 -0
  96. package/lib/module/store/schema.js +1 -0
  97. package/lib/module/store/schema.js.map +1 -1
  98. package/lib/module/utils/DBSyncManager.js +16 -16
  99. package/lib/module/utils/DBSyncManager.js.map +1 -1
  100. package/lib/module/{components/Message/utils → utils}/removeReservedFields.js +1 -1
  101. package/lib/module/utils/removeReservedFields.js.map +1 -0
  102. package/lib/module/utils/utils.js +2 -2
  103. package/lib/module/utils/utils.js.map +1 -1
  104. package/lib/module/version.json +1 -1
  105. package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts +2 -2
  106. package/lib/typescript/components/Chat/hooks/useIsOnline.d.ts +1 -1
  107. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
  108. package/lib/typescript/components/MessageInput/ImageUploadPreview.d.ts +1 -1
  109. package/lib/typescript/components/index.d.ts +1 -1
  110. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +1 -1
  111. package/lib/typescript/store/QuickSqliteClient.d.ts +4 -1
  112. package/lib/typescript/store/QuickSqliteClient_v4.d.ts +12 -0
  113. package/lib/typescript/store/apis/getAppSettings.d.ts +4 -0
  114. package/lib/typescript/store/apis/getPendingTasks.d.ts +1 -1
  115. package/lib/typescript/store/apis/index.d.ts +2 -0
  116. package/lib/typescript/store/apis/upsertAppSettings.d.ts +6 -0
  117. package/lib/typescript/store/mappers/mapTaskToStorable.d.ts +0 -8
  118. package/lib/typescript/store/schema.d.ts +1 -0
  119. package/lib/typescript/store/types.d.ts +0 -4
  120. package/lib/typescript/utils/DBSyncManager.d.ts +1 -1
  121. package/lib/typescript/{components/Message/utils → utils}/removeReservedFields.d.ts +2 -2
  122. package/lib/typescript/utils/utils.d.ts +1 -1
  123. package/package.json +1 -1
  124. package/src/components/Attachment/Gallery.tsx +5 -1
  125. package/src/components/Attachment/GalleryImage.tsx +2 -0
  126. package/src/components/Attachment/__tests__/Gallery.test.js +9 -2
  127. package/src/components/Attachment/__tests__/Giphy.test.js +9 -5
  128. package/src/components/Channel/Channel.tsx +20 -12
  129. package/src/components/ChannelList/hooks/usePaginatedChannels.ts +6 -4
  130. package/src/components/Chat/Chat.tsx +1 -1
  131. package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +1 -0
  132. package/src/components/Chat/hooks/useAppSettings.ts +19 -6
  133. package/src/components/Chat/hooks/useIsOnline.ts +1 -1
  134. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +29 -15
  135. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +12 -6
  136. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +9 -4
  137. package/src/components/Message/hooks/useMessageActions.tsx +1 -1
  138. package/src/components/MessageInput/FileUploadPreview.tsx +4 -5
  139. package/src/components/MessageInput/ImageUploadPreview.tsx +10 -35
  140. package/src/components/index.ts +1 -1
  141. package/src/contexts/chatContext/ChatContext.tsx +1 -1
  142. package/src/contexts/messageInputContext/MessageInputContext.tsx +94 -75
  143. package/src/contexts/messageInputContext/__tests__/MessageInputContext.test.tsx +8 -3
  144. package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +0 -3
  145. package/src/contexts/messageInputContext/__tests__/uploadFile.test.tsx +16 -6
  146. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +1 -0
  147. package/src/store/QuickSqliteClient.ts +49 -5
  148. package/src/store/QuickSqliteClient_v4.ts +98 -0
  149. package/src/store/apis/getAppSettings.ts +19 -0
  150. package/src/store/apis/getPendingTasks.ts +2 -1
  151. package/src/store/apis/index.ts +2 -0
  152. package/src/store/apis/queries/selectChannels.ts +4 -1
  153. package/src/store/apis/queries/selectMembersForChannels.ts +1 -1
  154. package/src/store/apis/queries/selectMessagesForChannels.ts +1 -1
  155. package/src/store/apis/queries/selectReactionsForMessages.ts +1 -1
  156. package/src/store/apis/queries/selectReadsForChannels.ts +1 -1
  157. package/src/store/apis/upsertAppSettings.ts +23 -0
  158. package/src/store/schema.ts +2 -0
  159. package/src/store/types.ts +0 -5
  160. package/src/utils/DBSyncManager.ts +1 -1
  161. package/src/{components/Message/utils → utils}/removeReservedFields.ts +7 -3
  162. package/src/utils/utils.ts +7 -6
  163. package/src/version.json +1 -1
  164. package/lib/commonjs/components/Message/utils/removeReservedFields.js.map +0 -1
  165. package/lib/commonjs/utils/pendingTaskUtils.js +0 -302
  166. package/lib/commonjs/utils/pendingTaskUtils.js.map +0 -1
  167. package/lib/module/components/Message/utils/removeReservedFields.js.map +0 -1
  168. package/lib/module/utils/pendingTaskUtils.js +0 -302
  169. package/lib/module/utils/pendingTaskUtils.js.map +0 -1
  170. package/lib/typescript/utils/pendingTaskUtils.d.ts +0 -13
  171. package/src/utils/pendingTaskUtils.ts +0 -131
@@ -37,6 +37,8 @@ var _useCooldown2 = require("../../components/MessageInput/hooks/useCooldown");
37
37
 
38
38
  var _native = require("../../native");
39
39
 
40
+ var _removeReservedFields = require("../../utils/removeReservedFields");
41
+
40
42
  var _utils = require("../../utils/utils");
41
43
 
42
44
  var _AttachmentPickerContext = require("../attachmentPickerContext/AttachmentPickerContext");
@@ -194,28 +196,28 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
194
196
  return true;
195
197
  }
196
198
 
197
- for (var _iterator = _createForOfIteratorHelperLoose(imageUploads), _step; !(_step = _iterator()).done;) {
198
- var _image = _step.value;
199
+ var imagesAndFiles = [].concat((0, _toConsumableArray2["default"])(imageUploads), (0, _toConsumableArray2["default"])(fileUploads));
199
200
 
200
- if ((!_image || _image.state === _utils.FileState.UPLOAD_FAILED) && !enableOfflineSupport) {
201
- continue;
202
- }
201
+ if (enableOfflineSupport) {
202
+ for (var _iterator = _createForOfIteratorHelperLoose(imagesAndFiles), _step; !(_step = _iterator()).done;) {
203
+ var _file = _step.value;
203
204
 
204
- if (_image.state === _utils.FileState.UPLOADING) {
205
- return false;
205
+ if (_file.state === _utils.FileState.NOT_SUPPORTED) {
206
+ return false;
207
+ }
206
208
  }
207
209
 
208
210
  return true;
209
211
  }
210
212
 
211
- for (var _iterator2 = _createForOfIteratorHelperLoose(fileUploads), _step2; !(_step2 = _iterator2()).done;) {
212
- var _file = _step2.value;
213
+ for (var _iterator2 = _createForOfIteratorHelperLoose(imagesAndFiles), _step2; !(_step2 = _iterator2()).done;) {
214
+ var _file2 = _step2.value;
213
215
 
214
- if ((!_file || _file.state === _utils.FileState.UPLOAD_FAILED) && !enableOfflineSupport) {
216
+ if (!_file2 || _file2.state === _utils.FileState.UPLOAD_FAILED) {
215
217
  continue;
216
218
  }
217
219
 
218
- if (_file.state === _utils.FileState.UPLOADING) {
220
+ if (_file2.state === _utils.FileState.UPLOADING) {
219
221
  return false;
220
222
  }
221
223
 
@@ -374,9 +376,68 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
374
376
  setText('');
375
377
  };
376
378
 
379
+ var mapImageUploadToAttachment = function mapImageUploadToAttachment(image) {
380
+ var mime_type = (0, _mimeTypes.lookup)(image.file.filename);
381
+ return {
382
+ fallback: image.file.name,
383
+ image_url: image.url,
384
+ mime_type: mime_type ? mime_type : undefined,
385
+ original_height: image.height,
386
+ original_width: image.width,
387
+ originalFile: image.file,
388
+ type: 'image'
389
+ };
390
+ };
391
+
392
+ var mapFileUploadToAttachment = function mapFileUploadToAttachment(file) {
393
+ var _file$file$type, _file$file$type2, _file$file$type3;
394
+
395
+ var mime_type = (0, _mimeTypes.lookup)(file.file.name);
396
+
397
+ if ((_file$file$type = file.file.type) != null && _file$file$type.startsWith('image/')) {
398
+ return {
399
+ fallback: file.file.name,
400
+ image_url: file.url,
401
+ mime_type: mime_type ? mime_type : undefined,
402
+ originalFile: file.file,
403
+ type: 'image'
404
+ };
405
+ } else if ((_file$file$type2 = file.file.type) != null && _file$file$type2.startsWith('audio/')) {
406
+ return {
407
+ asset_url: file.url || file.file.uri,
408
+ duration: file.file.duration,
409
+ file_size: file.file.size,
410
+ mime_type: file.file.type,
411
+ originalFile: file.file,
412
+ title: file.file.name,
413
+ type: 'audio'
414
+ };
415
+ } else if ((_file$file$type3 = file.file.type) != null && _file$file$type3.startsWith('video/')) {
416
+ return {
417
+ asset_url: file.url || file.file.uri,
418
+ duration: file.file.duration,
419
+ file_size: file.file.size,
420
+ mime_type: file.file.type,
421
+ originalFile: file.file,
422
+ thumb_url: file.thumb_url,
423
+ title: file.file.name,
424
+ type: 'video'
425
+ };
426
+ } else {
427
+ return {
428
+ asset_url: file.url || file.file.uri,
429
+ file_size: file.file.size,
430
+ mime_type: file.file.type,
431
+ originalFile: file.file,
432
+ title: file.file.name,
433
+ type: 'file'
434
+ };
435
+ }
436
+ };
437
+
377
438
  var sendMessage = function () {
378
439
  var _ref3 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2() {
379
- var prevText, attachments, _loop, _iterator3, _step3, _image2, _ret, _iterator4, _step4, _file2, mime_type, _file2$file$type, _file2$file$type2, _file2$file$type3, updatedMessage, updateMessagePromise;
440
+ var prevText, attachments, _loop, _iterator3, _step3, _image, _ret, _iterator4, _step4, _file3, updatedMessage, updateMessagePromise;
380
441
 
381
442
  return _regenerator["default"].wrap(function _callee2$(_context2) {
382
443
  while (1) {
@@ -411,15 +472,26 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
411
472
 
412
473
  attachments = [];
413
474
 
414
- _loop = function _loop(_image2) {
415
- if ((!_image2 || _image2.state === _utils.FileState.UPLOAD_FAILED) && !enableOfflineSupport) {
475
+ _loop = function _loop(_image) {
476
+ if (enableOfflineSupport) {
477
+ if (_image.state === _utils.FileState.NOT_SUPPORTED) {
478
+ return {
479
+ v: void 0
480
+ };
481
+ }
482
+
483
+ attachments.push(mapImageUploadToAttachment(_image));
416
484
  return "continue";
417
485
  }
418
486
 
419
- if (_image2.state === _utils.FileState.UPLOADING) {
487
+ if ((!_image || _image.state === _utils.FileState.UPLOAD_FAILED) && !enableOfflineSupport) {
488
+ return "continue";
489
+ }
490
+
491
+ if (_image.state === _utils.FileState.UPLOADING) {
420
492
  if (value.sendImageAsync) {
421
493
  setAsyncIds(function (prevAsyncIds) {
422
- return [].concat((0, _toConsumableArray2["default"])(prevAsyncIds), [_image2.id]);
494
+ return [].concat((0, _toConsumableArray2["default"])(prevAsyncIds), [_image.id]);
423
495
  });
424
496
  } else {
425
497
  sending.current = false;
@@ -429,18 +501,8 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
429
501
  }
430
502
  }
431
503
 
432
- var mime_type = (0, _mimeTypes.lookup)(_image2.file.filename);
433
-
434
- if (_image2.state === _utils.FileState.UPLOADED || _image2.state === _utils.FileState.FINISHED || enableOfflineSupport && _image2.state === _utils.FileState.UPLOAD_FAILED) {
435
- attachments.push({
436
- fallback: _image2.file.name,
437
- image_url: _image2.url,
438
- mime_type: mime_type ? mime_type : undefined,
439
- original_height: _image2.height,
440
- original_width: _image2.width,
441
- originalFile: _image2.file,
442
- type: 'image'
443
- });
504
+ if (_image.state === _utils.FileState.UPLOADED || _image.state === _utils.FileState.FINISHED) {
505
+ attachments.push(mapImageUploadToAttachment(_image));
444
506
  }
445
507
  };
446
508
 
@@ -452,8 +514,8 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
452
514
  break;
453
515
  }
454
516
 
455
- _image2 = _step3.value;
456
- _ret = _loop(_image2);
517
+ _image = _step3.value;
518
+ _ret = _loop(_image);
457
519
 
458
520
  if (!(_ret === "continue")) {
459
521
  _context2.next = 18;
@@ -479,87 +541,64 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
479
541
 
480
542
  case 23:
481
543
  if ((_step4 = _iterator4()).done) {
482
- _context2.next = 34;
544
+ _context2.next = 38;
483
545
  break;
484
546
  }
485
547
 
486
- _file2 = _step4.value;
548
+ _file3 = _step4.value;
487
549
 
488
- if (!((!_file2 || _file2.state === _utils.FileState.UPLOAD_FAILED) && !enableOfflineSupport)) {
489
- _context2.next = 27;
550
+ if (!enableOfflineSupport) {
551
+ _context2.next = 30;
490
552
  break;
491
553
  }
492
554
 
493
- return _context2.abrupt("continue", 32);
494
-
495
- case 27:
496
- if (!(_file2.state === _utils.FileState.UPLOADING)) {
497
- _context2.next = 30;
555
+ if (!(_file3.state === _utils.FileState.NOT_SUPPORTED)) {
556
+ _context2.next = 28;
498
557
  break;
499
558
  }
500
559
 
501
- sending.current = false;
502
560
  return _context2.abrupt("return");
503
561
 
562
+ case 28:
563
+ attachments.push(mapFileUploadToAttachment(_file3));
564
+ return _context2.abrupt("continue", 36);
565
+
504
566
  case 30:
505
- mime_type = (0, _mimeTypes.lookup)(_file2.file.name);
506
-
507
- if (_file2.state === _utils.FileState.UPLOADED || _file2.state === _utils.FileState.FINISHED || enableOfflineSupport && _file2.state === _utils.FileState.UPLOAD_FAILED) {
508
- if ((_file2$file$type = _file2.file.type) != null && _file2$file$type.startsWith('image/')) {
509
- attachments.push({
510
- fallback: _file2.file.name,
511
- image_url: _file2.url,
512
- mime_type: mime_type ? mime_type : undefined,
513
- originalFile: _file2.file,
514
- type: 'image'
515
- });
516
- } else if ((_file2$file$type2 = _file2.file.type) != null && _file2$file$type2.startsWith('audio/')) {
517
- attachments.push({
518
- asset_url: _file2.url || _file2.file.uri,
519
- duration: _file2.file.duration,
520
- file_size: _file2.file.size,
521
- mime_type: _file2.file.type,
522
- originalFile: _file2.file,
523
- title: _file2.file.name,
524
- type: 'audio'
525
- });
526
- } else if ((_file2$file$type3 = _file2.file.type) != null && _file2$file$type3.startsWith('video/')) {
527
- attachments.push({
528
- asset_url: _file2.url || _file2.file.uri,
529
- duration: _file2.file.duration,
530
- file_size: _file2.file.size,
531
- mime_type: _file2.file.type,
532
- originalFile: _file2.file,
533
- thumb_url: _file2.thumb_url,
534
- title: _file2.file.name,
535
- type: 'video'
536
- });
537
- } else {
538
- attachments.push({
539
- asset_url: _file2.url || _file2.file.uri,
540
- file_size: _file2.file.size,
541
- mime_type: _file2.file.type,
542
- originalFile: _file2.file,
543
- title: _file2.file.name,
544
- type: 'file'
545
- });
546
- }
567
+ if (!(!_file3 || _file3.state === _utils.FileState.UPLOAD_FAILED)) {
568
+ _context2.next = 32;
569
+ break;
547
570
  }
548
571
 
572
+ return _context2.abrupt("continue", 36);
573
+
549
574
  case 32:
575
+ if (!(_file3.state === _utils.FileState.UPLOADING)) {
576
+ _context2.next = 35;
577
+ break;
578
+ }
579
+
580
+ sending.current = false;
581
+ return _context2.abrupt("return");
582
+
583
+ case 35:
584
+ if (_file3.state === _utils.FileState.UPLOADED || _file3.state === _utils.FileState.FINISHED) {
585
+ attachments.push(mapFileUploadToAttachment(_file3));
586
+ }
587
+
588
+ case 36:
550
589
  _context2.next = 23;
551
590
  break;
552
591
 
553
- case 34:
592
+ case 38:
554
593
  if (!(!prevText && attachments.length === 0)) {
555
- _context2.next = 37;
594
+ _context2.next = 41;
556
595
  break;
557
596
  }
558
597
 
559
598
  sending.current = false;
560
599
  return _context2.abrupt("return");
561
600
 
562
- case 37:
601
+ case 41:
563
602
  if (value.editing && !(0, _useMessageDetailsForState.isEditingBoolean)(value.editing)) {
564
603
  updatedMessage = (0, _extends2["default"])({}, value.editing, {
565
604
  attachments: attachments,
@@ -568,7 +607,7 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
568
607
  text: prevText
569
608
  });
570
609
  value.clearEditingState();
571
- updateMessagePromise = value.editMessage(updatedMessage).then(value.clearEditingState);
610
+ updateMessagePromise = value.editMessage((0, _removeReservedFields.removeReservedFields)(updatedMessage)).then(value.clearEditingState);
572
611
  resetInput(attachments);
573
612
  (0, _streamChat.logChatPromiseExecution)(updateMessagePromise, 'update message');
574
613
  sending.current = false;
@@ -597,7 +636,7 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
597
636
  }
598
637
  }
599
638
 
600
- case 38:
639
+ case 42:
601
640
  case "end":
602
641
  return _context2.stop();
603
642
  }
@@ -1192,7 +1231,7 @@ var MessageInputProvider = function MessageInputProvider(_ref) {
1192
1231
  __self: _this,
1193
1232
  __source: {
1194
1233
  fileName: _jsxFileName,
1195
- lineNumber: 1162,
1234
+ lineNumber: 1181,
1196
1235
  columnNumber: 5
1197
1236
  }
1198
1237
  }, children);
@@ -1219,7 +1258,7 @@ var withMessageInputContext = function withMessageInputContext(Component) {
1219
1258
  __self: _this,
1220
1259
  __source: {
1221
1260
  fileName: _jsxFileName,
1222
- lineNumber: 1202,
1261
+ lineNumber: 1221,
1223
1262
  columnNumber: 12
1224
1263
  }
1225
1264
  }));