@ethora/chat-component-rn 26.5.10 → 26.5.12
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/CHANGELOG.md +65 -1
- package/README.md +30 -1
- package/lib/commonjs/assets/icons.js +7 -1
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +31 -16
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +34 -4
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +17 -14
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +298 -12
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/InteractionsOverlay.js +119 -0
- package/lib/commonjs/components/MessageBubble/InteractionsOverlay.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +39 -3
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +87 -39
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +153 -62
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +20 -5
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/DocumentViewer.js +5 -44
- package/lib/commonjs/components/Modals/FilePreviewModal/DocumentViewer.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +40 -3
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/GViewWebView.js +149 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/GViewWebView.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +4 -17
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/commonjs/components/Modals/ModalHeaderComponent.js +10 -0
- package/lib/commonjs/components/Modals/ModalHeaderComponent.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +13 -4
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +19 -33
- package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/AudioMessage.js +643 -66
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/Button.js +9 -3
- package/lib/commonjs/components/styled/Button.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +239 -40
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +6 -3
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/MediaComponents.js +31 -18
- package/lib/commonjs/components/styled/StyledInputComponents/MediaComponents.js.map +1 -1
- package/lib/commonjs/components/styled/UnsupportedType.js +47 -5
- package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +44 -25
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +5 -2
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/keyboardLayout.js +5 -3
- package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
- package/lib/commonjs/helpers/mimeToExtension.js +123 -0
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
- package/lib/commonjs/hooks/useEventHandlers.js +1 -1
- package/lib/commonjs/hooks/useEventHandlers.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +33 -8
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +6 -3
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +29 -4
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +6 -0
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/assets/icons.js +7 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +31 -16
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +36 -6
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +17 -14
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +301 -15
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MessageBubble/InteractionsOverlay.js +112 -0
- package/lib/module/components/MessageBubble/InteractionsOverlay.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +40 -4
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +89 -41
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +155 -64
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +20 -5
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/DocumentViewer.js +5 -45
- package/lib/module/components/Modals/FilePreviewModal/DocumentViewer.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +41 -4
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/GViewWebView.js +144 -0
- package/lib/module/components/Modals/FilePreviewModal/GViewWebView.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js +3 -17
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/module/components/Modals/ModalHeaderComponent.js +10 -0
- package/lib/module/components/Modals/ModalHeaderComponent.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +13 -4
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +20 -34
- package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
- package/lib/module/components/styled/AudioMessage.js +644 -67
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/Button.js +9 -3
- package/lib/module/components/styled/Button.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +240 -42
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +6 -3
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/MediaComponents.js +31 -18
- package/lib/module/components/styled/StyledInputComponents/MediaComponents.js.map +1 -1
- package/lib/module/components/styled/UnsupportedType.js +47 -5
- package/lib/module/components/styled/UnsupportedType.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +45 -26
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/xmppProvider.js +5 -2
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/keyboardLayout.js +4 -2
- package/lib/module/helpers/keyboardLayout.js.map +1 -1
- package/lib/module/helpers/mimeToExtension.js +119 -0
- package/lib/module/helpers/mimeToExtension.js.map +1 -1
- package/lib/module/hooks/useEventHandlers.js +1 -1
- package/lib/module/hooks/useEventHandlers.js.map +1 -1
- package/lib/module/hooks/useLogout.js +33 -8
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +6 -3
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +29 -4
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +6 -0
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/InteractionsOverlay.d.ts +13 -0
- package/lib/typescript/components/MessageBubble/InteractionsOverlay.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/DocumentViewer.d.ts +0 -7
- package/lib/typescript/components/Modals/FilePreviewModal/DocumentViewer.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/GViewWebView.d.ts +8 -0
- package/lib/typescript/components/Modals/FilePreviewModal/GViewWebView.d.ts.map +1 -0
- package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ModalHeaderComponent.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/AudioMessage.d.ts +8 -2
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/Button.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/MediaComponents.d.ts +5 -1
- package/lib/typescript/components/styled/StyledInputComponents/MediaComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/UnsupportedType.d.ts +5 -0
- package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts +3 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
- package/lib/typescript/helpers/mimeToExtension.d.ts +38 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts +23 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/modal.model.d.ts +3 -0
- package/lib/typescript/types/models/modal.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +29 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +11 -4
- package/src/assets/icons.tsx +30 -25
- package/src/components/MainComponents/ChatHeader.tsx +46 -15
- package/src/components/MainComponents/ChatRoom.tsx +38 -3
- package/src/components/MainComponents/ChatWrapper.tsx +28 -21
- package/src/components/MainComponents/MediaMessage.tsx +304 -11
- package/src/components/MessageBubble/InteractionsOverlay.tsx +121 -0
- package/src/components/MessageBubble/Message.tsx +44 -3
- package/src/components/MessageBubble/MessageInteractions.tsx +103 -52
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +144 -51
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +25 -3
- package/src/components/Modals/FilePreviewModal/DocumentViewer.tsx +3 -40
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +48 -4
- package/src/components/Modals/FilePreviewModal/GViewWebView.tsx +142 -0
- package/src/components/Modals/FilePreviewModal/PdfView.tsx +2 -18
- package/src/components/Modals/ModalHeaderComponent.tsx +8 -1
- package/src/components/Modals/styledModalComponents.tsx +13 -4
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +20 -35
- package/src/components/styled/AudioMessage.tsx +724 -59
- package/src/components/styled/Button.tsx +20 -11
- package/src/components/styled/SendInput.tsx +255 -46
- package/src/components/styled/StyledComponents.ts +6 -3
- package/src/components/styled/StyledInputComponents/MediaComponents.tsx +29 -18
- package/src/components/styled/UnsupportedType.tsx +60 -6
- package/src/components/styled/VideoMessage.tsx +21 -5
- package/src/context/xmppProvider.tsx +6 -2
- package/src/helpers/keyboardLayout.ts +5 -1
- package/src/helpers/mimeToExtension.ts +178 -0
- package/src/hooks/useEventHandlers.tsx +1 -1
- package/src/hooks/useLogout.tsx +33 -10
- package/src/hooks/useSendMessage.tsx +12 -6
- package/src/networking/api-requests/rooms.api.ts +31 -7
- package/src/roomStore/roomsSlice.ts +7 -0
- package/src/types/models/modal.model.ts +3 -0
- package/src/types/types.ts +29 -0
|
@@ -11,8 +11,137 @@ var _VideoMessage = _interopRequireDefault(require("../styled/VideoMessage"));
|
|
|
11
11
|
var _AudioMessage = _interopRequireDefault(require("../styled/AudioMessage"));
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
13
|
var _mimeToExtension = require("../../helpers/mimeToExtension");
|
|
14
|
+
var _icons = require("../../assets/icons");
|
|
15
|
+
var _mediaDimensions = require("../../helpers/mediaDimensions");
|
|
16
|
+
var _useChatSettingState = require("../../hooks/useChatSettingState");
|
|
14
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
const pendingImageDims = (0, _mediaDimensions.defaultMediaDims)();
|
|
20
|
+
const getPendingStatusLabel = mimeType => {
|
|
21
|
+
if (mimeType?.startsWith('image/')) {
|
|
22
|
+
return 'Uploading image';
|
|
23
|
+
}
|
|
24
|
+
if (mimeType?.startsWith('video/')) {
|
|
25
|
+
return 'Uploading video';
|
|
26
|
+
}
|
|
27
|
+
if (mimeType?.startsWith('audio/') || mimeType?.includes('application/octet-stream')) {
|
|
28
|
+
return 'Uploading audio';
|
|
29
|
+
}
|
|
30
|
+
return 'Uploading file';
|
|
31
|
+
};
|
|
32
|
+
const PendingMediaMessage = ({
|
|
33
|
+
fileName,
|
|
34
|
+
mimeType,
|
|
35
|
+
previewUri,
|
|
36
|
+
isUser,
|
|
37
|
+
size
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
config
|
|
41
|
+
} = (0, _useChatSettingState.useChatSettingState)();
|
|
42
|
+
const statusLabel = getPendingStatusLabel(mimeType);
|
|
43
|
+
const isImage = mimeType?.startsWith('image/');
|
|
44
|
+
const isVideo = mimeType?.startsWith('video/');
|
|
45
|
+
const isAudio = mimeType?.startsWith('audio/') || mimeType?.includes('application/octet-stream');
|
|
46
|
+
const primaryColor = config?.colors?.primary || '#0A84FF';
|
|
47
|
+
if (isImage && previewUri) {
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
49
|
+
style: styles.pendingImageWrapper,
|
|
50
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
51
|
+
source: {
|
|
52
|
+
uri: previewUri
|
|
53
|
+
},
|
|
54
|
+
style: styles.pendingImage,
|
|
55
|
+
resizeMode: "cover"
|
|
56
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
57
|
+
style: styles.pendingImageOverlay,
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
59
|
+
size: "small",
|
|
60
|
+
color: "#FFFFFF"
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
62
|
+
style: styles.pendingOverlayText,
|
|
63
|
+
children: statusLabel
|
|
64
|
+
})]
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (isVideo) {
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
70
|
+
style: styles.pendingVideoCard,
|
|
71
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
72
|
+
style: styles.pendingVideoPreview,
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
74
|
+
style: styles.pendingVideoIcon,
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlayIcon, {
|
|
76
|
+
width: 24,
|
|
77
|
+
height: 24
|
|
78
|
+
})
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
80
|
+
size: "small",
|
|
81
|
+
color: "#5B6B8C"
|
|
82
|
+
})]
|
|
83
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
84
|
+
style: styles.pendingVideoLabel,
|
|
85
|
+
children: fileName
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
87
|
+
style: styles.pendingVideoStatus,
|
|
88
|
+
children: statusLabel
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (isAudio) {
|
|
93
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
94
|
+
style: styles.pendingAudioCard,
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
96
|
+
style: [styles.pendingAudioButton, {
|
|
97
|
+
backgroundColor: primaryColor
|
|
98
|
+
}],
|
|
99
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlayIcon, {
|
|
100
|
+
width: 18,
|
|
101
|
+
height: 18,
|
|
102
|
+
color: "#fff"
|
|
103
|
+
})
|
|
104
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
105
|
+
style: styles.pendingAudioContent,
|
|
106
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
107
|
+
style: styles.pendingAudioTrack,
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
109
|
+
style: [styles.pendingAudioTrackFill, {
|
|
110
|
+
backgroundColor: primaryColor
|
|
111
|
+
}]
|
|
112
|
+
})
|
|
113
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
114
|
+
style: styles.pendingAudioMeta,
|
|
115
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
116
|
+
style: styles.pendingAudioTime,
|
|
117
|
+
children: "0:00"
|
|
118
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
119
|
+
style: styles.pendingAudioStatusPill,
|
|
120
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
121
|
+
size: "small",
|
|
122
|
+
color: "#5B6B8C"
|
|
123
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
124
|
+
style: styles.pendingAudioStatusText,
|
|
125
|
+
children: statusLabel
|
|
126
|
+
})]
|
|
127
|
+
})]
|
|
128
|
+
})]
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnsupportedType.default, {
|
|
133
|
+
fileURL: previewUri || '',
|
|
134
|
+
fileName: fileName,
|
|
135
|
+
mimetype: mimeType || 'application/octet-stream',
|
|
136
|
+
size: size,
|
|
137
|
+
isUser: isUser,
|
|
138
|
+
pending: true,
|
|
139
|
+
placeholderIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.FileIcon, {
|
|
140
|
+
width: 36,
|
|
141
|
+
height: 36
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
};
|
|
16
145
|
const MediaMessage = ({
|
|
17
146
|
mimeType,
|
|
18
147
|
location,
|
|
@@ -27,11 +156,25 @@ const MediaMessage = ({
|
|
|
27
156
|
url: location || messageText,
|
|
28
157
|
mime: mimeType
|
|
29
158
|
});
|
|
159
|
+
const isAudioPayload = (0, _mimeToExtension.isLikelyAudio)(mimeType, displayName, location, {
|
|
160
|
+
duration: message?.duration,
|
|
161
|
+
waveForm: message?.waveForm,
|
|
162
|
+
originalName: message?.originalName
|
|
163
|
+
});
|
|
164
|
+
if (message?.pending) {
|
|
165
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PendingMediaMessage, {
|
|
166
|
+
fileName: displayName,
|
|
167
|
+
mimeType: mimeType,
|
|
168
|
+
previewUri: messageText || location || '',
|
|
169
|
+
isUser: isUser,
|
|
170
|
+
size: message?.size
|
|
171
|
+
});
|
|
172
|
+
}
|
|
30
173
|
switch (true) {
|
|
31
174
|
case mimeType.startsWith('image/'):
|
|
32
175
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageImage.default, {
|
|
33
176
|
fileName: displayName,
|
|
34
|
-
fileURL: messageText || '',
|
|
177
|
+
fileURL: location || messageText || '',
|
|
35
178
|
mimetype: mimeType
|
|
36
179
|
});
|
|
37
180
|
case mimeType.startsWith('video/'):
|
|
@@ -43,26 +186,53 @@ const MediaMessage = ({
|
|
|
43
186
|
case mimeType.startsWith('audio/'):
|
|
44
187
|
{
|
|
45
188
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AudioMessage.default, {
|
|
46
|
-
src: location || ''
|
|
189
|
+
src: location || '',
|
|
190
|
+
mimeType: mimeType,
|
|
191
|
+
fileName: displayName,
|
|
192
|
+
originalName: message?.originalName,
|
|
193
|
+
duration: message?.duration,
|
|
194
|
+
waveForm: message?.waveForm
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
case mimeType.includes('application/octet-stream'):
|
|
198
|
+
{
|
|
199
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AudioMessage.default, {
|
|
200
|
+
src: location || '',
|
|
201
|
+
mimeType: mimeType,
|
|
202
|
+
fileName: displayName,
|
|
203
|
+
originalName: message?.originalName,
|
|
204
|
+
duration: message?.duration,
|
|
205
|
+
waveForm: message?.waveForm
|
|
47
206
|
});
|
|
48
207
|
}
|
|
49
208
|
default:
|
|
50
209
|
{
|
|
51
|
-
//
|
|
52
|
-
// application/octet-stream
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
210
|
+
// Some senders (notably the web app's voice-message uploader)
|
|
211
|
+
// ship audio as `application/octet-stream` with no audio file
|
|
212
|
+
// extension. `isLikelyAudio` recognises those via the URL path,
|
|
213
|
+
// filename, or voice-message naming hints (voicemail-,
|
|
214
|
+
// voice-note-, recording-, …) so we still render the AudioMessage
|
|
215
|
+
// player instead of falling through to the generic FileDownload
|
|
216
|
+
// card (where the voicemail rendered as a broken `.bin`
|
|
217
|
+
// attachment). Customer-reported #9 voicemail fix.
|
|
218
|
+
if (isAudioPayload) {
|
|
219
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AudioMessage.default, {
|
|
220
|
+
src: location || '',
|
|
221
|
+
mimeType: mimeType,
|
|
222
|
+
fileName: displayName,
|
|
223
|
+
originalName: message?.originalName,
|
|
224
|
+
duration: message?.duration,
|
|
225
|
+
waveForm: message?.waveForm
|
|
226
|
+
});
|
|
60
227
|
}
|
|
61
228
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnsupportedType.default, {
|
|
62
229
|
fileURL: location ? location : '',
|
|
63
230
|
fileName: displayName,
|
|
64
231
|
mimetype: mimeType,
|
|
65
|
-
isUser: isUser
|
|
232
|
+
isUser: isUser,
|
|
233
|
+
originalName: message?.originalName,
|
|
234
|
+
duration: message?.duration,
|
|
235
|
+
waveForm: message?.waveForm
|
|
66
236
|
});
|
|
67
237
|
}
|
|
68
238
|
}
|
|
@@ -72,4 +242,120 @@ const MediaMessage = ({
|
|
|
72
242
|
});
|
|
73
243
|
};
|
|
74
244
|
var _default = exports.default = MediaMessage;
|
|
245
|
+
const styles = _reactNative.StyleSheet.create({
|
|
246
|
+
pendingImageWrapper: {
|
|
247
|
+
width: pendingImageDims.width,
|
|
248
|
+
height: pendingImageDims.height,
|
|
249
|
+
borderRadius: 12,
|
|
250
|
+
overflow: 'hidden',
|
|
251
|
+
backgroundColor: '#EAF0FB'
|
|
252
|
+
},
|
|
253
|
+
pendingImage: {
|
|
254
|
+
width: '100%',
|
|
255
|
+
height: '100%'
|
|
256
|
+
},
|
|
257
|
+
pendingImageOverlay: {
|
|
258
|
+
..._reactNative.StyleSheet.absoluteFillObject,
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
justifyContent: 'center',
|
|
261
|
+
gap: 8,
|
|
262
|
+
backgroundColor: 'rgba(17, 24, 39, 0.28)'
|
|
263
|
+
},
|
|
264
|
+
pendingOverlayText: {
|
|
265
|
+
color: '#FFFFFF',
|
|
266
|
+
fontSize: 13,
|
|
267
|
+
fontWeight: '600'
|
|
268
|
+
},
|
|
269
|
+
pendingVideoCard: {
|
|
270
|
+
width: 220,
|
|
271
|
+
padding: 12,
|
|
272
|
+
borderRadius: 12,
|
|
273
|
+
backgroundColor: '#F3F6FC',
|
|
274
|
+
gap: 10
|
|
275
|
+
},
|
|
276
|
+
pendingVideoPreview: {
|
|
277
|
+
height: 144,
|
|
278
|
+
borderRadius: 10,
|
|
279
|
+
backgroundColor: '#DCE6F7',
|
|
280
|
+
alignItems: 'center',
|
|
281
|
+
justifyContent: 'center',
|
|
282
|
+
gap: 10
|
|
283
|
+
},
|
|
284
|
+
pendingVideoIcon: {
|
|
285
|
+
width: 48,
|
|
286
|
+
height: 48,
|
|
287
|
+
borderRadius: 24,
|
|
288
|
+
backgroundColor: 'rgba(17, 24, 39, 0.45)',
|
|
289
|
+
alignItems: 'center',
|
|
290
|
+
justifyContent: 'center'
|
|
291
|
+
},
|
|
292
|
+
pendingVideoLabel: {
|
|
293
|
+
color: '#141414',
|
|
294
|
+
fontSize: 14,
|
|
295
|
+
fontWeight: '600'
|
|
296
|
+
},
|
|
297
|
+
pendingVideoStatus: {
|
|
298
|
+
color: '#5B6B8C',
|
|
299
|
+
fontSize: 12,
|
|
300
|
+
fontWeight: '500'
|
|
301
|
+
},
|
|
302
|
+
pendingAudioCard: {
|
|
303
|
+
minWidth: 252,
|
|
304
|
+
maxWidth: 288,
|
|
305
|
+
flexDirection: 'row',
|
|
306
|
+
alignItems: 'center',
|
|
307
|
+
gap: 12,
|
|
308
|
+
paddingHorizontal: 12,
|
|
309
|
+
paddingVertical: 10,
|
|
310
|
+
borderRadius: 12,
|
|
311
|
+
backgroundColor: '#F3F6FC'
|
|
312
|
+
},
|
|
313
|
+
pendingAudioButton: {
|
|
314
|
+
width: 44,
|
|
315
|
+
height: 44,
|
|
316
|
+
borderRadius: 22,
|
|
317
|
+
alignItems: 'center',
|
|
318
|
+
justifyContent: 'center'
|
|
319
|
+
},
|
|
320
|
+
pendingAudioContent: {
|
|
321
|
+
flex: 1,
|
|
322
|
+
gap: 8
|
|
323
|
+
},
|
|
324
|
+
pendingAudioTrack: {
|
|
325
|
+
height: 6,
|
|
326
|
+
borderRadius: 999,
|
|
327
|
+
overflow: 'hidden',
|
|
328
|
+
backgroundColor: '#D0D7E6'
|
|
329
|
+
},
|
|
330
|
+
pendingAudioTrackFill: {
|
|
331
|
+
width: '32%',
|
|
332
|
+
height: '100%',
|
|
333
|
+
borderRadius: 999
|
|
334
|
+
},
|
|
335
|
+
pendingAudioMeta: {
|
|
336
|
+
flexDirection: 'row',
|
|
337
|
+
alignItems: 'center',
|
|
338
|
+
justifyContent: 'space-between',
|
|
339
|
+
gap: 12
|
|
340
|
+
},
|
|
341
|
+
pendingAudioTime: {
|
|
342
|
+
color: '#667085',
|
|
343
|
+
fontSize: 12,
|
|
344
|
+
fontWeight: '500'
|
|
345
|
+
},
|
|
346
|
+
pendingAudioStatusPill: {
|
|
347
|
+
flexDirection: 'row',
|
|
348
|
+
alignItems: 'center',
|
|
349
|
+
gap: 6,
|
|
350
|
+
paddingHorizontal: 10,
|
|
351
|
+
paddingVertical: 5,
|
|
352
|
+
borderRadius: 999,
|
|
353
|
+
backgroundColor: '#FFFFFF'
|
|
354
|
+
},
|
|
355
|
+
pendingAudioStatusText: {
|
|
356
|
+
color: '#5B6B8C',
|
|
357
|
+
fontSize: 12,
|
|
358
|
+
fontWeight: '600'
|
|
359
|
+
}
|
|
360
|
+
});
|
|
75
361
|
//# sourceMappingURL=MediaMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_UnsupportedType","_MessageImage","_VideoMessage","_AudioMessage","_reactNative","_mimeToExtension","_jsxRuntime","e","__esModule","default","MediaMessage","mimeType","location","messageText","message","isUser","displayName","deriveDisplayFilename","fileName","originalName","url","mime","startsWith","jsx","fileURL","mimetype","src","includes","test","Text","children","_default","exports"],"sourceRoot":"../../../../src","sources":["components/MainComponents/MediaMessage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,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AQ,CAAC,0BAA0B,CAAC,EAAE;YACjD,IAAI,gCAAgC,CAACC,IAAI,CAACZ,WAAW,CAAC,EAAE;cACtD,oBAAO,IAAAV,WAAA,CAAAiB,GAAA,EAACpB,aAAA,CAAAM,OAAY;gBAACiB,GAAG,EAAEd,QAAQ,IAAI;cAAG,CAAE,CAAC;YAC9C;UACF;UACA,oBACE,IAAAN,WAAA,CAAAiB,GAAA,EAACvB,gBAAA,CAAAS,OAAY;YACXe,OAAO,EAAEZ,QAAQ,GAAGA,QAAQ,GAAG,EAAG;YAClCM,QAAQ,EAAEF,WAAY;YACtBS,QAAQ,EAAEd,QAAS;YACnBI,MAAM,EAAEA;UAAO,CAChB,CAAC;QAEN;IACF;EACF;EACA,oBAAO,IAAAT,WAAA,CAAAiB,GAAA,EAACnB,YAAA,CAAAyB,IAAI;IAAAC,QAAA,EAAC;EAAsB,CAAM,CAAC;AAC5C,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvB,OAAA,GAEaC,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_UnsupportedType","_MessageImage","_VideoMessage","_AudioMessage","_reactNative","_mimeToExtension","_icons","_mediaDimensions","_useChatSettingState","_jsxRuntime","e","__esModule","default","pendingImageDims","defaultMediaDims","getPendingStatusLabel","mimeType","startsWith","includes","PendingMediaMessage","fileName","previewUri","isUser","size","config","useChatSettingState","statusLabel","isImage","isVideo","isAudio","primaryColor","colors","primary","jsxs","View","style","styles","pendingImageWrapper","children","jsx","Image","source","uri","pendingImage","resizeMode","pendingImageOverlay","ActivityIndicator","color","Text","pendingOverlayText","pendingVideoCard","pendingVideoPreview","pendingVideoIcon","PlayIcon","width","height","pendingVideoLabel","pendingVideoStatus","pendingAudioCard","pendingAudioButton","backgroundColor","pendingAudioContent","pendingAudioTrack","pendingAudioTrackFill","pendingAudioMeta","pendingAudioTime","pendingAudioStatusPill","pendingAudioStatusText","fileURL","mimetype","pending","placeholderIcon","FileIcon","MediaMessage","location","messageText","message","displayName","deriveDisplayFilename","originalName","url","mime","isAudioPayload","isLikelyAudio","duration","waveForm","src","_default","exports","StyleSheet","create","borderRadius","overflow","absoluteFillObject","alignItems","justifyContent","gap","fontSize","fontWeight","padding","minWidth","maxWidth","flexDirection","paddingHorizontal","paddingVertical","flex"],"sourceRoot":"../../../../src","sources":["components/MainComponents/MediaMessage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAOA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AAAsE,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAD,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAUtE,MAAMG,gBAAgB,GAAG,IAAAC,iCAAgB,EAAC,CAAC;AAE3C,MAAMC,qBAAqB,GAAIC,QAAiB,IAAK;EACnD,IAAIA,QAAQ,EAAEC,UAAU,CAAC,QAAQ,CAAC,EAAE;IAClC,OAAO,iBAAiB;EAC1B;EACA,IAAID,QAAQ,EAAEC,UAAU,CAAC,QAAQ,CAAC,EAAE;IAClC,OAAO,iBAAiB;EAC1B;EACA,IACED,QAAQ,EAAEC,UAAU,CAAC,QAAQ,CAAC,IAC9BD,QAAQ,EAAEE,QAAQ,CAAC,0BAA0B,CAAC,EAC9C;IACA,OAAO,iBAAiB;EAC1B;EACA,OAAO,gBAAgB;AACzB,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AAC;EACDO,sBAAsB,EAAE;IACtBpB,KAAK,EAAE,SAAS;IAChBkD,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useInteractionsOverlay = exports.default = exports.InteractionsOverlayProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
/**
|
|
12
|
+
* In-tree overlay host for the message context menu (MessageInteractions).
|
|
13
|
+
*
|
|
14
|
+
* Why this exists: MessageInteractions used to render inside a React Native
|
|
15
|
+
* `<Modal>`. On Android a Modal opens its own window, which steals focus
|
|
16
|
+
* from the chat input — so opening the menu dismissed the keyboard. Hosting
|
|
17
|
+
* the menu in the SAME view tree (no extra window) keeps the keyboard up.
|
|
18
|
+
*
|
|
19
|
+
* Coordinate note: the menu is positioned from `UIManager.measure` WINDOW
|
|
20
|
+
* coordinates (pageX/pageY), but this host sits below the status bar / any
|
|
21
|
+
* safe-area + header insets, so its own origin is offset from the window.
|
|
22
|
+
* The host measures that offset (`measureInWindow`) and exposes it so the
|
|
23
|
+
* menu can convert window coords → host-local coords. The host is mounted
|
|
24
|
+
* ABOVE ChatRoom's KeyboardAvoidingView, so its origin doesn't move when the
|
|
25
|
+
* keyboard opens (only the measured bubble's pageY does).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const Ctx = /*#__PURE__*/(0, _react.createContext)({
|
|
29
|
+
present: () => {},
|
|
30
|
+
dismiss: () => {},
|
|
31
|
+
originX: 0,
|
|
32
|
+
originY: 0
|
|
33
|
+
});
|
|
34
|
+
const useInteractionsOverlay = () => (0, _react.useContext)(Ctx);
|
|
35
|
+
exports.useInteractionsOverlay = useInteractionsOverlay;
|
|
36
|
+
const InteractionsOverlayProvider = ({
|
|
37
|
+
children
|
|
38
|
+
}) => {
|
|
39
|
+
const [entries, setEntries] = (0, _react.useState)([]);
|
|
40
|
+
const [origin, setOrigin] = (0, _react.useState)({
|
|
41
|
+
x: 0,
|
|
42
|
+
y: 0
|
|
43
|
+
});
|
|
44
|
+
const hostRef = (0, _react.useRef)(null);
|
|
45
|
+
const measure = (0, _react.useCallback)(() => {
|
|
46
|
+
hostRef.current?.measureInWindow?.((x, y) => {
|
|
47
|
+
if (typeof x !== 'number' || typeof y !== 'number') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
setOrigin(prev => prev.x === x && prev.y === y ? prev : {
|
|
51
|
+
x,
|
|
52
|
+
y
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}, []);
|
|
56
|
+
const present = (0, _react.useCallback)((id, node) => {
|
|
57
|
+
// Re-measure on present: the keyboard / layout may have shifted us
|
|
58
|
+
// since the last onLayout.
|
|
59
|
+
measure();
|
|
60
|
+
setEntries(prev => {
|
|
61
|
+
const next = prev.filter(e => e.id !== id);
|
|
62
|
+
next.push({
|
|
63
|
+
id,
|
|
64
|
+
node
|
|
65
|
+
});
|
|
66
|
+
return next;
|
|
67
|
+
});
|
|
68
|
+
}, [measure]);
|
|
69
|
+
const dismiss = (0, _react.useCallback)(id => {
|
|
70
|
+
setEntries(prev => prev.some(e => e.id === id) ? prev.filter(e => e.id !== id) : prev);
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
// MUST be memoized. Otherwise every host re-render (e.g. from present()'s
|
|
74
|
+
// setEntries) creates a new context value → all consumers re-render →
|
|
75
|
+
// MessageInteractions' present-effect fires again → setEntries → … →
|
|
76
|
+
// "Maximum update depth exceeded". present/dismiss are stable (useCallback)
|
|
77
|
+
// and origin rarely changes, so this value is stable across entry changes.
|
|
78
|
+
const ctxValue = (0, _react.useMemo)(() => ({
|
|
79
|
+
present,
|
|
80
|
+
dismiss,
|
|
81
|
+
originX: origin.x,
|
|
82
|
+
originY: origin.y
|
|
83
|
+
}), [present, dismiss, origin.x, origin.y]);
|
|
84
|
+
return (
|
|
85
|
+
/*#__PURE__*/
|
|
86
|
+
// `children` is a stable element from the caller, so re-rendering this
|
|
87
|
+
// host (present/dismiss/origin state) does NOT re-render the chat
|
|
88
|
+
// subtree — React reconciliation skips the unchanged children element.
|
|
89
|
+
(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
90
|
+
ref: hostRef,
|
|
91
|
+
style: styles.host,
|
|
92
|
+
onLayout: measure,
|
|
93
|
+
collapsable: false,
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Ctx.Provider, {
|
|
95
|
+
value: ctxValue,
|
|
96
|
+
children: [children, entries.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
97
|
+
style: styles.overlay,
|
|
98
|
+
pointerEvents: "box-none",
|
|
99
|
+
children: entries.map(e => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
|
|
100
|
+
children: e.node
|
|
101
|
+
}, e.id))
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
exports.InteractionsOverlayProvider = InteractionsOverlayProvider;
|
|
108
|
+
const styles = _reactNative.StyleSheet.create({
|
|
109
|
+
host: {
|
|
110
|
+
flex: 1
|
|
111
|
+
},
|
|
112
|
+
overlay: {
|
|
113
|
+
..._reactNative.StyleSheet.absoluteFillObject,
|
|
114
|
+
zIndex: 9999,
|
|
115
|
+
elevation: 9999
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var _default = exports.default = InteractionsOverlayProvider;
|
|
119
|
+
//# sourceMappingURL=InteractionsOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Ctx","createContext","present","dismiss","originX","originY","useInteractionsOverlay","useContext","exports","InteractionsOverlayProvider","children","entries","setEntries","useState","origin","setOrigin","x","y","hostRef","useRef","measure","useCallback","current","measureInWindow","prev","id","node","next","filter","push","some","ctxValue","useMemo","jsx","View","ref","style","styles","host","onLayout","collapsable","jsxs","Provider","value","length","overlay","pointerEvents","map","Fragment","StyleSheet","create","flex","absoluteFillObject","zIndex","elevation","_default"],"sourceRoot":"../../../../src","sources":["components/MessageBubble/InteractionsOverlay.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,YAAA,GAAAD,OAAA;AAAgD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,C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AAE,GAAGI,uBAAU,CAACG,kBAAkB;IAAEC,MAAM,EAAE,IAAI;IAAEC,SAAS,EAAE;EAAK;AAC7E,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAA/C,OAAA,CAAAjB,OAAA,GAEYkB,2BAA2B","ignoreList":[]}
|
|
@@ -218,7 +218,22 @@ const Message = ({
|
|
|
218
218
|
// the menu adjacent to the message instead of floating far above (#13).
|
|
219
219
|
const handleLongPress = () => {
|
|
220
220
|
const target = bubbleRef.current ?? messageRef.current;
|
|
221
|
-
if (target) {
|
|
221
|
+
if (target?.measureInWindow) {
|
|
222
|
+
// Use measureInWindow — the SAME API the overlay host uses to find
|
|
223
|
+
// its own window origin. Both are then in identical window
|
|
224
|
+
// coordinates, so MessageInteractions' host-local conversion
|
|
225
|
+
// (subtract origin) is exact. Mixing this with UIManager.measure
|
|
226
|
+
// (pageX/pageY) drifted on Android (status-bar offset) and pushed the
|
|
227
|
+
// "below" menu too far from the message.
|
|
228
|
+
target.measureInWindow((x, y, width, height) => {
|
|
229
|
+
setContextMenuPosition({
|
|
230
|
+
left: x,
|
|
231
|
+
right: x + width,
|
|
232
|
+
top: y,
|
|
233
|
+
bottom: y + height
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
} else if (target) {
|
|
222
237
|
const nodeHandle = (0, _reactNative.findNodeHandle)(target);
|
|
223
238
|
if (nodeHandle) {
|
|
224
239
|
_reactNative.UIManager.measure(nodeHandle, (_x, _y, width, height, pageX, pageY) => {
|
|
@@ -258,8 +273,17 @@ const Message = ({
|
|
|
258
273
|
// justify-content: ${({ isUser }) => (isUser ? "flex-end" : "flex-start")},
|
|
259
274
|
// margin-bottom: ${(props) => !!props.reply && "20px"},
|
|
260
275
|
],
|
|
261
|
-
children: [!isUser && /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomMessagePhotoContainer
|
|
262
|
-
|
|
276
|
+
children: [!isUser && /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomMessagePhotoContainer
|
|
277
|
+
// `disableProfilesInteractions` gates every entry point to the
|
|
278
|
+
// user-profile popup: this in-bubble avatar AND the chat-title
|
|
279
|
+
// press in ChatHeader. When disabled we still render the avatar
|
|
280
|
+
// visually but make it non-interactive (no press, no a11y
|
|
281
|
+
// affordance) — consumers who want it gone entirely can return
|
|
282
|
+
// null from a custom message component.
|
|
283
|
+
, {
|
|
284
|
+
onPress: config?.disableProfilesInteractions ? undefined : () => handleUserAvatarClick(message.user),
|
|
285
|
+
disabled: !!config?.disableProfilesInteractions,
|
|
286
|
+
accessible: !config?.disableProfilesInteractions,
|
|
263
287
|
children: message.user?.profileImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomMessagePhoto, {
|
|
264
288
|
source: {
|
|
265
289
|
uri: message.user.profileImage
|
|
@@ -278,6 +302,18 @@ const Message = ({
|
|
|
278
302
|
flex: 1,
|
|
279
303
|
alignItems: isUser ? 'flex-end' : 'flex-start'
|
|
280
304
|
}
|
|
305
|
+
// A plain tap anywhere on a message bubble dismisses the
|
|
306
|
+
// keyboard. The FlatList's keyboardShouldPersistTaps="handled"
|
|
307
|
+
// already dismisses taps on the empty GAPS between bubbles, but
|
|
308
|
+
// the bubble Pressable itself is a touch responder, so taps that
|
|
309
|
+
// landed on a message were "handled" and the keyboard stayed —
|
|
310
|
+
// which is exactly the "closes only every other time" symptom
|
|
311
|
+
// (hit a gap → close, hit a bubble → stay). Explicitly dismissing
|
|
312
|
+
// here makes it reliable across the whole list. onPress does NOT
|
|
313
|
+
// fire when onLongPress fires, so opening MessageInteractions via
|
|
314
|
+
// long-press never triggers this dismiss.
|
|
315
|
+
,
|
|
316
|
+
onPress: () => _reactNative.Keyboard.dismiss()
|
|
281
317
|
// disableInteractions hides the long-press → context menu
|
|
282
318
|
// (delete / edit / reply / react). Mirrors web's config gate.
|
|
283
319
|
,
|