stream-chat-react-native-core 4.7.0-beta.5 → 4.7.1-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 +23 -13
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Card.js +63 -30
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachment.js +10 -17
- package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +22 -10
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/openUrlSafely.js +54 -0
- package/lib/commonjs/components/Attachment/utils/openUrlSafely.js.map +1 -0
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +90 -56
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +23 -22
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +8 -8
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +10 -7
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +2 -2
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +12 -12
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +2 -2
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js.map +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js +14 -4
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +14 -4
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js +14 -4
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +15 -9
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js +14 -4
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +14 -4
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js +2 -2
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js +14 -4
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +14 -4
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +14 -4
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js +4 -4
- package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +14 -4
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js +13 -3
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +12 -12
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +13 -3
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +14 -4
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +14 -4
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/ThemeContext.js +13 -7
- package/lib/commonjs/contexts/themeContext/ThemeContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +9 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/contexts/threadContext/ThreadContext.js +14 -4
- package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +15 -6
- package/lib/commonjs/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/commonjs/contexts/typingContext/TypingContext.js +14 -4
- package/lib/commonjs/contexts/typingContext/TypingContext.js.map +1 -1
- package/lib/commonjs/contexts/utils/defaultBaseContextValue.js +7 -0
- package/lib/commonjs/contexts/utils/defaultBaseContextValue.js.map +1 -0
- package/lib/commonjs/contexts/utils/isTestEnvironment.js +11 -0
- package/lib/commonjs/contexts/utils/isTestEnvironment.js.map +1 -0
- package/lib/commonjs/mock-builders/mock.js +30 -5
- package/lib/commonjs/mock-builders/mock.js.map +1 -1
- package/lib/commonjs/native.js +8 -2
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +23 -13
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/Card.js +63 -30
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachment.js +10 -17
- package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +22 -10
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/utils/openUrlSafely.js +54 -0
- package/lib/module/components/Attachment/utils/openUrlSafely.js.map +1 -0
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +90 -56
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +23 -22
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +8 -8
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/module/components/Message/Message.js +10 -7
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +2 -2
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +12 -12
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +2 -2
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js.map +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js +14 -4
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +14 -4
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js +14 -4
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +15 -9
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js +14 -4
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +14 -4
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/module/contexts/keyboardContext/KeyboardContext.js +2 -2
- package/lib/module/contexts/keyboardContext/KeyboardContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js +14 -4
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +14 -4
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +14 -4
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js +4 -4
- package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +14 -4
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js +13 -3
- package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +12 -12
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +13 -3
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +14 -4
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +14 -4
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/contexts/themeContext/ThemeContext.js +13 -7
- package/lib/module/contexts/themeContext/ThemeContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +9 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/contexts/threadContext/ThreadContext.js +14 -4
- package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +15 -6
- package/lib/module/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/module/contexts/typingContext/TypingContext.js +14 -4
- package/lib/module/contexts/typingContext/TypingContext.js.map +1 -1
- package/lib/module/contexts/utils/defaultBaseContextValue.js +7 -0
- package/lib/module/contexts/utils/defaultBaseContextValue.js.map +1 -0
- package/lib/module/contexts/utils/isTestEnvironment.js +11 -0
- package/lib/module/contexts/utils/isTestEnvironment.js.map +1 -0
- package/lib/module/mock-builders/mock.js +30 -5
- package/lib/module/mock-builders/mock.js.map +1 -1
- package/lib/module/native.js +8 -2
- package/lib/module/native.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/__tests__/openUrlSafely.test.d.ts +1 -0
- package/lib/typescript/components/Attachment/utils/openUrlSafely.d.ts +1 -0
- package/lib/typescript/contexts/__tests__/index.test.d.ts +1 -0
- package/lib/typescript/contexts/keyboardContext/KeyboardContext.d.ts +6 -2
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +5 -2
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +6 -0
- package/lib/typescript/contexts/utils/defaultBaseContextValue.d.ts +1 -0
- package/lib/typescript/contexts/utils/isTestEnvironment.d.ts +1 -0
- package/lib/typescript/mock-builders/mock.d.ts +2 -2
- package/lib/typescript/native.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +4 -1
- package/src/components/Attachment/Card.tsx +30 -9
- package/src/components/Attachment/FileAttachment.tsx +2 -4
- package/src/components/Attachment/Gallery.tsx +17 -4
- package/src/components/Attachment/__tests__/Attachment.test.js +0 -53
- package/src/components/Attachment/__tests__/Giphy.test.js +9 -5
- package/src/components/Attachment/__tests__/openUrlSafely.test.ts +48 -0
- package/src/components/Attachment/utils/openUrlSafely.ts +17 -0
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +5 -3
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +1 -0
- package/src/components/ImageGallery/ImageGallery.tsx +7 -3
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +16 -13
- package/src/components/ImageGallery/components/__tests__/ImageGalleryHeader.test.tsx +5 -3
- package/src/components/Message/Message.tsx +5 -2
- package/src/components/MessageInput/SendMessageDisallowedIndicator.tsx +1 -0
- package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -1
- package/src/components/Reply/Reply.tsx +6 -3
- package/src/contexts/__tests__/index.test.tsx +103 -0
- package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx +1 -0
- package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +18 -4
- package/src/contexts/channelContext/ChannelContext.tsx +18 -2
- package/src/contexts/channelsContext/ChannelsContext.tsx +18 -2
- package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +19 -10
- package/src/contexts/chatContext/ChatContext.tsx +15 -2
- package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +18 -3
- package/src/contexts/keyboardContext/KeyboardContext.tsx +2 -1
- package/src/contexts/messageContext/MessageContext.tsx +19 -2
- package/src/contexts/messageInputContext/MessageInputContext.tsx +20 -2
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +19 -3
- package/src/contexts/messageOverlayContext/hooks/useResettableState.test.tsx +1 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +19 -2
- package/src/contexts/overlayContext/OverlayContext.tsx +17 -2
- package/src/contexts/overlayContext/OverlayProvider.tsx +1 -0
- package/src/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.tsx +18 -3
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +15 -3
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +19 -2
- package/src/contexts/suggestionsContext/__tests__/Suggestions.test.js +1 -0
- package/src/contexts/themeContext/ThemeContext.tsx +19 -5
- package/src/contexts/themeContext/utils/theme.ts +15 -0
- package/src/contexts/threadContext/ThreadContext.tsx +16 -2
- package/src/contexts/translationContext/TranslationContext.tsx +18 -4
- package/src/contexts/typingContext/TypingContext.tsx +17 -2
- package/src/contexts/utils/defaultBaseContextValue.ts +1 -0
- package/src/contexts/utils/isTestEnvironment.ts +1 -0
- package/src/mock-builders/mock.js +16 -3
- package/src/native.ts +3 -1
- package/src/version.json +1 -1
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +0 -42
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +0 -1
- package/lib/module/components/Attachment/hooks/useGoToURL.js +0 -42
- package/lib/module/components/Attachment/hooks/useGoToURL.js.map +0 -1
- package/lib/typescript/components/Attachment/hooks/useGoToURL.d.ts +0 -2
- package/src/components/Attachment/hooks/useGoToURL.ts +0 -27
|
@@ -21,6 +21,8 @@ var _Giphy = require("../../components/Attachment/Giphy");
|
|
|
21
21
|
|
|
22
22
|
var _MessagesContext = require("../../contexts/messagesContext/MessagesContext");
|
|
23
23
|
|
|
24
|
+
var _native = require("../../native");
|
|
25
|
+
|
|
24
26
|
var _this = this,
|
|
25
27
|
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/Attachment/Attachment.tsx";
|
|
26
28
|
|
|
@@ -44,7 +46,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
44
46
|
__self: _this,
|
|
45
47
|
__source: {
|
|
46
48
|
fileName: _jsxFileName,
|
|
47
|
-
lineNumber:
|
|
49
|
+
lineNumber: 58,
|
|
48
50
|
columnNumber: 12
|
|
49
51
|
}
|
|
50
52
|
});
|
|
@@ -55,7 +57,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
55
57
|
__self: _this,
|
|
56
58
|
__source: {
|
|
57
59
|
fileName: _jsxFileName,
|
|
58
|
-
lineNumber:
|
|
60
|
+
lineNumber: 65,
|
|
59
61
|
columnNumber: 12
|
|
60
62
|
}
|
|
61
63
|
}));
|
|
@@ -67,7 +69,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
67
69
|
__self: _this,
|
|
68
70
|
__source: {
|
|
69
71
|
fileName: _jsxFileName,
|
|
70
|
-
lineNumber:
|
|
72
|
+
lineNumber: 71,
|
|
71
73
|
columnNumber: 9
|
|
72
74
|
}
|
|
73
75
|
}), hasAttachmentActions && _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
@@ -76,19 +78,19 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
76
78
|
__self: _this,
|
|
77
79
|
__source: {
|
|
78
80
|
fileName: _jsxFileName,
|
|
79
|
-
lineNumber:
|
|
81
|
+
lineNumber: 73,
|
|
80
82
|
columnNumber: 11
|
|
81
83
|
}
|
|
82
84
|
})));
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
if (attachment.type === 'video' && !attachment.og_scrape_url) {
|
|
86
|
-
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Gallery, {
|
|
88
|
+
return (0, _native.isVideoPackageAvailable)() ? _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Gallery, {
|
|
87
89
|
videos: [attachment],
|
|
88
90
|
__self: _this,
|
|
89
91
|
__source: {
|
|
90
92
|
fileName: _jsxFileName,
|
|
91
|
-
lineNumber:
|
|
93
|
+
lineNumber: 82,
|
|
92
94
|
columnNumber: 9
|
|
93
95
|
}
|
|
94
96
|
}), hasAttachmentActions && _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
@@ -97,10 +99,18 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
97
99
|
__self: _this,
|
|
98
100
|
__source: {
|
|
99
101
|
fileName: _jsxFileName,
|
|
100
|
-
lineNumber:
|
|
102
|
+
lineNumber: 84,
|
|
101
103
|
columnNumber: 11
|
|
102
104
|
}
|
|
103
|
-
})))
|
|
105
|
+
}))) : _react["default"].createElement(FileAttachment, {
|
|
106
|
+
attachment: attachment,
|
|
107
|
+
__self: _this,
|
|
108
|
+
__source: {
|
|
109
|
+
fileName: _jsxFileName,
|
|
110
|
+
lineNumber: 88,
|
|
111
|
+
columnNumber: 7
|
|
112
|
+
}
|
|
113
|
+
});
|
|
104
114
|
}
|
|
105
115
|
|
|
106
116
|
if (attachment.type === 'file' || attachment.type === 'audio') {
|
|
@@ -109,7 +119,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
109
119
|
__self: _this,
|
|
110
120
|
__source: {
|
|
111
121
|
fileName: _jsxFileName,
|
|
112
|
-
lineNumber:
|
|
122
|
+
lineNumber: 93,
|
|
113
123
|
columnNumber: 12
|
|
114
124
|
}
|
|
115
125
|
});
|
|
@@ -120,7 +130,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
120
130
|
__self: _this,
|
|
121
131
|
__source: {
|
|
122
132
|
fileName: _jsxFileName,
|
|
123
|
-
lineNumber:
|
|
133
|
+
lineNumber: 99,
|
|
124
134
|
columnNumber: 9
|
|
125
135
|
}
|
|
126
136
|
})), _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({
|
|
@@ -129,7 +139,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
129
139
|
__self: _this,
|
|
130
140
|
__source: {
|
|
131
141
|
fileName: _jsxFileName,
|
|
132
|
-
lineNumber:
|
|
142
|
+
lineNumber: 100,
|
|
133
143
|
columnNumber: 9
|
|
134
144
|
}
|
|
135
145
|
})));
|
|
@@ -138,7 +148,7 @@ var AttachmentWithContext = function AttachmentWithContext(props) {
|
|
|
138
148
|
__self: _this,
|
|
139
149
|
__source: {
|
|
140
150
|
fileName: _jsxFileName,
|
|
141
|
-
lineNumber:
|
|
151
|
+
lineNumber: 104,
|
|
142
152
|
columnNumber: 12
|
|
143
153
|
}
|
|
144
154
|
}));
|
|
@@ -207,7 +217,7 @@ var Attachment = function Attachment(props) {
|
|
|
207
217
|
__self: _this,
|
|
208
218
|
__source: {
|
|
209
219
|
fileName: _jsxFileName,
|
|
210
|
-
lineNumber:
|
|
220
|
+
lineNumber: 194,
|
|
211
221
|
columnNumber: 5
|
|
212
222
|
}
|
|
213
223
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Attachment.tsx"],"names":["AttachmentWithContext","props","attachment","AttachmentActions","Card","FileAttachment","Gallery","Giphy","giphyVersion","UrlPreview","hasAttachmentActions","actions","length","type","title_link","og_scrape_url","image_url","thumb_url","id","areEqual","prevProps","nextProps","prevAttachment","isAttachmentEqual","nextAttachment","attachmentEqual","MemoizedAttachment","React","memo","Attachment","PropAttachmentActions","PropCard","PropFileAttachment","PropGallery","PropGiphy","PropGiphyVersion","PropUrlPreview","ContextAttachmentActions","ContextCard","ContextFileAttachment","ContextGallery","ContextGiphy","ContextGiphyVersion","ContextUrlPreview","AttachmentActionsDefault","CardDefault","FileAttachmentDefault","GalleryDefault","GiphyDefault"],"mappings":";;;;;;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;AA4BA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAG5BC,KAH4B,EAIzB;AAAA;;AACH,MACEC,UADF,GASID,KATJ,CACEC,UADF;AAAA,MAEEC,iBAFF,GASIF,KATJ,CAEEE,iBAFF;AAAA,MAGEC,IAHF,GASIH,KATJ,CAGEG,IAHF;AAAA,MAIEC,cAJF,GASIJ,KATJ,CAIEI,cAJF;AAAA,MAKEC,OALF,GASIL,KATJ,CAKEK,OALF;AAAA,MAMEC,KANF,GASIN,KATJ,CAMEM,KANF;AAAA,MAOEC,YAPF,GASIP,KATJ,CAOEO,YAPF;AAAA,MAQEC,UARF,GASIR,KATJ,CAQEQ,UARF;AAWA,MAAMC,oBAAoB,GAAG,CAAC,yBAACR,UAAU,C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;AACA,MAAMrC,YAAY,GAAG2B,gBAAgB,IAAIO,mBAAzC;AAEA,SACE,gCAAC,kBAAD;AAEIxC,IAAAA,UAAU,EAAVA,UAFJ;AAGIC,IAAAA,iBAAiB,EAAjBA,iBAHJ;AAIIC,IAAAA,IAAI,EAAJA,IAJJ;AAKIC,IAAAA,cAAc,EAAdA,cALJ;AAMIC,IAAAA,OAAO,EAAPA,OANJ;AAOIC,IAAAA,KAAK,EAALA,KAPJ;AAQIC,IAAAA,YAAY,EAAZA,YARJ;AASIe,IAAAA,iBAAiB,EAAjBA,iBATJ;AAUId,IAAAA,UAAU,EAAVA,UAVJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAeD,CAvDM","sourcesContent":["import React from 'react';\n\nimport type { Attachment as AttachmentType } from 'stream-chat';\n\nimport { AttachmentActions as AttachmentActionsDefault } from '../../components/Attachment/AttachmentActions';\nimport { Card as CardDefault } from '../../components/Attachment/Card';\nimport { FileAttachment as FileAttachmentDefault } from '../../components/Attachment/FileAttachment';\nimport { Gallery as GalleryDefault } from '../../components/Attachment/Gallery';\nimport { Giphy as GiphyDefault } from '../../components/Attachment/Giphy';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nexport type ActionHandler = (name: string, value: string) => void;\n\nexport type AttachmentPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'giphyVersion'\n | 'Giphy'\n | 'isAttachmentEqual'\n | 'UrlPreview'\n> & {\n /**\n * The attachment to render\n */\n attachment: AttachmentType<StreamChatGenerics>;\n};\n\nconst AttachmentWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n UrlPreview,\n } = props;\n\n const hasAttachmentActions = !!attachment.actions?.length;\n\n if (attachment.type === 'giphy' || attachment.type === 'imgur') {\n return <Giphy attachment={attachment} giphyVersion={giphyVersion} />;\n }\n\n if (\n (attachment.title_link || attachment.og_scrape_url) &&\n (attachment.image_url || attachment.thumb_url)\n ) {\n return <UrlPreview {...attachment} />;\n }\n\n if (attachment.type === 'image') {\n return (\n <>\n <Gallery images={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n );\n }\n\n if (attachment.type === 'video' && !attachment.og_scrape_url) {\n return (\n <>\n <Gallery videos={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n );\n }\n\n if (attachment.type === 'file' || attachment.type === 'audio') {\n return <FileAttachment attachment={attachment} />;\n }\n\n if (hasAttachmentActions) {\n return (\n <>\n <Card {...attachment} />\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n </>\n );\n } else {\n return <Card {...attachment} />;\n }\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: AttachmentPropsWithContext<StreamChatGenerics>,\n nextProps: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const { attachment: prevAttachment, isAttachmentEqual } = prevProps;\n const { attachment: nextAttachment } = nextProps;\n\n const attachmentEqual =\n prevAttachment.actions?.length === nextAttachment.actions?.length &&\n prevAttachment.image_url === nextAttachment.image_url &&\n prevAttachment.thumb_url === nextAttachment.thumb_url;\n if (!attachmentEqual) return false;\n\n if (isAttachmentEqual) {\n return isAttachmentEqual(prevAttachment, nextAttachment);\n }\n\n return true;\n};\n\nconst MemoizedAttachment = React.memo(\n AttachmentWithContext,\n areEqual,\n) as typeof AttachmentWithContext;\n\nexport type AttachmentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'Giphy'\n | 'giphyVersion'\n | 'UrlPreview'\n | 'isAttachmentEqual'\n >\n> &\n Pick<AttachmentPropsWithContext<StreamChatGenerics>, 'attachment'>;\n\n/**\n * Attachment - The message attachment\n */\nexport const Attachment = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentProps<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions: PropAttachmentActions,\n Card: PropCard,\n FileAttachment: PropFileAttachment,\n Gallery: PropGallery,\n Giphy: PropGiphy,\n giphyVersion: PropGiphyVersion,\n UrlPreview: PropUrlPreview,\n } = props;\n\n const {\n AttachmentActions: ContextAttachmentActions,\n Card: ContextCard,\n FileAttachment: ContextFileAttachment,\n Gallery: ContextGallery,\n Giphy: ContextGiphy,\n giphyVersion: ContextGiphyVersion,\n isAttachmentEqual,\n UrlPreview: ContextUrlPreview,\n } = useMessagesContext<StreamChatGenerics>();\n\n if (!attachment) {\n return null;\n }\n\n const AttachmentActions =\n PropAttachmentActions || ContextAttachmentActions || AttachmentActionsDefault;\n const Card = PropCard || ContextCard || CardDefault;\n const FileAttachment = PropFileAttachment || ContextFileAttachment || FileAttachmentDefault;\n const Gallery = PropGallery || ContextGallery || GalleryDefault;\n const Giphy = PropGiphy || ContextGiphy || GiphyDefault;\n const UrlPreview = PropUrlPreview || ContextUrlPreview || CardDefault;\n const giphyVersion = PropGiphyVersion || ContextGiphyVersion;\n\n return (\n <MemoizedAttachment\n {...{\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n isAttachmentEqual,\n UrlPreview,\n }}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["Attachment.tsx"],"names":["AttachmentWithContext","props","attachment","AttachmentActions","Card","FileAttachment","Gallery","Giphy","giphyVersion","UrlPreview","hasAttachmentActions","actions","length","type","title_link","og_scrape_url","image_url","thumb_url","id","areEqual","prevProps","nextProps","prevAttachment","isAttachmentEqual","nextAttachment","attachmentEqual","MemoizedAttachment","React","memo","Attachment","PropAttachmentActions","PropCard","PropFileAttachment","PropGallery","PropGiphy","PropGiphyVersion","PropUrlPreview","ContextAttachmentActions","ContextCard","ContextFileAttachment","ContextGallery","ContextGiphy","ContextGiphyVersion","ContextUrlPreview","AttachmentActionsDefault","CardDefault","FileAttachmentDefault","GalleryDefault","GiphyDefault"],"mappings":";;;;;;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;;;;AAyBA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAG5BC,KAH4B,EAIzB;AAAA;;AACH,MACEC,UADF,GASID,KATJ,CACEC,UADF;AAAA,MAEEC,iBAFF,GASIF,KATJ,CAEEE,iBAFF;AAAA,MAGEC,IAHF,GASIH,KATJ,CAGEG,IAHF;AAAA,MAIEC,cAJF,GASIJ,KATJ,CAIEI,cAJF;AAAA,MAKEC,OALF,GASIL,KATJ,CAKEK,OALF;AAAA,MAMEC,KANF,GASIN,KATJ,CAMEM,KANF;AAAA,MAOEC,YAPF,GASIP,KATJ,CAOEO,YAPF;AAAA,MAQEC,UARF,GASIR,KATJ,CAQEQ,UARF;AAWA,MAAMC,oBAAoB,GAAG,CAAC,yBAACR,UAAU,CAACS,OAAZ,aAAC,oBAAoBC,MAArB,CAA9B;;AAEA,MAAIV,UAAU,CAACW,IAAX,KAAoB,OAApB,IAA+BX,UAAU,CAACW,IAAX,KAAoB,OAAvD,EAAgE;AAC9D,WAAO,gCAAC,KAAD;AAAO,MAAA,UAAU,EAAEX,UAAnB;AAA+B,MAAA,YAAY,EAAEM,YAA7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAP;A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AAI,EAAJA,IAJJ;AAKIC,IAAAA,cAAc,EAAdA,cALJ;AAMIC,IAAAA,OAAO,EAAPA,OANJ;AAOIC,IAAAA,KAAK,EAALA,KAPJ;AAQIC,IAAAA,YAAY,EAAZA,YARJ;AASIe,IAAAA,iBAAiB,EAAjBA,iBATJ;AAUId,IAAAA,UAAU,EAAVA,UAVJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF;AAeD,CAvDM","sourcesContent":["import React from 'react';\n\nimport type { Attachment as AttachmentType } from 'stream-chat';\n\nimport { AttachmentActions as AttachmentActionsDefault } from '../../components/Attachment/AttachmentActions';\nimport { Card as CardDefault } from '../../components/Attachment/Card';\nimport { FileAttachment as FileAttachmentDefault } from '../../components/Attachment/FileAttachment';\nimport { Gallery as GalleryDefault } from '../../components/Attachment/Gallery';\nimport { Giphy as GiphyDefault } from '../../components/Attachment/Giphy';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { isVideoPackageAvailable } from '../../native';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nexport type ActionHandler = (name: string, value: string) => void;\n\nexport type AttachmentPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'giphyVersion'\n | 'Giphy'\n | 'isAttachmentEqual'\n | 'UrlPreview'\n> & {\n /**\n * The attachment to render\n */\n attachment: AttachmentType<StreamChatGenerics>;\n};\n\nconst AttachmentWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n UrlPreview,\n } = props;\n\n const hasAttachmentActions = !!attachment.actions?.length;\n\n if (attachment.type === 'giphy' || attachment.type === 'imgur') {\n return <Giphy attachment={attachment} giphyVersion={giphyVersion} />;\n }\n\n if (\n (attachment.title_link || attachment.og_scrape_url) &&\n (attachment.image_url || attachment.thumb_url)\n ) {\n return <UrlPreview {...attachment} />;\n }\n\n if (attachment.type === 'image') {\n return (\n <>\n <Gallery images={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n );\n }\n\n if (attachment.type === 'video' && !attachment.og_scrape_url) {\n return isVideoPackageAvailable() ? (\n <>\n <Gallery videos={[attachment]} />\n {hasAttachmentActions && (\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n )}\n </>\n ) : (\n <FileAttachment attachment={attachment} />\n );\n }\n\n if (attachment.type === 'file' || attachment.type === 'audio') {\n return <FileAttachment attachment={attachment} />;\n }\n\n if (hasAttachmentActions) {\n return (\n <>\n <Card {...attachment} />\n <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />\n </>\n );\n } else {\n return <Card {...attachment} />;\n }\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: AttachmentPropsWithContext<StreamChatGenerics>,\n nextProps: AttachmentPropsWithContext<StreamChatGenerics>,\n) => {\n const { attachment: prevAttachment, isAttachmentEqual } = prevProps;\n const { attachment: nextAttachment } = nextProps;\n\n const attachmentEqual =\n prevAttachment.actions?.length === nextAttachment.actions?.length &&\n prevAttachment.image_url === nextAttachment.image_url &&\n prevAttachment.thumb_url === nextAttachment.thumb_url;\n if (!attachmentEqual) return false;\n\n if (isAttachmentEqual) {\n return isAttachmentEqual(prevAttachment, nextAttachment);\n }\n\n return true;\n};\n\nconst MemoizedAttachment = React.memo(\n AttachmentWithContext,\n areEqual,\n) as typeof AttachmentWithContext;\n\nexport type AttachmentProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n | 'AttachmentActions'\n | 'Card'\n | 'FileAttachment'\n | 'Gallery'\n | 'Giphy'\n | 'giphyVersion'\n | 'UrlPreview'\n | 'isAttachmentEqual'\n >\n> &\n Pick<AttachmentPropsWithContext<StreamChatGenerics>, 'attachment'>;\n\n/**\n * Attachment - The message attachment\n */\nexport const Attachment = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: AttachmentProps<StreamChatGenerics>,\n) => {\n const {\n attachment,\n AttachmentActions: PropAttachmentActions,\n Card: PropCard,\n FileAttachment: PropFileAttachment,\n Gallery: PropGallery,\n Giphy: PropGiphy,\n giphyVersion: PropGiphyVersion,\n UrlPreview: PropUrlPreview,\n } = props;\n\n const {\n AttachmentActions: ContextAttachmentActions,\n Card: ContextCard,\n FileAttachment: ContextFileAttachment,\n Gallery: ContextGallery,\n Giphy: ContextGiphy,\n giphyVersion: ContextGiphyVersion,\n isAttachmentEqual,\n UrlPreview: ContextUrlPreview,\n } = useMessagesContext<StreamChatGenerics>();\n\n if (!attachment) {\n return null;\n }\n\n const AttachmentActions =\n PropAttachmentActions || ContextAttachmentActions || AttachmentActionsDefault;\n const Card = PropCard || ContextCard || CardDefault;\n const FileAttachment = PropFileAttachment || ContextFileAttachment || FileAttachmentDefault;\n const Gallery = PropGallery || ContextGallery || GalleryDefault;\n const Giphy = PropGiphy || ContextGiphy || GiphyDefault;\n const UrlPreview = PropUrlPreview || ContextUrlPreview || CardDefault;\n const giphyVersion = PropGiphyVersion || ContextGiphyVersion;\n\n return (\n <MemoizedAttachment\n {...{\n attachment,\n AttachmentActions,\n Card,\n FileAttachment,\n Gallery,\n Giphy,\n giphyVersion,\n isAttachmentEqual,\n UrlPreview,\n }}\n />\n );\n};\n"]}
|
|
@@ -7,15 +7,13 @@ exports.Card = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
11
|
|
|
14
12
|
var _react = _interopRequireDefault(require("react"));
|
|
15
13
|
|
|
16
14
|
var _reactNative = require("react-native");
|
|
17
15
|
|
|
18
|
-
var
|
|
16
|
+
var _openUrlSafely = require("./utils/openUrlSafely");
|
|
19
17
|
|
|
20
18
|
var _MessageContext = require("../../contexts/messageContext/MessageContext");
|
|
21
19
|
|
|
@@ -23,6 +21,8 @@ var _MessagesContext = require("../../contexts/messagesContext/MessagesContext")
|
|
|
23
21
|
|
|
24
22
|
var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
|
|
25
23
|
|
|
24
|
+
var _Play = require("../../icons/Play");
|
|
25
|
+
|
|
26
26
|
var _utils = require("../../utils/utils");
|
|
27
27
|
|
|
28
28
|
var _excluded = ["description", "title"];
|
|
@@ -47,13 +47,15 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
47
47
|
},
|
|
48
48
|
authorNameMask: {
|
|
49
49
|
bottom: 0,
|
|
50
|
-
left:
|
|
50
|
+
left: 2,
|
|
51
51
|
position: 'absolute'
|
|
52
52
|
},
|
|
53
53
|
cardCover: {
|
|
54
|
+
alignItems: 'center',
|
|
54
55
|
borderRadius: 8,
|
|
55
56
|
height: 140,
|
|
56
|
-
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
marginHorizontal: 2
|
|
57
59
|
},
|
|
58
60
|
cardFooter: {
|
|
59
61
|
flexDirection: 'row',
|
|
@@ -68,6 +70,14 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
68
70
|
fontSize: 12,
|
|
69
71
|
marginHorizontal: 8
|
|
70
72
|
},
|
|
73
|
+
playButtonStyle: {
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
borderRadius: 50,
|
|
76
|
+
elevation: 2,
|
|
77
|
+
height: 36,
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
width: 36
|
|
80
|
+
},
|
|
71
81
|
title: {
|
|
72
82
|
fontSize: 12,
|
|
73
83
|
marginHorizontal: 8
|
|
@@ -90,7 +100,8 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
90
100
|
stylesProp = _props$styles === void 0 ? {} : _props$styles,
|
|
91
101
|
text = props.text,
|
|
92
102
|
thumb_url = props.thumb_url,
|
|
93
|
-
title = props.title
|
|
103
|
+
title = props.title,
|
|
104
|
+
type = props.type;
|
|
94
105
|
|
|
95
106
|
var _useTheme = (0, _ThemeContext.useTheme)(),
|
|
96
107
|
_useTheme$theme = _useTheme.theme,
|
|
@@ -99,6 +110,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
99
110
|
black = _useTheme$theme$color.black,
|
|
100
111
|
blue_alice = _useTheme$theme$color.blue_alice,
|
|
101
112
|
transparent = _useTheme$theme$color.transparent,
|
|
113
|
+
white = _useTheme$theme$color.white,
|
|
102
114
|
_useTheme$theme$messa = _useTheme$theme.messageSimple.card,
|
|
103
115
|
authorName = _useTheme$theme$messa.authorName,
|
|
104
116
|
authorNameContainer = _useTheme$theme$messa.authorNameContainer,
|
|
@@ -111,19 +123,19 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
111
123
|
description = _useTheme$theme$messa2.description,
|
|
112
124
|
titleStyle = _useTheme$theme$messa2.title,
|
|
113
125
|
footerStyle = (0, _objectWithoutProperties2["default"])(_useTheme$theme$messa2, _excluded),
|
|
114
|
-
noURI = _useTheme$theme$messa.noURI
|
|
126
|
+
noURI = _useTheme$theme$messa.noURI,
|
|
127
|
+
roundedView = _useTheme$theme$messa.playButtonStyle.roundedView,
|
|
128
|
+
_useTheme$theme$messa3 = _useTheme$theme$messa.playIcon,
|
|
129
|
+
height = _useTheme$theme$messa3.height,
|
|
130
|
+
width = _useTheme$theme$messa3.width;
|
|
115
131
|
|
|
116
132
|
var uri = image_url || thumb_url;
|
|
117
133
|
|
|
118
|
-
var _useGoToURL = (0, _useGoToURL3.useGoToURL)(og_scrape_url || uri),
|
|
119
|
-
_useGoToURL2 = (0, _slicedToArray2["default"])(_useGoToURL, 2),
|
|
120
|
-
error = _useGoToURL2[0],
|
|
121
|
-
openURL = _useGoToURL2[1];
|
|
122
|
-
|
|
123
134
|
var defaultOnPress = function defaultOnPress() {
|
|
124
|
-
return
|
|
135
|
+
return (0, _openUrlSafely.openUrlSafely)(og_scrape_url || uri);
|
|
125
136
|
};
|
|
126
137
|
|
|
138
|
+
var isVideoCard = type === 'video' && og_scrape_url;
|
|
127
139
|
return _react["default"].createElement(_reactNative.TouchableOpacity, (0, _extends2["default"])({
|
|
128
140
|
disabled: preventPress,
|
|
129
141
|
onLongPress: function onLongPress(event) {
|
|
@@ -167,31 +179,32 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
167
179
|
__self: _this,
|
|
168
180
|
__source: {
|
|
169
181
|
fileName: _jsxFileName,
|
|
170
|
-
lineNumber:
|
|
182
|
+
lineNumber: 161,
|
|
171
183
|
columnNumber: 5
|
|
172
184
|
}
|
|
173
185
|
}), CardHeader && _react["default"].createElement(CardHeader, (0, _extends2["default"])({}, props, {
|
|
174
186
|
__self: _this,
|
|
175
187
|
__source: {
|
|
176
188
|
fileName: _jsxFileName,
|
|
177
|
-
lineNumber:
|
|
189
|
+
lineNumber: 196,
|
|
178
190
|
columnNumber: 22
|
|
179
191
|
}
|
|
180
192
|
})), CardCover && _react["default"].createElement(CardCover, (0, _extends2["default"])({}, props, {
|
|
181
193
|
__self: _this,
|
|
182
194
|
__source: {
|
|
183
195
|
fileName: _jsxFileName,
|
|
184
|
-
lineNumber:
|
|
196
|
+
lineNumber: 197,
|
|
185
197
|
columnNumber: 21
|
|
186
198
|
}
|
|
187
199
|
})), uri && !CardCover && _react["default"].createElement(_reactNative.View, {
|
|
188
200
|
__self: _this,
|
|
189
201
|
__source: {
|
|
190
202
|
fileName: _jsxFileName,
|
|
191
|
-
lineNumber:
|
|
203
|
+
lineNumber: 199,
|
|
192
204
|
columnNumber: 9
|
|
193
205
|
}
|
|
194
|
-
}, _react["default"].createElement(_reactNative.
|
|
206
|
+
}, _react["default"].createElement(_reactNative.ImageBackground, {
|
|
207
|
+
imageStyle: styles.cardCover,
|
|
195
208
|
resizeMode: "cover",
|
|
196
209
|
source: {
|
|
197
210
|
uri: (0, _utils.makeImageCompatibleUrl)(uri)
|
|
@@ -200,15 +213,35 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
200
213
|
__self: _this,
|
|
201
214
|
__source: {
|
|
202
215
|
fileName: _jsxFileName,
|
|
203
|
-
lineNumber:
|
|
216
|
+
lineNumber: 200,
|
|
204
217
|
columnNumber: 11
|
|
205
218
|
}
|
|
206
|
-
}
|
|
219
|
+
}, isVideoCard ? _react["default"].createElement(_reactNative.View, {
|
|
220
|
+
style: [styles.playButtonStyle, roundedView, {
|
|
221
|
+
backgroundColor: white
|
|
222
|
+
}],
|
|
223
|
+
__self: _this,
|
|
224
|
+
__source: {
|
|
225
|
+
fileName: _jsxFileName,
|
|
226
|
+
lineNumber: 207,
|
|
227
|
+
columnNumber: 15
|
|
228
|
+
}
|
|
229
|
+
}, _react["default"].createElement(_Play.Play, {
|
|
230
|
+
height: height,
|
|
231
|
+
pathFill: black,
|
|
232
|
+
width: width,
|
|
233
|
+
__self: _this,
|
|
234
|
+
__source: {
|
|
235
|
+
fileName: _jsxFileName,
|
|
236
|
+
lineNumber: 208,
|
|
237
|
+
columnNumber: 17
|
|
238
|
+
}
|
|
239
|
+
})) : null), author_name && _react["default"].createElement(_reactNative.View, {
|
|
207
240
|
style: [styles.authorNameMask, authorNameMask, stylesProp.authorNameMask],
|
|
208
241
|
__self: _this,
|
|
209
242
|
__source: {
|
|
210
243
|
fileName: _jsxFileName,
|
|
211
|
-
lineNumber:
|
|
244
|
+
lineNumber: 213,
|
|
212
245
|
columnNumber: 13
|
|
213
246
|
}
|
|
214
247
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -218,7 +251,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
218
251
|
__self: _this,
|
|
219
252
|
__source: {
|
|
220
253
|
fileName: _jsxFileName,
|
|
221
|
-
lineNumber:
|
|
254
|
+
lineNumber: 214,
|
|
222
255
|
columnNumber: 15
|
|
223
256
|
}
|
|
224
257
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -228,14 +261,14 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
228
261
|
__self: _this,
|
|
229
262
|
__source: {
|
|
230
263
|
fileName: _jsxFileName,
|
|
231
|
-
lineNumber:
|
|
264
|
+
lineNumber: 222,
|
|
232
265
|
columnNumber: 17
|
|
233
266
|
}
|
|
234
267
|
}, author_name)))), CardFooter ? _react["default"].createElement(CardFooter, (0, _extends2["default"])({}, props, {
|
|
235
268
|
__self: _this,
|
|
236
269
|
__source: {
|
|
237
270
|
fileName: _jsxFileName,
|
|
238
|
-
lineNumber:
|
|
271
|
+
lineNumber: 238,
|
|
239
272
|
columnNumber: 9
|
|
240
273
|
}
|
|
241
274
|
})) : _react["default"].createElement(_reactNative.View, {
|
|
@@ -243,7 +276,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
243
276
|
__self: _this,
|
|
244
277
|
__source: {
|
|
245
278
|
fileName: _jsxFileName,
|
|
246
|
-
lineNumber:
|
|
279
|
+
lineNumber: 240,
|
|
247
280
|
columnNumber: 9
|
|
248
281
|
}
|
|
249
282
|
}, _react["default"].createElement(_reactNative.View, {
|
|
@@ -255,7 +288,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
255
288
|
__self: _this,
|
|
256
289
|
__source: {
|
|
257
290
|
fileName: _jsxFileName,
|
|
258
|
-
lineNumber:
|
|
291
|
+
lineNumber: 241,
|
|
259
292
|
columnNumber: 11
|
|
260
293
|
}
|
|
261
294
|
}, !uri && author_name && _react["default"].createElement(_reactNative.Text, {
|
|
@@ -265,7 +298,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
265
298
|
__self: _this,
|
|
266
299
|
__source: {
|
|
267
300
|
fileName: _jsxFileName,
|
|
268
|
-
lineNumber:
|
|
301
|
+
lineNumber: 250,
|
|
269
302
|
columnNumber: 15
|
|
270
303
|
}
|
|
271
304
|
}, author_name), title && _react["default"].createElement(_reactNative.Text, {
|
|
@@ -276,7 +309,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
276
309
|
__self: _this,
|
|
277
310
|
__source: {
|
|
278
311
|
fileName: _jsxFileName,
|
|
279
|
-
lineNumber:
|
|
312
|
+
lineNumber: 262,
|
|
280
313
|
columnNumber: 15
|
|
281
314
|
}
|
|
282
315
|
}, title), text && _react["default"].createElement(_reactNative.Text, {
|
|
@@ -287,7 +320,7 @@ var CardWithContext = function CardWithContext(props) {
|
|
|
287
320
|
__self: _this,
|
|
288
321
|
__source: {
|
|
289
322
|
fileName: _jsxFileName,
|
|
290
|
-
lineNumber:
|
|
323
|
+
lineNumber: 270,
|
|
291
324
|
columnNumber: 15
|
|
292
325
|
}
|
|
293
326
|
}, text))));
|
|
@@ -326,7 +359,7 @@ var Card = function Card(props) {
|
|
|
326
359
|
__self: _this,
|
|
327
360
|
__source: {
|
|
328
361
|
fileName: _jsxFileName,
|
|
329
|
-
lineNumber:
|
|
362
|
+
lineNumber: 311,
|
|
330
363
|
columnNumber: 5
|
|
331
364
|
}
|
|
332
365
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Card.tsx"],"names":["styles","StyleSheet","create","authorName","fontSize","fontWeight","authorNameContainer","borderTopRightRadius","paddingHorizontal","paddingTop","authorNameFooter","padding","authorNameMask","bottom","left","position","cardCover","borderRadius","height","marginHorizontal","cardFooter","flexDirection","justifyContent","container","overflow","width","description","title","CardWithContext","props","additionalTouchableProps","author_name","CardCover","CardFooter","CardHeader","image_url","og_scrape_url","onLongPress","onPress","onPressIn","preventPress","stylesProp","text","thumb_url","theme","colors","accent_blue","black","blue_alice","transparent","messageSimple","card","authorNameFooterContainer","cover","footer","titleStyle","footerStyle","noURI","uri","error","openURL","defaultOnPress","event","additionalInfo","url","emitter","defaultHandler","backgroundColor","color","borderLeftColor","MemoizedCard","React","memo","Card","message","channelId","cid","messageId","id","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAcA;;AAEA;;AAIA;;AAIA;;AAEA;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,QAAQ,EAAE,IAAZ;AAAkBC,IAAAA,UAAU,EAAE;AAA9B,GADmB;AAE/BC,EAAAA,mBAAmB,EAAE;AACnBC,IAAAA,oBAAoB,EAAE,EADH;AAEnBC,IAAAA,iBAAiB,EAAE,CAFA;AAGnBC,IAAAA,UAAU,EAAE;AAHO,GAFU;AAO/BC,EAAAA,gBAAgB,EAAE;AAChBN,IAAAA,QAAQ,EAAE,IADM;AAEhBC,IAAAA,UAAU,EAAE,KAFI;AAGhBM,IAAAA,OAAO,EAAE;AAHO,GAPa;AAY/BC,EAAAA,cAAc,EAAE;AACdC,IAAAA,MAAM,EAAE,CADM;AAEdC,IAAAA,IAAI,EAAE,CAFQ;AAGdC,IAAAA,QAAQ,EAAE;AAHI,GAZe;AAiB/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,YAAY,EAAE,CADL;AAETC,IAAAA,MAAM,EAAE,GAFC;AAGTC,IAAAA,gBAAgB,EAAE;AAHT,GAjBoB;AAsB/BC,EAAAA,UAAU,EAAE;AACVC,IAAAA,aAAa,EAAE,KADL;AAEVC,IAAAA,cAAc,EAAE,eAFN;AAGVX,IAAAA,OAAO,EAAE;AAHC,GAtBmB;AA2B/BY,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE,QADD;AAETC,IAAAA,KAAK,EAAE;AAFE,GA3BoB;AA+B/BC,EAAAA,WAAW,EAAE;AACXtB,IAAAA,QAAQ,EAAE,EADC;AAEXe,IAAAA,gBAA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IAAAA,SAAS,EAATA,SAHJ;AAIIC,IAAAA,UAAU,EAAVA,UAJJ;AAKIC,IAAAA,UAAU,EAAVA,UALJ;AAMIyC,IAAAA,SAAS,EAAED,OAAO,CAACE,GANvB;AAOIC,IAAAA,SAAS,EAAEH,OAAO,CAACI,EAPvB;AAQIzC,IAAAA,WAAW,EAAXA,WARJ;AASIC,IAAAA,OAAO,EAAPA,OATJ;AAUIC,IAAAA,SAAS,EAATA,SAVJ;AAWIC,IAAAA,YAAY,EAAZA;AAXJ,KAaMX,KAbN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAiBD,CA3BM;;;AA6BP4C,IAAI,CAACM,WAAL,GAAmB,2BAAnB","sourcesContent":["import React from 'react';\nimport {\n Image,\n ImageStyle,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n TouchableOpacity,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useGoToURL } from './hooks/useGoToURL';\n\nimport {\n MessageContextValue,\n useMessageContext,\n} from '../../contexts/messageContext/MessageContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { makeImageCompatibleUrl } from '../../utils/utils';\n\nconst styles = StyleSheet.create({\n authorName: { fontSize: 14.5, fontWeight: '600' },\n authorNameContainer: {\n borderTopRightRadius: 15,\n paddingHorizontal: 8,\n paddingTop: 8,\n },\n authorNameFooter: {\n fontSize: 14.5,\n fontWeight: '600',\n padding: 8,\n },\n authorNameMask: {\n bottom: 0,\n left: 8,\n position: 'absolute',\n },\n cardCover: {\n borderRadius: 8,\n height: 140,\n marginHorizontal: 8,\n },\n cardFooter: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n container: {\n overflow: 'hidden',\n width: 256,\n },\n description: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n title: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n});\n\nexport type CardPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Pick<\n MessageContextValue<StreamChatGenerics>,\n 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'\n > &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n > & {\n channelId: string | undefined;\n messageId: string | undefined;\n styles?: Partial<{\n authorName: StyleProp<TextStyle>;\n authorNameContainer: StyleProp<ViewStyle>;\n authorNameFooter: StyleProp<TextStyle>;\n authorNameFooterContainer: StyleProp<ViewStyle>;\n authorNameMask: StyleProp<ViewStyle>;\n cardCover: StyleProp<ImageStyle>;\n cardFooter: StyleProp<ViewStyle>;\n container: StyleProp<ViewStyle>;\n description: StyleProp<TextStyle>;\n title: StyleProp<TextStyle>;\n }>;\n };\n\nconst CardWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n additionalTouchableProps,\n author_name,\n CardCover,\n CardFooter,\n CardHeader,\n image_url,\n og_scrape_url,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n styles: stylesProp = {},\n text,\n thumb_url,\n title,\n } = props;\n\n const {\n theme: {\n colors: { accent_blue, black, blue_alice, transparent },\n messageSimple: {\n card: {\n authorName,\n authorNameContainer,\n authorNameFooter,\n authorNameFooterContainer,\n authorNameMask,\n container,\n cover,\n footer: { description, title: titleStyle, ...footerStyle },\n noURI,\n },\n },\n },\n } = useTheme();\n\n const uri = image_url || thumb_url;\n\n const [error, openURL] = useGoToURL(og_scrape_url || uri);\n\n const defaultOnPress = () => !error && openURL && openURL();\n\n return (\n <TouchableOpacity\n disabled={preventPress}\n onLongPress={(event) => {\n if (onLongPress) {\n onLongPress({\n additionalInfo: { url: og_scrape_url },\n emitter: 'card',\n event,\n });\n }\n }}\n onPress={(event) => {\n if (onPress) {\n onPress({\n additionalInfo: { url: og_scrape_url },\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n onPressIn={(event) => {\n if (onPressIn) {\n onPressIn({\n additionalInfo: { url: og_scrape_url },\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n style={[styles.container, container, stylesProp.container]}\n testID='card-attachment'\n {...additionalTouchableProps}\n >\n {CardHeader && <CardHeader {...props} />}\n {CardCover && <CardCover {...props} />}\n {uri && !CardCover && (\n <View>\n <Image\n resizeMode='cover'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.cardCover, cover, stylesProp.cardCover]}\n />\n {author_name && (\n <View style={[styles.authorNameMask, authorNameMask, stylesProp.authorNameMask]}>\n <View\n style={[\n styles.authorNameContainer,\n { backgroundColor: blue_alice },\n authorNameContainer,\n stylesProp.authorNameContainer,\n ]}\n >\n <Text\n style={[\n styles.authorName,\n { color: accent_blue },\n authorName,\n stylesProp.authorName,\n ]}\n >\n {author_name}\n </Text>\n </View>\n </View>\n )}\n </View>\n )}\n {CardFooter ? (\n <CardFooter {...props} />\n ) : (\n <View style={[styles.cardFooter, footerStyle, stylesProp.cardFooter]}>\n <View\n style={[\n authorNameFooterContainer,\n { backgroundColor: transparent },\n !uri ? { borderLeftColor: accent_blue, ...noURI } : {},\n stylesProp.authorNameFooterContainer,\n ]}\n >\n {!uri && author_name && (\n <Text\n style={[\n styles.authorNameFooter,\n { color: accent_blue },\n authorNameFooter,\n stylesProp.authorNameFooter,\n ]}\n >\n {author_name}\n </Text>\n )}\n {title && (\n <Text\n numberOfLines={1}\n style={[styles.title, { color: black }, titleStyle, stylesProp.title]}\n >\n {title}\n </Text>\n )}\n {text && (\n <Text\n numberOfLines={3}\n style={[styles.description, { color: black }, description, stylesProp.description]}\n >\n {text}\n </Text>\n )}\n </View>\n </View>\n )}\n </TouchableOpacity>\n );\n};\n\nconst MemoizedCard = React.memo(CardWithContext, () => true) as typeof CardWithContext;\n\nexport type CardProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Partial<\n Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n >\n >;\n\n/**\n * UI component for card in attachments.\n */\nexport const Card = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardProps<StreamChatGenerics>,\n) => {\n const { message, onLongPress, onPress, onPressIn, preventPress } =\n useMessageContext<StreamChatGenerics>();\n const { additionalTouchableProps, CardCover, CardFooter, CardHeader } =\n useMessagesContext<StreamChatGenerics>();\n\n return (\n <MemoizedCard\n {...{\n additionalTouchableProps,\n CardCover,\n CardFooter,\n CardHeader,\n channelId: message.cid,\n messageId: message.id,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n }}\n {...props}\n />\n );\n};\n\nCard.displayName = 'Card{messageSimple{card}}';\n"]}
|
|
1
|
+
{"version":3,"sources":["Card.tsx"],"names":["styles","StyleSheet","create","authorName","fontSize","fontWeight","authorNameContainer","borderTopRightRadius","paddingHorizontal","paddingTop","authorNameFooter","padding","authorNameMask","bottom","left","position","cardCover","alignItems","borderRadius","height","justifyContent","marginHorizontal","cardFooter","flexDirection","container","overflow","width","description","playButtonStyle","elevation","title","CardWithContext","props","additionalTouchableProps","author_name","CardCover","CardFooter","CardHeader","image_url","og_scrape_url","onLongPress","onPress","onPressIn","preventPress","stylesProp","text","thumb_url","type","theme","colors","accent_blue","black","blue_alice","transparent","white","messageSimple","card","authorNameFooterContainer","cover","footer","titleStyle","footerStyle","noURI","roundedView","playIcon","uri","defaultOnPress","isVideoCard","event","additionalInfo","url","emitter","defaultHandler","backgroundColor","color","borderLeftColor","M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CAACM,WAAL,GAAmB,2BAAnB","sourcesContent":["import React from 'react';\nimport {\n ImageBackground,\n ImageStyle,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n TouchableOpacity,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { openUrlSafely } from './utils/openUrlSafely';\n\nimport {\n MessageContextValue,\n useMessageContext,\n} from '../../contexts/messageContext/MessageContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport { Play } from '../../icons/Play';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { makeImageCompatibleUrl } from '../../utils/utils';\n\nconst styles = StyleSheet.create({\n authorName: { fontSize: 14.5, fontWeight: '600' },\n authorNameContainer: {\n borderTopRightRadius: 15,\n paddingHorizontal: 8,\n paddingTop: 8,\n },\n authorNameFooter: {\n fontSize: 14.5,\n fontWeight: '600',\n padding: 8,\n },\n authorNameMask: {\n bottom: 0,\n left: 2,\n position: 'absolute',\n },\n cardCover: {\n alignItems: 'center',\n borderRadius: 8,\n height: 140,\n justifyContent: 'center',\n marginHorizontal: 2,\n },\n cardFooter: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 10,\n },\n container: {\n overflow: 'hidden',\n width: 256,\n },\n description: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n playButtonStyle: {\n alignItems: 'center',\n borderRadius: 50,\n elevation: 2,\n height: 36,\n justifyContent: 'center',\n width: 36,\n },\n title: {\n fontSize: 12,\n marginHorizontal: 8,\n },\n});\n\nexport type CardPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Pick<\n MessageContextValue<StreamChatGenerics>,\n 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'\n > &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n > & {\n channelId: string | undefined;\n messageId: string | undefined;\n styles?: Partial<{\n authorName: StyleProp<TextStyle>;\n authorNameContainer: StyleProp<ViewStyle>;\n authorNameFooter: StyleProp<TextStyle>;\n authorNameFooterContainer: StyleProp<ViewStyle>;\n authorNameMask: StyleProp<ViewStyle>;\n cardCover: StyleProp<ImageStyle>;\n cardFooter: StyleProp<ViewStyle>;\n container: StyleProp<ViewStyle>;\n description: StyleProp<TextStyle>;\n title: StyleProp<TextStyle>;\n }>;\n };\n\nconst CardWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n additionalTouchableProps,\n author_name,\n CardCover,\n CardFooter,\n CardHeader,\n image_url,\n og_scrape_url,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n styles: stylesProp = {},\n text,\n thumb_url,\n title,\n type,\n } = props;\n\n const {\n theme: {\n colors: { accent_blue, black, blue_alice, transparent, white },\n messageSimple: {\n card: {\n authorName,\n authorNameContainer,\n authorNameFooter,\n authorNameFooterContainer,\n authorNameMask,\n container,\n cover,\n footer: { description, title: titleStyle, ...footerStyle },\n noURI,\n playButtonStyle: { roundedView },\n playIcon: { height, width },\n },\n },\n },\n } = useTheme();\n\n const uri = image_url || thumb_url;\n\n const defaultOnPress = () => openUrlSafely(og_scrape_url || uri);\n\n const isVideoCard = type === 'video' && og_scrape_url;\n\n return (\n <TouchableOpacity\n disabled={preventPress}\n onLongPress={(event) => {\n if (onLongPress) {\n onLongPress({\n additionalInfo: { url: og_scrape_url },\n emitter: 'card',\n event,\n });\n }\n }}\n onPress={(event) => {\n if (onPress) {\n onPress({\n additionalInfo: { url: og_scrape_url },\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n onPressIn={(event) => {\n if (onPressIn) {\n onPressIn({\n additionalInfo: { url: og_scrape_url },\n defaultHandler: defaultOnPress,\n emitter: 'card',\n event,\n });\n }\n }}\n style={[styles.container, container, stylesProp.container]}\n testID='card-attachment'\n {...additionalTouchableProps}\n >\n {CardHeader && <CardHeader {...props} />}\n {CardCover && <CardCover {...props} />}\n {uri && !CardCover && (\n <View>\n <ImageBackground\n imageStyle={styles.cardCover}\n resizeMode='cover'\n source={{ uri: makeImageCompatibleUrl(uri) }}\n style={[styles.cardCover, cover, stylesProp.cardCover]}\n >\n {isVideoCard ? (\n <View style={[styles.playButtonStyle, roundedView, { backgroundColor: white }]}>\n <Play height={height} pathFill={black} width={width} />\n </View>\n ) : null}\n </ImageBackground>\n {author_name && (\n <View style={[styles.authorNameMask, authorNameMask, stylesProp.authorNameMask]}>\n <View\n style={[\n styles.authorNameContainer,\n { backgroundColor: blue_alice },\n authorNameContainer,\n stylesProp.authorNameContainer,\n ]}\n >\n <Text\n style={[\n styles.authorName,\n { color: accent_blue },\n authorName,\n stylesProp.authorName,\n ]}\n >\n {author_name}\n </Text>\n </View>\n </View>\n )}\n </View>\n )}\n {CardFooter ? (\n <CardFooter {...props} />\n ) : (\n <View style={[styles.cardFooter, footerStyle, stylesProp.cardFooter]}>\n <View\n style={[\n authorNameFooterContainer,\n { backgroundColor: transparent },\n !uri ? { borderLeftColor: accent_blue, ...noURI } : {},\n stylesProp.authorNameFooterContainer,\n ]}\n >\n {!uri && author_name && (\n <Text\n style={[\n styles.authorNameFooter,\n { color: accent_blue },\n authorNameFooter,\n stylesProp.authorNameFooter,\n ]}\n >\n {author_name}\n </Text>\n )}\n {title && (\n <Text\n numberOfLines={1}\n style={[styles.title, { color: black }, titleStyle, stylesProp.title]}\n >\n {title}\n </Text>\n )}\n {text && (\n <Text\n numberOfLines={3}\n style={[styles.description, { color: black }, description, stylesProp.description]}\n >\n {text}\n </Text>\n )}\n </View>\n </View>\n )}\n </TouchableOpacity>\n );\n};\n\nconst MemoizedCard = React.memo(CardWithContext, () => true) as typeof CardWithContext;\n\nexport type CardProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Attachment<StreamChatGenerics> &\n Partial<\n Pick<MessageContextValue<StreamChatGenerics>, 'onLongPress' | 'onPress' | 'onPressIn'> &\n Pick<\n MessagesContextValue<StreamChatGenerics>,\n 'additionalTouchableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'\n >\n >;\n\n/**\n * UI component for card in attachments.\n */\nexport const Card = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: CardProps<StreamChatGenerics>,\n) => {\n const { message, onLongPress, onPress, onPressIn, preventPress } =\n useMessageContext<StreamChatGenerics>();\n const { additionalTouchableProps, CardCover, CardFooter, CardHeader } =\n useMessagesContext<StreamChatGenerics>();\n\n return (\n <MemoizedCard\n {...{\n additionalTouchableProps,\n CardCover,\n CardFooter,\n CardHeader,\n channelId: message.cid,\n messageId: message.id,\n onLongPress,\n onPress,\n onPressIn,\n preventPress,\n }}\n {...props}\n />\n );\n};\n\nCard.displayName = 'Card{messageSimple{card}}';\n"]}
|
|
@@ -7,13 +7,11 @@ exports.getFileSizeDisplayText = exports.FileAttachment = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
13
11
|
|
|
14
12
|
var _reactNative = require("react-native");
|
|
15
13
|
|
|
16
|
-
var
|
|
14
|
+
var _openUrlSafely = require("./utils/openUrlSafely");
|
|
17
15
|
|
|
18
16
|
var _AttachmentActions = require("../../components/Attachment/AttachmentActions");
|
|
19
17
|
|
|
@@ -77,13 +75,8 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
77
75
|
fileSize = _useTheme$theme$messa.fileSize,
|
|
78
76
|
title = _useTheme$theme$messa.title;
|
|
79
77
|
|
|
80
|
-
var _useGoToURL = (0, _useGoToURL3.useGoToURL)(attachment.asset_url),
|
|
81
|
-
_useGoToURL2 = (0, _slicedToArray2["default"])(_useGoToURL, 2),
|
|
82
|
-
error = _useGoToURL2[0],
|
|
83
|
-
openURL = _useGoToURL2[1];
|
|
84
|
-
|
|
85
78
|
var defaultOnPress = function defaultOnPress() {
|
|
86
|
-
return
|
|
79
|
+
return (0, _openUrlSafely.openUrlSafely)(attachment.asset_url);
|
|
87
80
|
};
|
|
88
81
|
|
|
89
82
|
return _react["default"].createElement(_reactNative.TouchableOpacity, (0, _extends2["default"])({
|
|
@@ -119,7 +112,7 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
119
112
|
__self: _this,
|
|
120
113
|
__source: {
|
|
121
114
|
fileName: _jsxFileName,
|
|
122
|
-
lineNumber:
|
|
115
|
+
lineNumber: 101,
|
|
123
116
|
columnNumber: 5
|
|
124
117
|
}
|
|
125
118
|
}), _react["default"].createElement(_reactNative.View, {
|
|
@@ -129,7 +122,7 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
129
122
|
__self: _this,
|
|
130
123
|
__source: {
|
|
131
124
|
fileName: _jsxFileName,
|
|
132
|
-
lineNumber:
|
|
125
|
+
lineNumber: 132,
|
|
133
126
|
columnNumber: 7
|
|
134
127
|
}
|
|
135
128
|
}, _react["default"].createElement(FileAttachmentIcon, {
|
|
@@ -138,7 +131,7 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
138
131
|
__self: _this,
|
|
139
132
|
__source: {
|
|
140
133
|
fileName: _jsxFileName,
|
|
141
|
-
lineNumber:
|
|
134
|
+
lineNumber: 133,
|
|
142
135
|
columnNumber: 9
|
|
143
136
|
}
|
|
144
137
|
}), _react["default"].createElement(_reactNative.View, {
|
|
@@ -146,7 +139,7 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
146
139
|
__self: _this,
|
|
147
140
|
__source: {
|
|
148
141
|
fileName: _jsxFileName,
|
|
149
|
-
lineNumber:
|
|
142
|
+
lineNumber: 134,
|
|
150
143
|
columnNumber: 9
|
|
151
144
|
}
|
|
152
145
|
}, _react["default"].createElement(_reactNative.Text, {
|
|
@@ -157,7 +150,7 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
157
150
|
__self: _this,
|
|
158
151
|
__source: {
|
|
159
152
|
fileName: _jsxFileName,
|
|
160
|
-
lineNumber:
|
|
153
|
+
lineNumber: 135,
|
|
161
154
|
columnNumber: 11
|
|
162
155
|
}
|
|
163
156
|
}, attachment.title), _react["default"].createElement(_reactNative.Text, {
|
|
@@ -167,14 +160,14 @@ var FileAttachmentWithContext = function FileAttachmentWithContext(props) {
|
|
|
167
160
|
__self: _this,
|
|
168
161
|
__source: {
|
|
169
162
|
fileName: _jsxFileName,
|
|
170
|
-
lineNumber:
|
|
163
|
+
lineNumber: 138,
|
|
171
164
|
columnNumber: 11
|
|
172
165
|
}
|
|
173
166
|
}, getFileSizeDisplayText(attachment.file_size)))), (_attachment$actions = attachment.actions) != null && _attachment$actions.length ? _react["default"].createElement(AttachmentActions, (0, _extends2["default"])({}, attachment, {
|
|
174
167
|
__self: _this,
|
|
175
168
|
__source: {
|
|
176
169
|
fileName: _jsxFileName,
|
|
177
|
-
lineNumber:
|
|
170
|
+
lineNumber: 143,
|
|
178
171
|
columnNumber: 37
|
|
179
172
|
}
|
|
180
173
|
})) : null);
|
|
@@ -206,7 +199,7 @@ var FileAttachment = function FileAttachment(props) {
|
|
|
206
199
|
__self: _this,
|
|
207
200
|
__source: {
|
|
208
201
|
fileName: _jsxFileName,
|
|
209
|
-
lineNumber:
|
|
202
|
+
lineNumber: 166,
|
|
210
203
|
columnNumber: 5
|
|
211
204
|
}
|
|
212
205
|
}));
|