@ethora/chat-component-rn 26.7.8 → 26.7.10
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 +3 -2
- package/README.md +10 -0
- package/lib/commonjs/assets/icons.js +2 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +76 -19
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +8 -5
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +5 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +2 -1
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +1 -51
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +51 -12
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +12 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +13 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +13 -2
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/commonjs/components/styled/MessageImage.js +3 -1
- package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
- package/lib/commonjs/components/styled/UnsupportedType.js +14 -4
- package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +3 -1
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +95 -36
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/createMessageFromXml.js +19 -1
- package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
- package/lib/commonjs/helpers/getDisplayFileName.js +79 -0
- package/lib/commonjs/helpers/getDisplayFileName.js.map +1 -0
- package/lib/commonjs/helpers/getServerReadTimestamp.js +188 -0
- package/lib/commonjs/helpers/getServerReadTimestamp.js.map +1 -0
- package/lib/commonjs/helpers/initXmppRooms.js +9 -7
- package/lib/commonjs/helpers/initXmppRooms.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +51 -9
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isOwnMessage.js +75 -0
- package/lib/commonjs/helpers/isOwnMessage.js.map +1 -0
- package/lib/commonjs/helpers/keyboardLayout.js +12 -2
- package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
- package/lib/commonjs/helpers/mimeToExtension.js +6 -14
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
- package/lib/commonjs/helpers/msgSortableMs.js +37 -0
- package/lib/commonjs/helpers/msgSortableMs.js.map +1 -0
- package/lib/commonjs/hooks/useChatRoomFocus.js +45 -12
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/commonjs/hooks/useChatWrapperInit.js +12 -7
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +8 -0
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +0 -18
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +0 -13
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +20 -2
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +45 -11
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +36 -2
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +35 -2
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +200 -11
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +148 -37
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/assets/icons.js +1 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +77 -20
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +9 -6
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +5 -1
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +2 -1
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +3 -53
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +52 -13
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js +12 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +13 -2
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +13 -2
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/module/components/styled/MessageImage.js +3 -1
- package/lib/module/components/styled/MessageImage.js.map +1 -1
- package/lib/module/components/styled/UnsupportedType.js +14 -4
- package/lib/module/components/styled/UnsupportedType.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +3 -1
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/xmppProvider.js +96 -37
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/createMessageFromXml.js +19 -1
- package/lib/module/helpers/createMessageFromXml.js.map +1 -1
- package/lib/module/helpers/getDisplayFileName.js +73 -0
- package/lib/module/helpers/getDisplayFileName.js.map +1 -0
- package/lib/module/helpers/getServerReadTimestamp.js +181 -0
- package/lib/module/helpers/getServerReadTimestamp.js.map +1 -0
- package/lib/module/helpers/initXmppRooms.js +9 -7
- package/lib/module/helpers/initXmppRooms.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +52 -9
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isOwnMessage.js +70 -0
- package/lib/module/helpers/isOwnMessage.js.map +1 -0
- package/lib/module/helpers/keyboardLayout.js +12 -2
- package/lib/module/helpers/keyboardLayout.js.map +1 -1
- package/lib/module/helpers/mimeToExtension.js +6 -13
- package/lib/module/helpers/mimeToExtension.js.map +1 -1
- package/lib/module/helpers/msgSortableMs.js +32 -0
- package/lib/module/helpers/msgSortableMs.js.map +1 -0
- package/lib/module/hooks/useChatRoomFocus.js +46 -13
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/module/hooks/useChatWrapperInit.js +12 -7
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useLogout.js +8 -0
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/i18n/strings.js +0 -18
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +0 -12
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +20 -2
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +45 -11
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/module/networking/xmppClient.js +36 -2
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/index.js +37 -4
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +197 -11
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +136 -33
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +0 -8
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
- package/lib/typescript/components/styled/MessageImage.d.ts +6 -0
- package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
- package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts +6 -0
- 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/createMessageFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/getAvatarColor.d.ts +1 -1
- package/lib/typescript/helpers/getDisplayFileName.d.ts +49 -0
- package/lib/typescript/helpers/getDisplayFileName.d.ts.map +1 -0
- package/lib/typescript/helpers/getServerReadTimestamp.d.ts +108 -0
- package/lib/typescript/helpers/getServerReadTimestamp.d.ts.map +1 -0
- package/lib/typescript/helpers/initXmppRooms.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isOwnMessage.d.ts +36 -0
- package/lib/typescript/helpers/isOwnMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/keyboardLayout.d.ts +5 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
- package/lib/typescript/helpers/mimeToExtension.d.ts +0 -15
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
- package/lib/typescript/helpers/msgSortableMs.d.ts +2 -0
- package/lib/typescript/helpers/msgSortableMs.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatRoomFocus.d.ts +4 -1
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +0 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +9 -2
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts +18 -1
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +42 -3
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +0 -1
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +1 -1
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assets/icons.tsx +0 -24
- package/src/components/MainComponents/ChatRoom.tsx +81 -19
- package/src/components/MainComponents/MediaMessage.tsx +8 -5
- package/src/components/MainComponents/MessageContainer.tsx +5 -1
- package/src/components/MainComponents/MessageList.tsx +2 -1
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +2 -36
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +63 -26
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +14 -2
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +14 -2
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +14 -2
- package/src/components/styled/MessageImage.tsx +8 -1
- package/src/components/styled/UnsupportedType.tsx +14 -4
- package/src/components/styled/VideoMessage.tsx +8 -1
- package/src/context/xmppProvider.tsx +122 -30
- package/src/helpers/createMessageFromXml.ts +20 -1
- package/src/helpers/getDisplayFileName.ts +87 -0
- package/src/helpers/getServerReadTimestamp.ts +197 -0
- package/src/helpers/initXmppRooms.tsx +9 -9
- package/src/helpers/insertMessageWithDelimiter.ts +55 -19
- package/src/helpers/isOwnMessage.ts +90 -0
- package/src/helpers/keyboardLayout.ts +23 -2
- package/src/helpers/mimeToExtension.ts +6 -22
- package/src/helpers/msgSortableMs.ts +25 -0
- package/src/hooks/useChatRoomFocus.ts +49 -9
- package/src/hooks/useChatWrapperInit.ts +12 -7
- package/src/hooks/useLogout.tsx +14 -0
- package/src/i18n/strings.ts +0 -18
- package/src/networking/api-requests/rooms.api.ts +0 -9
- package/src/networking/stanzaHandlers.ts +20 -6
- package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +65 -18
- package/src/networking/xmppClient.ts +41 -2
- package/src/roomStore/index.ts +40 -4
- package/src/roomStore/persistence.ts +197 -7
- package/src/roomStore/roomsSlice.ts +158 -28
- package/src/types/models/room.model.ts +0 -1
- package/src/types/types.ts +14 -1
|
@@ -10,6 +10,7 @@ var _secureFileUrl = require("../../../helpers/secureFileUrl");
|
|
|
10
10
|
var _native = _interopRequireDefault(require("styled-components/native"));
|
|
11
11
|
var _StyledRoomComponents = require("./StyledRoomComponents");
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
|
+
var _getDisplayFileName = require("../../../helpers/getDisplayFileName");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
const PhotoContainer = _native.default.View`
|
|
@@ -26,9 +27,19 @@ const PhotoContainer = _native.default.View`
|
|
|
26
27
|
const LastMessagePhoto = ({
|
|
27
28
|
user,
|
|
28
29
|
locationPreview,
|
|
29
|
-
originalName
|
|
30
|
+
originalName,
|
|
31
|
+
fileName,
|
|
32
|
+
mimetype
|
|
30
33
|
}) => {
|
|
31
34
|
const fileToken = (0, _useFileToken.useFileToken)();
|
|
35
|
+
// Bug #40: prefer the sender's original name over the stored hash
|
|
36
|
+
// name; only fall back to the generic "file" label when neither is
|
|
37
|
+
// present at all (avoids a synthetic "media_<timestamp>.bin" here).
|
|
38
|
+
const displayName = originalName || fileName ? (0, _getDisplayFileName.getDisplayFileName)({
|
|
39
|
+
originalName,
|
|
40
|
+
fileName,
|
|
41
|
+
mimetype
|
|
42
|
+
}) : 'file';
|
|
32
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StyledRoomComponents.LastRoomMessageContainer, {
|
|
33
44
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_StyledRoomComponents.LastRoomMessageName, {
|
|
34
45
|
children: [user?.name || '', ":"]
|
|
@@ -45,7 +56,7 @@ const LastMessagePhoto = ({
|
|
|
45
56
|
})
|
|
46
57
|
})
|
|
47
58
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledRoomComponents.LastRoomMessageText, {
|
|
48
|
-
children:
|
|
59
|
+
children: displayName
|
|
49
60
|
})]
|
|
50
61
|
})]
|
|
51
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_useFileToken","_secureFileUrl","_native","_StyledRoomComponents","_reactNative","_jsxRuntime","e","__esModule","default","PhotoContainer","styled","View","LastMessagePhoto","user","locationPreview","originalName","fileToken","useFileToken","jsxs","LastRoomMessageContainer","children","LastRoomMessageName","name","style","display","flexDirection","gap","jsx","ShadeWrapper","LastMessageImg","src","appendFileToken","LastRoomMessageText","_default","exports"],"sourceRoot":"../../../../../src","sources":["components/RoomComponents/styled/LastMessagePhoto.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AAOA,IAAAK,YAAA,GAAAL,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_useFileToken","_secureFileUrl","_native","_StyledRoomComponents","_reactNative","_getDisplayFileName","_jsxRuntime","e","__esModule","default","PhotoContainer","styled","View","LastMessagePhoto","user","locationPreview","originalName","fileName","mimetype","fileToken","useFileToken","displayName","getDisplayFileName","jsxs","LastRoomMessageContainer","children","LastRoomMessageName","name","style","display","flexDirection","gap","jsx","ShadeWrapper","LastMessageImg","src","appendFileToken","LastRoomMessageText","_default","exports"],"sourceRoot":"../../../../../src","sources":["components/RoomComponents/styled/LastMessagePhoto.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;A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A,eACb,IAAAnB,WAAA,CAAA0B,GAAA,EAAC7B,qBAAA,CAAA8B,YAAY;UAAAR,QAAA,eACX,IAAAnB,WAAA,CAAA0B,GAAA,EAAC7B,qBAAA,CAAA+B,cAAc;YAACC,GAAG,EAAE,IAAAC,8BAAe,EAACrB,eAAe,EAAEI,SAAS;UAAE,CAAE;QAAC,CACxD;MAAC,CACD,CAAC,eACjB,IAAAb,WAAA,CAAA0B,GAAA,EAAC7B,qBAAA,CAAAkC,mBAAmB;QAAAZ,QAAA,EAAEJ;MAAW,CAAsB,CAAC;IAAA,CACpD,CAAC;EAAA,CACiB,CAAC;AAE/B,CAAC;AAAC,IAAAiB,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEaI,gBAAgB","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ var _secureFileUrl = require("../../../helpers/secureFileUrl");
|
|
|
10
10
|
var _native = _interopRequireDefault(require("styled-components/native"));
|
|
11
11
|
var _StyledRoomComponents = require("./StyledRoomComponents");
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
|
+
var _getDisplayFileName = require("../../../helpers/getDisplayFileName");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
const VideoContainer = _native.default.View`
|
|
@@ -40,9 +41,19 @@ const PlayButton = _native.default.View`
|
|
|
40
41
|
const LastMessageVideo = ({
|
|
41
42
|
user,
|
|
42
43
|
location,
|
|
43
|
-
originalName
|
|
44
|
+
originalName,
|
|
45
|
+
fileName,
|
|
46
|
+
mimetype
|
|
44
47
|
}) => {
|
|
45
48
|
const fileToken = (0, _useFileToken.useFileToken)();
|
|
49
|
+
// Bug #40: prefer the sender's original name over the stored hash
|
|
50
|
+
// name; only fall back to the generic "file" label when neither is
|
|
51
|
+
// present at all (avoids a synthetic "media_<timestamp>.bin" here).
|
|
52
|
+
const displayName = originalName || fileName ? (0, _getDisplayFileName.getDisplayFileName)({
|
|
53
|
+
originalName,
|
|
54
|
+
fileName,
|
|
55
|
+
mimetype
|
|
56
|
+
}) : 'file';
|
|
46
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StyledRoomComponents.LastRoomMessageContainer, {
|
|
47
58
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_StyledRoomComponents.LastRoomMessageName, {
|
|
48
59
|
children: [user?.name || '', ":"]
|
|
@@ -63,7 +74,7 @@ const LastMessageVideo = ({
|
|
|
63
74
|
})
|
|
64
75
|
})]
|
|
65
76
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledRoomComponents.LastRoomMessageText, {
|
|
66
|
-
children:
|
|
77
|
+
children: displayName
|
|
67
78
|
})]
|
|
68
79
|
})]
|
|
69
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_useFileToken","_secureFileUrl","_native","_StyledRoomComponents","_reactNative","_jsxRuntime","e","__esModule","default","VideoContainer","styled","View","Thumbnail","Image","PlayButton","LastMessageVideo","user","location","originalName","fileToken","useFileToken","jsxs","LastRoomMessageContainer","children","LastRoomMessageName","name","style","display","flexDirection","gap","jsx","ShadeWrapper","src","appendFileToken","Text","LastRoomMessageText","_default","exports"],"sourceRoot":"../../../../../src","sources":["components/RoomComponents/styled/LastMessageVideo.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AAMA,IAAAK,YAAA,GAAAL,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_useFileToken","_secureFileUrl","_native","_StyledRoomComponents","_reactNative","_getDisplayFileName","_jsxRuntime","e","__esModule","default","VideoContainer","styled","View","Thumbnail","Image","PlayButton","LastMessageVideo","user","location","originalName","fileName","mimetype","fileToken","useFileToken","displayName","getDisplayFileName","jsxs","LastRoomMessageContainer","children","LastRoomMessageName","name","style","display","flexDirection","gap","jsx","ShadeWrapper","src","appendFileToken","Text","LastRoomMessageText","_default","exports"],"sourceRoot":"../../../../../src","sources":["components/RoomComponents/styled/LastMessageVideo.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AAMA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAAyE,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzE,MAAMG,cAAc,GAAGC,eAAM,CAACC,IAAI;AAClC;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,SAAS,GAAGF,eAAM,CAACG,KAAK;AAC9B;AACA;AACA;AACA,CAAC;AAED,MAAMC,UAAU,GAAGJ,eAAM,CAACC,IAAI;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAQD,MAAMI,gBAA2C,GAAGA,CAAC;EACnDC,IAAI;EACJC,QAAQ;EACRC,YAAY;EACZC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAG,IAAAC,0BAAY,EAAC,CAAC;EAChC;EACA;EACA;EACA,MAAMC,WAAW,GAAGL,YAAY,IAAIC,QAAQ,GACxC,IAAAK,sCAAkB,EAAC;IAAEN,YAAY;IAAEC,QAAQ;IAAEC;EAAS,CAAC,CAAC,GACxD,MAAM;EACV,oBACE,IAAAf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
|
|
23
23
|
fileName,
|
|
24
|
+
originalName,
|
|
24
25
|
mimetype,
|
|
25
26
|
locationPreview
|
|
26
27
|
}) => {
|
|
@@ -59,7 +60,8 @@ const CustomMessageImage = ({
|
|
|
59
60
|
dispatch((0, _chatSettingsSlice.setActiveFile)({
|
|
60
61
|
fileName,
|
|
61
62
|
fileURL,
|
|
62
|
-
mimetype
|
|
63
|
+
mimetype,
|
|
64
|
+
originalName
|
|
63
65
|
}));
|
|
64
66
|
dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.FILE_PREVIEW));
|
|
65
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_secureFileUrl","_devLogger","_MediaComponents","_reactRedux","_chatSettingsSlice","_MODAL_TYPES","_reactNative","_mediaDimensions","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","maskToken","url","replace","FALLBACK_IMAGE","CustomMessageImage","fileURL","fileName","mimetype","locationPreview","displayURL","loading","setLoading","useState","dims","setDims","defaultMediaDims","dispatch","useDispatch","useEffect","active","Image","getSize","w","h","fitMediaDimensions","error","pushLog","message","String","handleOpen","setActiveFile","setActiveModal","MODAL_TYPES","FILE_PREVIEW","jsx","Container","style","width","children","jsxs","TouchableOpacity","onPress","activeOpacity","View","position","height","alignItems","justifyContent","zIndex","ActivityIndicator","size","color","source","uri","borderRadius","backgroundColor","onLoadEnd","onError","event","usingPreview","nativeEvent","isSecureFileUrl","requestFileTokenRecovery","resizeMode","_default","exports"],"sourceRoot":"../../../../src","sources":["components/styled/MessageImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAIA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,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L_TYPES","_reactNative","_mediaDimensions","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","maskToken","url","replace","FALLBACK_IMAGE","CustomMessageImage","fileURL","fileName","originalName","mimetype","locationPreview","displayURL","loading","setLoading","useState","dims","setDims","defaultMediaDims","dispatch","useDispatch","useEffect","active","Image","getSize","w","h","fitMediaDimensions","error","pushLog","message","String","handleOpen","setActiveFile","setActiveModal","MODAL_TYPES","FILE_PREVIEW","jsx","Container","style","width","children","jsxs","TouchableOpacity","onPress","activeOpacity","View","position","height","alignItems","justifyContent","zIndex","ActivityIndicator","size","color","source","uri","borderRadius","backgroundColor","onLoadEnd","onError","event","usingPreview","nativeEvent","isSecureFileUrl","requestFileTokenRecovery","resizeMode","_default","exports"],"sourceRoot":"../../../../src","sources":["components/styled/MessageImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAIA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAIA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AAIuC,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAD,wBAAAW,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAb,uBAAA,YAAAA,CAAAW,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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require("react-native");
|
|
|
13
13
|
var _useChatSettingState = require("../../hooks/useChatSettingState");
|
|
14
14
|
var _icons = require("../../assets/icons");
|
|
15
15
|
var _mimeToExtension = require("../../helpers/mimeToExtension");
|
|
16
|
+
var _getDisplayFileName = require("../../helpers/getDisplayFileName");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
const FileDownload = ({
|
|
@@ -31,6 +32,15 @@ const FileDownload = ({
|
|
|
31
32
|
const {
|
|
32
33
|
config
|
|
33
34
|
} = (0, _useChatSettingState.useChatSettingState)();
|
|
35
|
+
|
|
36
|
+
// Bug #40: prefer the sender's original name over the server's stored
|
|
37
|
+
// hash name for both the visible label and the extension badge below.
|
|
38
|
+
const displayName = (0, _getDisplayFileName.getDisplayFileName)({
|
|
39
|
+
originalName,
|
|
40
|
+
fileName,
|
|
41
|
+
location: fileURL,
|
|
42
|
+
mimetype
|
|
43
|
+
});
|
|
34
44
|
const formatFileSize = sizeInBytes => {
|
|
35
45
|
const size = parseInt(sizeInBytes, 10);
|
|
36
46
|
if (isNaN(size)) {
|
|
@@ -71,9 +81,9 @@ const FileDownload = ({
|
|
|
71
81
|
dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.FILE_PREVIEW));
|
|
72
82
|
};
|
|
73
83
|
const extensionLabel = (() => {
|
|
74
|
-
const dotIndex =
|
|
75
|
-
if (dotIndex !== -1 && dotIndex <
|
|
76
|
-
return
|
|
84
|
+
const dotIndex = displayName.lastIndexOf('.');
|
|
85
|
+
if (dotIndex !== -1 && dotIndex < displayName.length - 1) {
|
|
86
|
+
return displayName.slice(dotIndex + 1).toUpperCase();
|
|
77
87
|
}
|
|
78
88
|
return (0, _mimeToExtension.getExtensionForMime)(mimetype).replace('.', '').toUpperCase();
|
|
79
89
|
})();
|
|
@@ -92,7 +102,7 @@ const FileDownload = ({
|
|
|
92
102
|
isUser: isUser,
|
|
93
103
|
colorIsUser: config?.colors?.primary,
|
|
94
104
|
colorUsers: config?.colors?.secondary,
|
|
95
|
-
children: formatFileName(
|
|
105
|
+
children: formatFileName(displayName, 20)
|
|
96
106
|
}), (pending || size) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaComponents.FileSizeContainer, {
|
|
97
107
|
children: pending ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
98
108
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_MediaComponents","_reactRedux","_MODAL_TYPES","_chatSettingsSlice","_reactNative","_useChatSettingState","_icons","_mimeToExtension","_jsxRuntime","e","__esModule","default","FileDownload","fileName","fileURL","mimetype","size","isUser","originalName","duration","waveForm","pending","placeholderIcon","dispatch","useDispatch","config","useChatSettingState","formatFileSize","sizeInBytes","parseInt","isNaN","toFixed","formatFileName","name","maxLength","dotIndex","lastIndexOf","extension","substring","baseName","length","shortenedBaseName","handleOpen","setActiveFile","setActiveModal","MODAL_TYPES","FILE_PREVIEW","extensionLabel","slice","toUpperCase","getExtensionForMime","replace","jsxs","UnsupportedContainer","onPress","activeOpacity","children","jsx","BackgroundFile","FileIcon","width","height","FileInformation","FileName","numberOfLines","colorIsUser","colors","primary","colorUsers","secondary","FileSizeContainer","View","style","flexDirection","alignItems","gap","ActivityIndicator","color","FileSize","_default","exports"],"sourceRoot":"../../../../src","sources":["components/styled/UnsupportedType.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAIA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_MediaComponents","_reactRedux","_MODAL_TYPES","_chatSettingsSlice","_reactNative","_useChatSettingState","_icons","_mimeToExtension","_getDisplayFileName","_jsxRuntime","e","__esModule","default","FileDownload","fileName","fileURL","mimetype","size","isUser","originalName","duration","waveForm","pending","placeholderIcon","dispatch","useDispatch","config","useChatSettingState","displayName","getDisplayFileName","location","formatFileSize","sizeInBytes","parseInt","isNaN","toFixed","formatFileName","name","maxLength","dotIndex","lastIndexOf","extension","substring","baseName","length","shortenedBaseName","handleOpen","setActiveFile","setActiveModal","MODAL_TYPES","FILE_PREVIEW","extensionLabel","slice","toUpperCase","getExtensionForMime","replace","jsxs","UnsupportedContainer","onPress","activeOpacity","children","jsx","BackgroundFile","FileIcon","width","height","FileInformation","FileName","numberOfLines","colorIsUser","colors","primary","colorUsers","secondary","FileSizeContainer","View","style","flexDirection","alignItems","gap","ActivityIndicator","color","FileSize","_default","exports"],"sourceRoot":"../../../../src","sources":["components/styled/UnsupportedType.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAIA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AAAsE,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAD,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAetE,MAAMG,YAAyC,GAAGA,CAAC;EACjDC,QAAQ;EACRC,OAAO;EACPC,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AAA,CAAAkF,QAAQ;YAAAtB,QAAA,EAAC;UAAY,CAAU,CAAC;QAAA,CAC7B,CAAC,gBAEP,IAAAnD,WAAA,CAAAoD,GAAA,EAAC7D,gBAAA,CAAAkF,QAAQ;UAAAtB,QAAA,EAAE7B,cAAc,CAACd,IAAc;QAAC,CAAW;MACrD,CACgB,CACpB,EACA,CAACK,OAAO,IAAI,CAACL,IAAI,iBAChB,IAAAR,WAAA,CAAAoD,GAAA,EAAC7D,gBAAA,CAAA0E,iBAAiB;QAAAd,QAAA,eAChB,IAAAnD,WAAA,CAAAoD,GAAA,EAAC7D,gBAAA,CAAAkF,QAAQ;UAAAtB,QAAA,EAAET;QAAc,CAAW;MAAC,CACpB,CACpB;IAAA,CACc,CAAC;EAAA,CACE,CAAC;AAE3B,CAAC;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEaC,YAAY","ignoreList":[]}
|
|
@@ -113,6 +113,7 @@ const PlaceholderVideo = ({
|
|
|
113
113
|
};
|
|
114
114
|
const CustomMessageVideo = ({
|
|
115
115
|
fileName,
|
|
116
|
+
originalName,
|
|
116
117
|
fileURL,
|
|
117
118
|
mimetype,
|
|
118
119
|
previewURL
|
|
@@ -123,7 +124,8 @@ const CustomMessageVideo = ({
|
|
|
123
124
|
dispatch((0, _chatSettingsSlice.setActiveFile)({
|
|
124
125
|
fileName,
|
|
125
126
|
fileURL,
|
|
126
|
-
mimetype
|
|
127
|
+
mimetype,
|
|
128
|
+
originalName
|
|
127
129
|
}));
|
|
128
130
|
dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.FILE_PREVIEW));
|
|
129
131
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_secureFileUrl","_reactNative","_reactRedux","_chatSettingsSlice","_MODAL_TYPES","_icons","_mediaDimensions","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PlayBadge","jsx","View","style","styles","overlay","pointerEvents","children","playButton","PlayIcon","width","height","PosterVideo","previewURL","onOpen","onPosterError","dims","setDims","useState","defaultMediaDims","useEffect","active","Image","getSize","w","h","fitMediaDimensions","jsxs","Pressable","onPress","wrapper","accessibilityRole","accessibilityLabel","source","uri","video","resizeMode","onError","PlaceholderVideo","CustomMessageVideo","fileName","fileURL","mimetype","dispatch","useDispatch","posterFailed","setPosterFailed","handleOpen","setActiveFile","setActiveModal","MODAL_TYPES","FILE_PREVIEW","isSecureFileUrl","requestFileTokenRecovery","_default","exports","StyleSheet","create","borderRadius","overflow","backgroundColor","absoluteFill","justifyContent","alignItems"],"sourceRoot":"../../../../src","sources":["components/styled/VideoMessage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAIA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAIA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAIuC,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAD,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAU,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,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_secureFileUrl","_reactNative","_reactRedux","_chatSettingsSlice","_MODAL_TYPES","_icons","_mediaDimensions","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PlayBadge","jsx","View","style","styles","overlay","pointerEvents","children","playButton","PlayIcon","width","height","PosterVideo","previewURL","onOpen","onPosterError","dims","setDims","useState","defaultMediaDims","useEffect","active","Image","getSize","w","h","fitMediaDimensions","jsxs","Pressable","onPress","wrapper","accessibilityRole","accessibilityLabel","source","uri","video","resizeMode","onError","PlaceholderVideo","CustomMessageVideo","fileName","originalName","fileURL","mimetype","dispatch","useDispatch","posterFailed","setPosterFailed","handleOpen","setActiveFile","setActiveModal","MODAL_TYPES","FILE_PREVIEW","isSecureFileUrl","requestFileTokenRecovery","_default","exports","StyleSheet","create","borderRadius","overflow","backgroundColor","absoluteFill","justifyContent","alignItems"],"sourceRoot":"../../../../src","sources":["components/styled/VideoMessage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA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VE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVgD,YAAY,EAAE,EAAE;IAChBE,eAAe,EAAE,qBAAqB;IACtCE,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ var _pushSubscriptionService = require("../services/pushSubscriptionService");
|
|
|
21
21
|
var _roomStore = require("../roomStore");
|
|
22
22
|
var _chatSettingsSlice = require("../roomStore/chatSettingsSlice");
|
|
23
23
|
var _roomsSlice = require("../roomStore/roomsSlice");
|
|
24
|
+
var _getServerReadTimestamp = require("../helpers/getServerReadTimestamp");
|
|
24
25
|
var _historyPreloadScheduler = require("../helpers/historyPreloadScheduler");
|
|
25
26
|
var _updateMessagesTillLast = require("../helpers/updateMessagesTillLast");
|
|
26
27
|
var _secureUserStorage = require("../helpers/secureUserStorage");
|
|
@@ -545,17 +546,40 @@ const XmppProvider = ({
|
|
|
545
546
|
// Mark the open room "not visible" while backgrounded so messages
|
|
546
547
|
// that arrive (or MAM-replay on reconnect) count as unread instead
|
|
547
548
|
// of being silently treated as read — the "mounted == visible ==
|
|
548
|
-
// read" gap. Stamp lastViewed
|
|
549
|
-
//
|
|
550
|
-
//
|
|
551
|
-
//
|
|
552
|
-
//
|
|
549
|
+
// read" gap. Stamp lastViewed=<the read boundary, if the user left
|
|
550
|
+
// scrolled up, else the newest server-acked message>, not
|
|
551
|
+
// Date.now(), as the read baseline: a device clock running ahead
|
|
552
|
+
// would otherwise write a future marker that the forward-only
|
|
553
|
+
// private-store merge can never correct again (bug #38). Then
|
|
554
|
+
// clear visibility and flush that marker to the server private
|
|
555
|
+
// store. Restored on the next 'active' transition above. Handled
|
|
556
|
+
// here in the provider so consumers using the component as a
|
|
557
|
+
// package get correct unread without reaching into the chat store
|
|
558
|
+
// themselves.
|
|
559
|
+
//
|
|
560
|
+
// The read boundary (rooms.readBoundaries) is deliberately left
|
|
561
|
+
// untouched here - MessageList normally stays mounted through a
|
|
562
|
+
// simple background/foreground cycle, so its own scroll-tracking
|
|
563
|
+
// ref (the only thing that could re-derive this value) is still
|
|
564
|
+
// intact, and clearing the redux copy would desync the two. It's
|
|
565
|
+
// only USED here for the one-shot stamp+flush, matching customer
|
|
566
|
+
// #42: leaving (or backgrounding) a room while scrolled up must not
|
|
567
|
+
// mark messages the user never reached as read.
|
|
553
568
|
visibleBeforeBackground = visibleRoomJID;
|
|
569
|
+
let boundaryTs = null;
|
|
554
570
|
if (visibleRoomJID) {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
571
|
+
boundaryTs = state.rooms?.readBoundaries?.[visibleRoomJID] ?? null;
|
|
572
|
+
const readTs = (0, _getServerReadTimestamp.getReadMarkerTimestamp)(rooms?.[visibleRoomJID], state.roomHeapSlice, boundaryTs);
|
|
573
|
+
// Nothing to anchor to yet (no known messages, no prior marker)
|
|
574
|
+
// - skip the local stamp rather than fall back to the device
|
|
575
|
+
// clock. The flush below still runs so the visibility clear
|
|
576
|
+
// isn't blocked on this.
|
|
577
|
+
if (readTs > 0) {
|
|
578
|
+
_roomStore.store.dispatch((0, _roomsSlice.setLastViewedTimestamp)({
|
|
579
|
+
chatJID: visibleRoomJID,
|
|
580
|
+
timestamp: readTs
|
|
581
|
+
}));
|
|
582
|
+
}
|
|
559
583
|
// Drop the "New messages" divider for the room we're leaving so it
|
|
560
584
|
// doesn't linger when the user comes back (mirrors ChatRoom's
|
|
561
585
|
// unmount cleanup, which never runs while the pane stays mounted).
|
|
@@ -566,9 +590,14 @@ const XmppProvider = ({
|
|
|
566
590
|
_roomStore.store.dispatch((0, _roomsSlice.clearVisibleRoom)());
|
|
567
591
|
}
|
|
568
592
|
// Fire-and-forget — we're going to the background and don't
|
|
569
|
-
// care about the resolution path.
|
|
593
|
+
// care about the resolution path. `visibleRoomTs` carries the same
|
|
594
|
+
// boundary to the SERVER marker - without it the flush defaults to
|
|
595
|
+
// "everything" for the visible room, overriding a correct smaller
|
|
596
|
+
// local count.
|
|
570
597
|
c.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
571
|
-
visibleRoomJID
|
|
598
|
+
visibleRoomJID,
|
|
599
|
+
// Clamped through the same helper as the local stamp above.
|
|
600
|
+
visibleRoomTs: visibleRoomJID ? (0, _getServerReadTimestamp.getFlushBoundaryTs)(rooms?.[visibleRoomJID], state.roomHeapSlice, boundaryTs) : undefined
|
|
572
601
|
}).catch(() => {});
|
|
573
602
|
});
|
|
574
603
|
return () => sub.remove();
|
|
@@ -581,11 +610,11 @@ const XmppProvider = ({
|
|
|
581
610
|
// "shown" from "hidden", so the unread middleware would keep the open
|
|
582
611
|
// room's badge at 0 and messages arriving while you're elsewhere look
|
|
583
612
|
// already-read. When the host passes `isVisible`, mirror the AppState
|
|
584
|
-
// background/foreground handling: hidden → stamp lastViewed
|
|
585
|
-
// room visibility (so later messages
|
|
586
|
-
// visibility for the open room. Doing
|
|
587
|
-
// touch the chat store themselves.
|
|
588
|
-
// nothing to do.)
|
|
613
|
+
// background/foreground handling: hidden → stamp lastViewed=<newest
|
|
614
|
+
// server-acked message> + clear room visibility (so later messages
|
|
615
|
+
// count) + flush; shown → restore visibility for the open room. Doing
|
|
616
|
+
// it here means consumers never touch the chat store themselves.
|
|
617
|
+
// (Undefined = host unmounts on hide, nothing to do.)
|
|
589
618
|
// -----------------------------------------------------------
|
|
590
619
|
const chatWasVisibleRef = (0, _react.useRef)(false);
|
|
591
620
|
(0, _react.useEffect)(() => {
|
|
@@ -604,11 +633,25 @@ const XmppProvider = ({
|
|
|
604
633
|
}));
|
|
605
634
|
}
|
|
606
635
|
} else {
|
|
636
|
+
// The read boundary (rooms.readBoundaries) is USED for the stamp
|
|
637
|
+
// and flush below but deliberately left in place - a host using
|
|
638
|
+
// `isVisible` keeps <Chat> mounted while hidden, so MessageList's
|
|
639
|
+
// own scroll-tracking ref is still intact and the redux copy must
|
|
640
|
+
// stay in sync with it. Only consumed, never Date.now(): a fast
|
|
641
|
+
// device clock would write a future marker that the forward-only
|
|
642
|
+
// private-store merge could then never correct (bug #38). And
|
|
643
|
+
// never "the newest acked message" unconditionally either - that
|
|
644
|
+
// silently marks messages the user scrolled past and never reached
|
|
645
|
+
// as read (bug #42, a regression of #33).
|
|
646
|
+
const boundaryTs = activeRoomJID ? state.rooms?.readBoundaries?.[activeRoomJID] ?? null : null;
|
|
607
647
|
if (wasVisible && activeRoomJID) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
648
|
+
const readTs = (0, _getServerReadTimestamp.getReadMarkerTimestamp)(rooms?.[activeRoomJID], state.roomHeapSlice, boundaryTs);
|
|
649
|
+
if (readTs > 0) {
|
|
650
|
+
_roomStore.store.dispatch((0, _roomsSlice.setLastViewedTimestamp)({
|
|
651
|
+
chatJID: activeRoomJID,
|
|
652
|
+
timestamp: readTs
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
612
655
|
// Drop the "New messages" divider so it's gone when the user
|
|
613
656
|
// returns to the chat (mirrors ChatRoom's unmount cleanup).
|
|
614
657
|
_roomStore.store.dispatch((0, _roomsSlice.deleteRoomMessage)({
|
|
@@ -619,7 +662,11 @@ const XmppProvider = ({
|
|
|
619
662
|
_roomStore.store.dispatch((0, _roomsSlice.clearVisibleRoom)());
|
|
620
663
|
if (wasVisible && client?.flushLastViewedToPrivateStoreStanza) {
|
|
621
664
|
client.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
622
|
-
visibleRoomJID: activeRoomJID
|
|
665
|
+
visibleRoomJID: activeRoomJID,
|
|
666
|
+
// Carry the same boundary to the SERVER marker - without it
|
|
667
|
+
// the flush defaults to "everything" for the visible room.
|
|
668
|
+
// Clamped exactly like the local stamp above.
|
|
669
|
+
visibleRoomTs: activeRoomJID ? (0, _getServerReadTimestamp.getFlushBoundaryTs)(rooms?.[activeRoomJID], state.roomHeapSlice, boundaryTs) : undefined
|
|
623
670
|
}).catch(() => {});
|
|
624
671
|
}
|
|
625
672
|
}
|
|
@@ -645,32 +692,44 @@ const XmppProvider = ({
|
|
|
645
692
|
return;
|
|
646
693
|
}
|
|
647
694
|
lastMessagesRef = room.messages;
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
695
|
+
|
|
696
|
+
// getReadMarkerTimestamp (not a hand-rolled scan + Date.now()):
|
|
697
|
+
// it excludes pending/optimistic messages, which carry the DEVICE
|
|
698
|
+
// send time via `date` until the server echoes them back - a
|
|
699
|
+
// manual scan without that exclusion could pick up a pending
|
|
700
|
+
// message's device timestamp here and write a future marker the
|
|
701
|
+
// same way a raw Date.now() would (bug #38). And when the user has
|
|
702
|
+
// scrolled up (a boundary is set for this room), it clamps to that
|
|
703
|
+
// boundary instead of the newest message - without this, every
|
|
704
|
+
// incoming message while scrolled up advanced the marker to
|
|
705
|
+
// "newest" regardless of scroll position, and the later, smaller
|
|
706
|
+
// boundary write on leave was rejected by the forward-only
|
|
707
|
+
// private-store merge, leaving 0 unread even after a restart
|
|
708
|
+
// (customer #42, a regression of #33 reintroduced by #38).
|
|
709
|
+
const boundaryTs = s.rooms?.readBoundaries?.[jid] ?? null;
|
|
710
|
+
const newest = (0, _getServerReadTimestamp.getReadMarkerTimestamp)(room, s.roomHeapSlice, boundaryTs);
|
|
711
|
+
if (!newest || newest <= lastStampedMs) {
|
|
660
712
|
return;
|
|
661
713
|
}
|
|
662
714
|
lastStampedMs = newest;
|
|
663
715
|
_roomStore.store.dispatch((0, _roomsSlice.setLastViewedTimestamp)({
|
|
664
716
|
chatJID: jid,
|
|
665
|
-
timestamp:
|
|
717
|
+
timestamp: newest
|
|
666
718
|
}));
|
|
667
719
|
if (flushTimer) {
|
|
668
720
|
clearTimeout(flushTimer);
|
|
669
721
|
}
|
|
670
722
|
if (client?.flushLastViewedToPrivateStoreStanza) {
|
|
671
723
|
flushTimer = setTimeout(() => {
|
|
672
|
-
|
|
673
|
-
|
|
724
|
+
// Re-read fresh state rather than closing over `boundaryTs`:
|
|
725
|
+
// the user may have scrolled back to the bottom (clearing the
|
|
726
|
+
// boundary) in the 2s between the stamp and this flush, and
|
|
727
|
+
// the flush should reflect that.
|
|
728
|
+
const freshState = _roomStore.store.getState();
|
|
729
|
+
const freshBoundaryTs = freshState.rooms?.readBoundaries?.[jid] ?? null;
|
|
730
|
+
client.flushLastViewedToPrivateStoreStanza(freshState.rooms?.rooms, {
|
|
731
|
+
visibleRoomJID: jid,
|
|
732
|
+
visibleRoomTs: (0, _getServerReadTimestamp.getFlushBoundaryTs)(freshState.rooms?.rooms?.[jid], freshState.roomHeapSlice, freshBoundaryTs)
|
|
674
733
|
}).catch(() => {});
|
|
675
734
|
}, 2000);
|
|
676
735
|
}
|