stream-chat-react-native-core 9.0.2-beta.1 → 9.1.0-beta.1
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/lib/commonjs/components/Attachment/Attachment.js +38 -10
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/AttachmentFileUploadProgressIndicator.js +97 -0
- package/lib/commonjs/components/Attachment/AttachmentFileUploadProgressIndicator.js.map +1 -0
- package/lib/commonjs/components/Attachment/AttachmentUploadIndicator.js +97 -0
- package/lib/commonjs/components/Attachment/AttachmentUploadIndicator.js.map +1 -0
- package/lib/commonjs/components/Attachment/CircularProgressIndicator.js +141 -0
- package/lib/commonjs/components/Attachment/CircularProgressIndicator.js.map +1 -0
- package/lib/commonjs/components/Attachment/FileAttachment.js +18 -4
- package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +7 -1
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/MediaUploadProgressOverlay.js +59 -0
- package/lib/commonjs/components/Attachment/MediaUploadProgressOverlay.js.map +1 -0
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +18 -8
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +2 -0
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +6 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +94 -92
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js +10 -1
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +1 -1
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js +50 -57
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js +10 -6
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js +12 -6
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js +13 -7
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js +6 -2
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js.map +1 -1
- package/lib/commonjs/components/Poll/CreatePollContent.js +3 -3
- package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -1
- package/lib/commonjs/components/index.js +33 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +6 -0
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +3 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js +4 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +5 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/hooks/index.js +11 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/usePendingAttachmentUpload.js +106 -0
- package/lib/commonjs/hooks/usePendingAttachmentUpload.js.map +1 -0
- package/lib/commonjs/i18n/en.json +8 -0
- package/lib/commonjs/i18n/es.json +8 -0
- package/lib/commonjs/i18n/fr.json +8 -0
- package/lib/commonjs/i18n/he.json +8 -0
- package/lib/commonjs/i18n/hi.json +8 -0
- package/lib/commonjs/i18n/it.json +8 -0
- package/lib/commonjs/i18n/ja.json +8 -0
- package/lib/commonjs/i18n/ko.json +8 -0
- package/lib/commonjs/i18n/nl.json +8 -0
- package/lib/commonjs/i18n/pt-br.json +8 -0
- package/lib/commonjs/i18n/ru.json +8 -0
- package/lib/commonjs/i18n/tr.json +8 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/middlewares/attachments.js +2 -0
- package/lib/commonjs/middlewares/attachments.js.map +1 -1
- package/lib/commonjs/native.js +8 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/nativeMultipartUpload.js +237 -0
- package/lib/commonjs/nativeMultipartUpload.js.map +1 -0
- package/lib/commonjs/types/types.js.map +1 -1
- package/lib/commonjs/utils/installNativeMultipartAdapter.js +223 -0
- package/lib/commonjs/utils/installNativeMultipartAdapter.js.map +1 -0
- package/lib/commonjs/utils/utils.js +2 -2
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +38 -10
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/AttachmentFileUploadProgressIndicator.js +97 -0
- package/lib/module/components/Attachment/AttachmentFileUploadProgressIndicator.js.map +1 -0
- package/lib/module/components/Attachment/AttachmentUploadIndicator.js +97 -0
- package/lib/module/components/Attachment/AttachmentUploadIndicator.js.map +1 -0
- package/lib/module/components/Attachment/CircularProgressIndicator.js +141 -0
- package/lib/module/components/Attachment/CircularProgressIndicator.js.map +1 -0
- package/lib/module/components/Attachment/FileAttachment.js +18 -4
- package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +7 -1
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/MediaUploadProgressOverlay.js +59 -0
- package/lib/module/components/Attachment/MediaUploadProgressOverlay.js.map +1 -0
- package/lib/module/components/Attachment/VideoThumbnail.js +18 -8
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +2 -0
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +6 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +94 -92
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Chat/Chat.js +10 -1
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Indicators/EmptyStateIndicator.js +1 -1
- package/lib/module/components/Indicators/EmptyStateIndicator.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js +50 -57
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js +10 -6
- package/lib/module/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js +12 -6
- package/lib/module/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js +13 -7
- package/lib/module/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js +6 -2
- package/lib/module/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js.map +1 -1
- package/lib/module/components/Poll/CreatePollContent.js +3 -3
- package/lib/module/components/Poll/CreatePollContent.js.map +1 -1
- package/lib/module/components/index.js +33 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/componentsContext/defaultComponents.js +6 -0
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +3 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js +4 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +5 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/hooks/index.js +11 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/usePendingAttachmentUpload.js +106 -0
- package/lib/module/hooks/usePendingAttachmentUpload.js.map +1 -0
- package/lib/module/i18n/en.json +8 -0
- package/lib/module/i18n/es.json +8 -0
- package/lib/module/i18n/fr.json +8 -0
- package/lib/module/i18n/he.json +8 -0
- package/lib/module/i18n/hi.json +8 -0
- package/lib/module/i18n/it.json +8 -0
- package/lib/module/i18n/ja.json +8 -0
- package/lib/module/i18n/ko.json +8 -0
- package/lib/module/i18n/nl.json +8 -0
- package/lib/module/i18n/pt-br.json +8 -0
- package/lib/module/i18n/ru.json +8 -0
- package/lib/module/i18n/tr.json +8 -0
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/middlewares/attachments.js +2 -0
- package/lib/module/middlewares/attachments.js.map +1 -1
- package/lib/module/native.js +8 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/nativeMultipartUpload.js +237 -0
- package/lib/module/nativeMultipartUpload.js.map +1 -0
- package/lib/module/types/types.js.map +1 -1
- package/lib/module/utils/installNativeMultipartAdapter.js +223 -0
- package/lib/module/utils/installNativeMultipartAdapter.js.map +1 -0
- package/lib/module/utils/utils.js +2 -2
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/AttachmentFileUploadProgressIndicator.d.ts +14 -0
- package/lib/typescript/components/Attachment/AttachmentFileUploadProgressIndicator.d.ts.map +1 -0
- package/lib/typescript/components/Attachment/AttachmentUploadIndicator.d.ts +18 -0
- package/lib/typescript/components/Attachment/AttachmentUploadIndicator.d.ts.map +1 -0
- package/lib/typescript/components/Attachment/CircularProgressIndicator.d.ts +18 -0
- package/lib/typescript/components/Attachment/CircularProgressIndicator.d.ts.map +1 -0
- package/lib/typescript/components/Attachment/FileAttachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/MediaUploadProgressOverlay.d.ts +12 -0
- package/lib/typescript/components/Attachment/MediaUploadProgressOverlay.d.ts.map +1 -0
- package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
- package/lib/typescript/components/Attachment/VideoThumbnail.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/utils/buildGallery/buildThumbnail.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +2 -0
- package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts +10 -0
- package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
- package/lib/typescript/components/Indicators/EmptyStateIndicator.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.d.ts +7 -2
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/Poll/CreatePollContent.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +5 -2
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +5 -0
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +5 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +1 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/usePendingAttachmentUpload.d.ts +14 -0
- package/lib/typescript/hooks/usePendingAttachmentUpload.d.ts.map +1 -0
- package/lib/typescript/i18n/en.json +8 -0
- package/lib/typescript/i18n/es.json +8 -0
- package/lib/typescript/i18n/fr.json +8 -0
- package/lib/typescript/i18n/he.json +8 -0
- package/lib/typescript/i18n/hi.json +8 -0
- package/lib/typescript/i18n/it.json +8 -0
- package/lib/typescript/i18n/ja.json +8 -0
- package/lib/typescript/i18n/ko.json +8 -0
- package/lib/typescript/i18n/nl.json +8 -0
- package/lib/typescript/i18n/pt-br.json +8 -0
- package/lib/typescript/i18n/ru.json +8 -0
- package/lib/typescript/i18n/tr.json +8 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/middlewares/attachments.d.ts.map +1 -1
- package/lib/typescript/native.d.ts +5 -2
- package/lib/typescript/native.d.ts.map +1 -1
- package/lib/typescript/nativeMultipartUpload.d.ts +98 -0
- package/lib/typescript/nativeMultipartUpload.d.ts.map +1 -0
- package/lib/typescript/types/types.d.ts +2 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +8 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/installNativeMultipartAdapter.d.ts +8 -0
- package/lib/typescript/utils/installNativeMultipartAdapter.d.ts.map +1 -0
- package/lib/typescript/utils/utils.d.ts +1 -1
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/nativeMultipartUpload.test.ts +267 -0
- package/src/components/Attachment/Attachment.tsx +54 -5
- package/src/components/Attachment/AttachmentFileUploadProgressIndicator.tsx +108 -0
- package/src/components/Attachment/AttachmentUploadIndicator.tsx +112 -0
- package/src/components/Attachment/CircularProgressIndicator.tsx +161 -0
- package/src/components/Attachment/FileAttachment.tsx +22 -6
- package/src/components/Attachment/Gallery.tsx +9 -1
- package/src/components/Attachment/MediaUploadProgressOverlay.tsx +77 -0
- package/src/components/Attachment/VideoThumbnail.tsx +17 -9
- package/src/components/Attachment/__tests__/Attachment.test.tsx +63 -16
- package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +3 -0
- package/src/components/Attachment/utils/buildGallery/types.ts +2 -0
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +4 -2
- package/src/components/Channel/Channel.tsx +65 -61
- package/src/components/Chat/Chat.tsx +20 -0
- package/src/components/Indicators/EmptyStateIndicator.tsx +3 -1
- package/src/components/MessageInput/__tests__/AttachmentUploadPreviewList.test.tsx +51 -6
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreview.test.tsx +31 -1
- package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.tsx +38 -47
- package/src/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.tsx +11 -5
- package/src/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.tsx +20 -5
- package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx +20 -9
- package/src/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.tsx +7 -1
- package/src/components/Poll/CreatePollContent.tsx +5 -3
- package/src/components/index.ts +3 -0
- package/src/contexts/componentsContext/defaultComponents.ts +6 -0
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +3 -1
- package/src/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.ts +5 -1
- package/src/contexts/themeContext/utils/theme.ts +10 -0
- package/src/hooks/__tests__/usePendingAttachmentUpload.test.tsx +106 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/usePendingAttachmentUpload.ts +131 -0
- package/src/i18n/en.json +8 -0
- package/src/i18n/es.json +8 -0
- package/src/i18n/fr.json +8 -0
- package/src/i18n/he.json +8 -0
- package/src/i18n/hi.json +8 -0
- package/src/i18n/it.json +8 -0
- package/src/i18n/ja.json +8 -0
- package/src/i18n/ko.json +8 -0
- package/src/i18n/nl.json +8 -0
- package/src/i18n/pt-br.json +8 -0
- package/src/i18n/ru.json +8 -0
- package/src/i18n/tr.json +8 -0
- package/src/index.ts +1 -0
- package/src/middlewares/attachments.ts +2 -0
- package/src/native.ts +28 -0
- package/src/nativeMultipartUpload.ts +384 -0
- package/src/types/types.ts +2 -0
- package/src/utils/__tests__/installNativeMultipartAdapter.test.ts +437 -0
- package/src/utils/installNativeMultipartAdapter.ts +302 -0
- package/src/utils/utils.ts +3 -3
- package/src/version.json +1 -1
|
@@ -11,7 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _reactNative = require("react-native");
|
|
12
12
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
13
13
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
14
|
-
var _mimeTypes = require("mime-types");
|
|
15
14
|
var _streamChat = require("stream-chat");
|
|
16
15
|
var _useChannelDataState2 = require("./hooks/useChannelDataState");
|
|
17
16
|
var _useCreateChannelContext = require("./hooks/useCreateChannelContext");
|
|
@@ -768,63 +767,66 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
768
767
|
var _ref15 = (0, _asyncToGenerator2.default)(function* (message) {
|
|
769
768
|
var _updatedMessage$attac;
|
|
770
769
|
var updatedMessage = Object.assign({}, message);
|
|
771
|
-
if ((_updatedMessage$attac = updatedMessage.attachments) != null && _updatedMessage$attac.length) {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
770
|
+
if (!((_updatedMessage$attac = updatedMessage.attachments) != null && _updatedMessage$attac.length) || !(channel != null && channel.cid)) {
|
|
771
|
+
return updatedMessage;
|
|
772
|
+
}
|
|
773
|
+
var uploadOne = function () {
|
|
774
|
+
var _ref16 = (0, _asyncToGenerator2.default)(function* (attachment) {
|
|
775
|
+
var _client$offlineDb;
|
|
775
776
|
if (attachment.image_url && !(0, _utils.isLocalUrl)(attachment.image_url) || attachment.asset_url && !(0, _utils.isLocalUrl)(attachment.asset_url)) {
|
|
776
|
-
|
|
777
|
+
return;
|
|
777
778
|
}
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
var
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
message: Object.assign({}, updatedMessage, {
|
|
796
|
-
cid: channel.cid
|
|
797
|
-
})
|
|
798
|
-
});
|
|
799
|
-
}, {
|
|
800
|
-
method: 'updateMessage'
|
|
779
|
+
var originalFile = attachment.originalFile;
|
|
780
|
+
if (!(originalFile != null && originalFile.uri)) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
var localId = attachment.localId;
|
|
784
|
+
if (!localId) {
|
|
785
|
+
console.warn('uploadPendingAttachments: local attachment missing localId, skipping upload');
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
var fileForUpload = originalFile;
|
|
789
|
+
if (attachment.type === _types.FileTypes.Image && !doFileUploadRequest) {
|
|
790
|
+
var _originalFile$name;
|
|
791
|
+
var filename = (_originalFile$name = originalFile.name) != null ? _originalFile$name : (0, _utils.getFileNameFromPath)(originalFile.uri);
|
|
792
|
+
var compressedUri = yield (0, _compressImage.compressedImageURI)(originalFile, compressImageQuality);
|
|
793
|
+
fileForUpload = Object.assign({}, originalFile, {
|
|
794
|
+
name: filename,
|
|
795
|
+
uri: compressedUri
|
|
801
796
|
});
|
|
802
797
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
798
|
+
var response = yield client.uploadManager.upload({
|
|
799
|
+
channelCid: channel.cid,
|
|
800
|
+
file: fileForUpload,
|
|
801
|
+
id: localId
|
|
802
|
+
});
|
|
803
|
+
if (attachment.type === _types.FileTypes.Image) {
|
|
804
|
+
attachment.image_url = response.file;
|
|
805
|
+
} else {
|
|
811
806
|
attachment.asset_url = response.file;
|
|
812
807
|
if (response.thumb_url) {
|
|
813
808
|
attachment.thumb_url = response.thumb_url;
|
|
814
809
|
}
|
|
815
|
-
delete attachment.originalFile;
|
|
816
|
-
(_client$offlineDb2 = client.offlineDb) == null || _client$offlineDb2.executeQuerySafely(function (db) {
|
|
817
|
-
return db.updateMessage({
|
|
818
|
-
message: Object.assign({}, updatedMessage, {
|
|
819
|
-
cid: channel.cid
|
|
820
|
-
})
|
|
821
|
-
});
|
|
822
|
-
}, {
|
|
823
|
-
method: 'updateMessage'
|
|
824
|
-
});
|
|
825
810
|
}
|
|
826
|
-
|
|
827
|
-
|
|
811
|
+
delete attachment.originalFile;
|
|
812
|
+
delete attachment.localId;
|
|
813
|
+
(_client$offlineDb = client.offlineDb) == null || _client$offlineDb.executeQuerySafely(function (db) {
|
|
814
|
+
return db.updateMessage({
|
|
815
|
+
message: Object.assign({}, updatedMessage, {
|
|
816
|
+
cid: channel.cid
|
|
817
|
+
})
|
|
818
|
+
});
|
|
819
|
+
}, {
|
|
820
|
+
method: 'updateMessage'
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
return function uploadOne(_x4) {
|
|
824
|
+
return _ref16.apply(this, arguments);
|
|
825
|
+
};
|
|
826
|
+
}();
|
|
827
|
+
yield Promise.all(updatedMessage.attachments.map(function (att) {
|
|
828
|
+
return uploadOne(att);
|
|
829
|
+
}));
|
|
828
830
|
return updatedMessage;
|
|
829
831
|
});
|
|
830
832
|
return function (_x3) {
|
|
@@ -832,15 +834,15 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
832
834
|
};
|
|
833
835
|
}());
|
|
834
836
|
var sendMessageRequest = (0, _hooks.useStableCallback)(function () {
|
|
835
|
-
var
|
|
836
|
-
var localMessage =
|
|
837
|
-
message =
|
|
838
|
-
options =
|
|
839
|
-
retrying =
|
|
837
|
+
var _ref18 = (0, _asyncToGenerator2.default)(function* (_ref17) {
|
|
838
|
+
var localMessage = _ref17.localMessage,
|
|
839
|
+
message = _ref17.message,
|
|
840
|
+
options = _ref17.options,
|
|
841
|
+
retrying = _ref17.retrying;
|
|
840
842
|
var failedMessageUpdated = false;
|
|
841
843
|
var handleFailedMessage = function handleFailedMessage() {
|
|
842
844
|
if (!failedMessageUpdated) {
|
|
843
|
-
var _client$
|
|
845
|
+
var _client$offlineDb2;
|
|
844
846
|
var updatedMessage = Object.assign({}, localMessage, {
|
|
845
847
|
cid: channel.cid,
|
|
846
848
|
status: _utils.MessageStatusTypes.FAILED
|
|
@@ -850,7 +852,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
850
852
|
message: updatedMessage
|
|
851
853
|
});
|
|
852
854
|
optimisticallyUpdatedNewMessages.delete(localMessage.id);
|
|
853
|
-
(_client$
|
|
855
|
+
(_client$offlineDb2 = client.offlineDb) == null || _client$offlineDb2.executeQuerySafely(function (db) {
|
|
854
856
|
return db.updateMessage({
|
|
855
857
|
message: updatedMessage
|
|
856
858
|
});
|
|
@@ -884,11 +886,11 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
884
886
|
messageResponse = yield channel.sendMessage(messageData, options);
|
|
885
887
|
}
|
|
886
888
|
if ((_messageResponse = messageResponse) != null && _messageResponse.message) {
|
|
887
|
-
var _client$
|
|
889
|
+
var _client$offlineDb3;
|
|
888
890
|
var newMessageResponse = Object.assign({}, messageResponse.message, {
|
|
889
891
|
status: _utils.MessageStatusTypes.RECEIVED
|
|
890
892
|
});
|
|
891
|
-
(_client$
|
|
893
|
+
(_client$offlineDb3 = client.offlineDb) == null || _client$offlineDb3.executeQuerySafely(function (db) {
|
|
892
894
|
return db.updateMessage({
|
|
893
895
|
message: Object.assign({}, newMessageResponse, {
|
|
894
896
|
cid: channel.cid
|
|
@@ -908,16 +910,16 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
908
910
|
yield handleFailedMessage();
|
|
909
911
|
}
|
|
910
912
|
});
|
|
911
|
-
return function (
|
|
912
|
-
return
|
|
913
|
+
return function (_x5) {
|
|
914
|
+
return _ref18.apply(this, arguments);
|
|
913
915
|
};
|
|
914
916
|
}());
|
|
915
917
|
var sendMessage = (0, _hooks.useStableCallback)(function () {
|
|
916
|
-
var
|
|
917
|
-
var _channel$state, _client$
|
|
918
|
-
var localMessage =
|
|
919
|
-
message =
|
|
920
|
-
options =
|
|
918
|
+
var _ref20 = (0, _asyncToGenerator2.default)(function* (_ref19) {
|
|
919
|
+
var _channel$state, _client$offlineDb4;
|
|
920
|
+
var localMessage = _ref19.localMessage,
|
|
921
|
+
message = _ref19.message,
|
|
922
|
+
options = _ref19.options;
|
|
921
923
|
if (channel != null && (_channel$state = channel.state) != null && _channel$state.filterErrorMessages) {
|
|
922
924
|
channel.state.filterErrorMessages();
|
|
923
925
|
}
|
|
@@ -926,7 +928,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
926
928
|
message: localMessage
|
|
927
929
|
});
|
|
928
930
|
optimisticallyUpdatedNewMessages.add(localMessage.id);
|
|
929
|
-
(_client$
|
|
931
|
+
(_client$offlineDb4 = client.offlineDb) == null || _client$offlineDb4.executeQuerySafely(function (db) {
|
|
930
932
|
return db.upsertMessages({
|
|
931
933
|
messages: [Object.assign({}, localMessage, {
|
|
932
934
|
cid: channel.cid,
|
|
@@ -949,12 +951,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
949
951
|
options: options
|
|
950
952
|
});
|
|
951
953
|
});
|
|
952
|
-
return function (
|
|
953
|
-
return
|
|
954
|
+
return function (_x6) {
|
|
955
|
+
return _ref20.apply(this, arguments);
|
|
954
956
|
};
|
|
955
957
|
}());
|
|
956
958
|
var retrySendMessage = (0, _hooks.useStableCallback)(function () {
|
|
957
|
-
var
|
|
959
|
+
var _ref21 = (0, _asyncToGenerator2.default)(function* (localMessage) {
|
|
958
960
|
var statusPendingMessage = Object.assign({}, localMessage, {
|
|
959
961
|
status: _utils.MessageStatusTypes.SENDING
|
|
960
962
|
});
|
|
@@ -968,15 +970,15 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
968
970
|
retrying: true
|
|
969
971
|
});
|
|
970
972
|
});
|
|
971
|
-
return function (
|
|
972
|
-
return
|
|
973
|
+
return function (_x7) {
|
|
974
|
+
return _ref21.apply(this, arguments);
|
|
973
975
|
};
|
|
974
976
|
}());
|
|
975
977
|
var editMessage = (0, _hooks.useStableCallback)(function () {
|
|
976
|
-
var
|
|
977
|
-
var _client$
|
|
978
|
-
var localMessage =
|
|
979
|
-
options =
|
|
978
|
+
var _ref23 = (0, _asyncToGenerator2.default)(function* (_ref22) {
|
|
979
|
+
var _client$offlineDb5;
|
|
980
|
+
var localMessage = _ref22.localMessage,
|
|
981
|
+
options = _ref22.options;
|
|
980
982
|
if (!channel) {
|
|
981
983
|
throw new Error('Channel has not been initialized');
|
|
982
984
|
}
|
|
@@ -992,7 +994,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
992
994
|
});
|
|
993
995
|
updateMessage(optimisticMessage);
|
|
994
996
|
threadInstance == null || threadInstance.updateParentMessageOrReplyLocally(optimisticMessage);
|
|
995
|
-
(_client$
|
|
997
|
+
(_client$offlineDb5 = client.offlineDb) == null || _client$offlineDb5.executeQuerySafely(function (db) {
|
|
996
998
|
return db.updateMessage({
|
|
997
999
|
message: Object.assign({}, optimisticMessage, {
|
|
998
1000
|
cid: cid
|
|
@@ -1003,10 +1005,10 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1003
1005
|
});
|
|
1004
1006
|
var response = doUpdateMessageRequest ? yield doUpdateMessageRequest(cid, localMessage, options) : yield client.updateMessage(localMessage, undefined, options);
|
|
1005
1007
|
if (response != null && response.message) {
|
|
1006
|
-
var _client$
|
|
1008
|
+
var _client$offlineDb6;
|
|
1007
1009
|
updateMessage(response.message);
|
|
1008
1010
|
threadInstance == null || threadInstance.updateParentMessageOrReplyLocally(response.message);
|
|
1009
|
-
(_client$
|
|
1011
|
+
(_client$offlineDb6 = client.offlineDb) == null || _client$offlineDb6.executeQuerySafely(function (db) {
|
|
1010
1012
|
return db.updateMessage({
|
|
1011
1013
|
message: Object.assign({}, response.message, {
|
|
1012
1014
|
cid: cid
|
|
@@ -1018,12 +1020,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1018
1020
|
}
|
|
1019
1021
|
return response;
|
|
1020
1022
|
});
|
|
1021
|
-
return function (
|
|
1022
|
-
return
|
|
1023
|
+
return function (_x8) {
|
|
1024
|
+
return _ref23.apply(this, arguments);
|
|
1023
1025
|
};
|
|
1024
1026
|
}());
|
|
1025
1027
|
var removeMessage = (0, _hooks.useStableCallback)(function () {
|
|
1026
|
-
var
|
|
1028
|
+
var _ref24 = (0, _asyncToGenerator2.default)(function* (message) {
|
|
1027
1029
|
if (channel) {
|
|
1028
1030
|
channel.state.removeMessage(message);
|
|
1029
1031
|
copyMessagesStateFromChannel(channel);
|
|
@@ -1037,12 +1039,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1037
1039
|
});
|
|
1038
1040
|
}
|
|
1039
1041
|
});
|
|
1040
|
-
return function (
|
|
1041
|
-
return
|
|
1042
|
+
return function (_x9) {
|
|
1043
|
+
return _ref24.apply(this, arguments);
|
|
1042
1044
|
};
|
|
1043
1045
|
}());
|
|
1044
1046
|
var sendReaction = (0, _hooks.useStableCallback)(function () {
|
|
1045
|
-
var
|
|
1047
|
+
var _ref25 = (0, _asyncToGenerator2.default)(function* (type, messageId) {
|
|
1046
1048
|
if (!(channel != null && channel.id) || !client.user) {
|
|
1047
1049
|
throw new Error('Channel has not been initialized');
|
|
1048
1050
|
}
|
|
@@ -1068,12 +1070,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1068
1070
|
});
|
|
1069
1071
|
}
|
|
1070
1072
|
});
|
|
1071
|
-
return function (
|
|
1072
|
-
return
|
|
1073
|
+
return function (_x10, _x11) {
|
|
1074
|
+
return _ref25.apply(this, arguments);
|
|
1073
1075
|
};
|
|
1074
1076
|
}());
|
|
1075
1077
|
var deleteMessage = (0, _hooks.useStableCallback)(function () {
|
|
1076
|
-
var
|
|
1078
|
+
var _ref26 = (0, _asyncToGenerator2.default)(function* (message) {
|
|
1077
1079
|
var optionsOrHardDelete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1078
1080
|
var options = {};
|
|
1079
1081
|
if (typeof optionsOrHardDelete === 'boolean') {
|
|
@@ -1110,12 +1112,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1110
1112
|
updateMessage(Object.assign({}, data.message));
|
|
1111
1113
|
}
|
|
1112
1114
|
});
|
|
1113
|
-
return function (
|
|
1114
|
-
return
|
|
1115
|
+
return function (_x12) {
|
|
1116
|
+
return _ref26.apply(this, arguments);
|
|
1115
1117
|
};
|
|
1116
1118
|
}());
|
|
1117
1119
|
var deleteReaction = (0, _hooks.useStableCallback)(function () {
|
|
1118
|
-
var
|
|
1120
|
+
var _ref27 = (0, _asyncToGenerator2.default)(function* (type, messageId) {
|
|
1119
1121
|
if (!(channel != null && channel.id) || !client.user) {
|
|
1120
1122
|
throw new Error('Channel has not been initialized');
|
|
1121
1123
|
}
|
|
@@ -1131,8 +1133,8 @@ var ChannelWithContext = function ChannelWithContext(props) {
|
|
|
1131
1133
|
}
|
|
1132
1134
|
yield channel.deleteReaction.apply(channel, payload);
|
|
1133
1135
|
});
|
|
1134
|
-
return function (
|
|
1135
|
-
return
|
|
1136
|
+
return function (_x13, _x14) {
|
|
1137
|
+
return _ref27.apply(this, arguments);
|
|
1136
1138
|
};
|
|
1137
1139
|
}());
|
|
1138
1140
|
var openThread = (0, _react.useCallback)(function (message) {
|