@ethora/chat-component-rn 26.7.8 → 26.7.9
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 +0 -2
- package/lib/commonjs/assets/icons.js +2 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +17 -8
- 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 +46 -31
- 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 +125 -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/isOwnMessage.js +75 -0
- package/lib/commonjs/helpers/isOwnMessage.js.map +1 -0
- package/lib/commonjs/helpers/mimeToExtension.js +6 -14
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
- package/lib/commonjs/hooks/useChatRoomFocus.js +17 -8
- 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/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 +83 -6
- 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 +17 -8
- 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 +47 -32
- 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 +120 -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/isOwnMessage.js +70 -0
- package/lib/module/helpers/isOwnMessage.js.map +1 -0
- package/lib/module/helpers/mimeToExtension.js +6 -13
- package/lib/module/helpers/mimeToExtension.js.map +1 -1
- package/lib/module/hooks/useChatRoomFocus.js +17 -8
- 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/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 +83 -6
- 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 +69 -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/isOwnMessage.d.ts +36 -0
- package/lib/typescript/helpers/isOwnMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts +0 -15
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
- 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/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 +13 -1
- 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 +0 -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 +21 -10
- 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 +47 -24
- package/src/helpers/createMessageFromXml.ts +20 -1
- package/src/helpers/getDisplayFileName.ts +87 -0
- package/src/helpers/getServerReadTimestamp.ts +120 -0
- package/src/helpers/initXmppRooms.tsx +9 -9
- package/src/helpers/isOwnMessage.ts +90 -0
- package/src/helpers/mimeToExtension.ts +6 -22
- package/src/hooks/useChatRoomFocus.ts +14 -5
- package/src/hooks/useChatWrapperInit.ts +12 -7
- 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 +84 -6
- package/src/types/models/room.model.ts +0 -1
- package/src/types/types.ts +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FUTURE_READ_MARKER_TOLERANCE_MS = void 0;
|
|
7
|
+
exports.getServerReadTimestamp = getServerReadTimestamp;
|
|
8
|
+
exports.isCorruptFutureReadMarker = isCorruptFutureReadMarker;
|
|
9
|
+
var _roomsSlice = require("../roomStore/roomsSlice");
|
|
10
|
+
// A stored/stamped read marker more than this far past the newest
|
|
11
|
+
// message we actually know about for a room is not "the user is a
|
|
12
|
+
// little ahead" - it's a leftover from a device whose clock was wrong
|
|
13
|
+
// when it stamped the marker (bug #38). Generous on purpose: this value
|
|
14
|
+
// only controls when we're willing to treat an existing marker as
|
|
15
|
+
// corrupt and self-heal it, never how far off a legitimate new write can
|
|
16
|
+
// be, so a false positive here just means a bad value survives one extra
|
|
17
|
+
// cycle, not that a good value gets rejected.
|
|
18
|
+
const FUTURE_READ_MARKER_TOLERANCE_MS = exports.FUTURE_READ_MARKER_TOLERANCE_MS = 5 * 60 * 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the "read up to here" marker for `room` using SERVER time,
|
|
21
|
+
* never the device clock.
|
|
22
|
+
*
|
|
23
|
+
* Bug #38: if the device clock is ahead when the user leaves a room, a
|
|
24
|
+
* `Date.now()` read marker lands in the future. The private-store merge
|
|
25
|
+
* (flushLastViewedToPrivateStore.ts) is forward-only ("if (prevNum >=
|
|
26
|
+
* ts) continue"), so once a future marker is written, no later
|
|
27
|
+
* *correct* write can ever replace it - the room's unread count is
|
|
28
|
+
* stuck wrong forever, on every device, from that point on. Anchoring
|
|
29
|
+
* to the newest SERVER-acknowledged message's own timestamp instead
|
|
30
|
+
* means the marker we write can never be ahead of what the server
|
|
31
|
+
* itself has recorded for the room.
|
|
32
|
+
*
|
|
33
|
+
* "Server-acknowledged" excludes:
|
|
34
|
+
* - a message still marked `pending` (the optimistic bubble shown
|
|
35
|
+
* while a send is in flight - it carries the DEVICE send time via
|
|
36
|
+
* `date`, not a server timestamp, until the server echoes it back
|
|
37
|
+
* and insertMessageWithDelimiter flips `pending` off);
|
|
38
|
+
* - a message id present in `heapState.messageHeap` (queued retry -
|
|
39
|
+
* used for offline media sends, see roomHeapSlice.ts) or
|
|
40
|
+
* `heapState.failedMessages` (a send that never reached the server
|
|
41
|
+
* at all).
|
|
42
|
+
*
|
|
43
|
+
* `msgSortableMs` (roomsSlice.ts) reads the server-assigned microsecond
|
|
44
|
+
* timestamp encoded in the first 13 digits of the message id - the same
|
|
45
|
+
* source already used for message ordering and unread counting - so
|
|
46
|
+
* this stays consistent with the rest of the read/unread pipeline.
|
|
47
|
+
*
|
|
48
|
+
* Falls back to the room's existing `lastViewedTimestamp` (so leaving
|
|
49
|
+
* an empty or never-scrolled room doesn't regress the marker), then to
|
|
50
|
+
* `0` when there's truly nothing to anchor to yet (a brand new room
|
|
51
|
+
* with no history and no prior marker). Callers should treat `0` as
|
|
52
|
+
* "skip the write" rather than substituting a device-clock guess.
|
|
53
|
+
*/
|
|
54
|
+
function getServerReadTimestamp(room, heapState) {
|
|
55
|
+
if (!room) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
const heapIds = new Set((heapState?.messageHeap || []).filter(m => m && m.id != null).map(m => String(m.id)));
|
|
59
|
+
const failedIds = new Set(Object.keys(heapState?.failedMessages || {}));
|
|
60
|
+
let newest = 0;
|
|
61
|
+
const messages = room.messages || [];
|
|
62
|
+
for (const m of messages) {
|
|
63
|
+
if (!m || !m.id) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const id = String(m.id);
|
|
67
|
+
if (id === 'delimiter-new' || id === 'delimiter-new-local') {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (m.pending) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (heapIds.has(id) || failedIds.has(id)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const ts = (0, _roomsSlice.msgSortableMs)(m);
|
|
77
|
+
if (ts > newest) {
|
|
78
|
+
newest = ts;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (newest > 0) {
|
|
82
|
+
return newest;
|
|
83
|
+
}
|
|
84
|
+
if (room.lastViewedTimestamp && room.lastViewedTimestamp > 0) {
|
|
85
|
+
return room.lastViewedTimestamp;
|
|
86
|
+
}
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Is `marker` a leftover from a device whose clock was wrong when it
|
|
92
|
+
* stamped a read marker (bug #38)?
|
|
93
|
+
*
|
|
94
|
+
* TWO independent signals must agree before we're willing to throw a
|
|
95
|
+
* stored marker away, because "waive the forward-only guard" is a
|
|
96
|
+
* destructive operation:
|
|
97
|
+
*
|
|
98
|
+
* 1. it sits well past the newest message we know the room has, AND
|
|
99
|
+
* 2. it sits well past real time.
|
|
100
|
+
*
|
|
101
|
+
* Signal 1 alone is NOT enough, and that is the whole point of this
|
|
102
|
+
* function: a device whose local cache for a room is simply stale (very
|
|
103
|
+
* common - any room whose history hasn't been synced yet this session)
|
|
104
|
+
* sees a perfectly legitimate marker written by another device that HAS
|
|
105
|
+
* seen newer messages, and would happily "heal" it backwards, resurrecting
|
|
106
|
+
* already-read messages as unread on every device. A real timestamp can
|
|
107
|
+
* never be ahead of real time, so requiring signal 2 as well means a
|
|
108
|
+
* stale cache on its own can no longer trigger the self-heal.
|
|
109
|
+
*
|
|
110
|
+
* Signal 2 alone is not used either: it would let a device whose own
|
|
111
|
+
* clock is running SLOW mistake every correct marker for a corrupt one.
|
|
112
|
+
*/
|
|
113
|
+
function isCorruptFutureReadMarker(marker, newestAckedMs) {
|
|
114
|
+
if (!Number.isFinite(marker) || marker <= 0) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (!(newestAckedMs > 0)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
if (marker <= newestAckedMs + FUTURE_READ_MARKER_TOLERANCE_MS) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
return marker > Date.now() + FUTURE_READ_MARKER_TOLERANCE_MS;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=getServerReadTimestamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_roomsSlice","require","FUTURE_READ_MARKER_TOLERANCE_MS","exports","getServerReadTimestamp","room","heapState","heapIds","Set","messageHeap","filter","m","id","map","String","failedIds","Object","keys","failedMessages","newest","messages","pending","has","ts","msgSortableMs","lastViewedTimestamp","isCorruptFutureReadMarker","marker","newestAckedMs","Number","isFinite","Date","now"],"sourceRoot":"../../../src","sources":["helpers/getServerReadTimestamp.ts"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,+BAA+B,GAAAC,OAAA,CAAAD,+BAAA,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;AAS5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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EAC/B,IAAId,IAAI,CAACoB,mBAAmB,IAAIpB,IAAI,CAACoB,mBAAmB,GAAG,CAAC,EAAE;IAC5D,OAAOpB,IAAI,CAACoB,mBAAmB;EACjC;EACA,OAAO,CAAC;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CACvCC,MAAc,EACdC,aAAqB,EACZ;EACT,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACH,MAAM,CAAC,IAAIA,MAAM,IAAI,CAAC,EAAE;IAAC,OAAO,KAAK;EAAC;EAC3D,IAAI,EAAEC,aAAa,GAAG,CAAC,CAAC,EAAE;IAAC,OAAO,KAAK;EAAC;EACxC,IAAID,MAAM,IAAIC,aAAa,GAAG1B,+BAA+B,EAAE;IAAC,OAAO,KAAK;EAAC;EAC7E,OAAOyB,MAAM,GAAGI,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG9B,+BAA+B;AAC9D","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _roomsSlice = require("../roomStore/roomsSlice");
|
|
8
|
-
var _updatedChatLastTimestamps = require("./updatedChatLastTimestamps");
|
|
9
8
|
var _initRoomsPresence = require("./initRoomsPresence");
|
|
10
9
|
var _roomStore = require("../roomStore");
|
|
11
10
|
var _authRefresh = require("../networking/authRefresh");
|
|
@@ -44,13 +43,16 @@ const initXmppRooms = async (user, config, xmmpClient, rooms, roomJID) => {
|
|
|
44
43
|
console.log(res);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
// getChatsPrivateStoreRequestStanza hydrates redux itself
|
|
47
|
+
// (dispatch(applyPrivateStoreMarkers(...)) internally, clamped +
|
|
48
|
+
// forward-only) - do not also apply the raw return value here. That
|
|
49
|
+
// used to double-dispatch via updatedChatLastTimestamps' unconditional
|
|
50
|
+
// setLastViewedTimestamp, which has neither the forward-only guard
|
|
51
|
+
// nor the future-marker clamp, so it could silently re-clobber a
|
|
52
|
+
// value the clamp had just corrected (bug #38).
|
|
53
|
+
await xmmpClient.getChatsPrivateStoreRequestStanza();
|
|
50
54
|
} else {
|
|
51
|
-
|
|
52
|
-
const roomTimestampObject = await xmmpClient.getChatsPrivateStoreRequestStanza();
|
|
53
|
-
(0, _updatedChatLastTimestamps.updatedChatLastTimestamps)(roomTimestampObject, _roomStore.store.dispatch);
|
|
55
|
+
await xmmpClient.getChatsPrivateStoreRequestStanza();
|
|
54
56
|
}
|
|
55
57
|
if (config?.refreshTokens?.enabled) {
|
|
56
58
|
// Was a bare call to the consumer-supplied refreshFunction, i.e. a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_roomsSlice","require","
|
|
1
|
+
{"version":3,"names":["_roomsSlice","require","_initRoomsPresence","_roomStore","_authRefresh","initXmppRooms","user","config","xmmpClient","rooms","roomJID","store","dispatch","setCurrentRoom","defaultWallet","walletAddress","console","log","Object","keys","length","initRoomsPresence","newArch","res","getRoomsStanza","getChatsPrivateStoreRequestStanza","refreshTokens","enabled","refreshAuthTokensQuietly","error","setIsLoading","loading","_default","exports","default"],"sourceRoot":"../../../src","sources":["helpers/initXmppRooms.tsx"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAG,MAAAA,CACpBC,IAAU,EACVC,MAAe,EACfC,UAAsB,EACtBC,KAAgC,EAChCC,OAAgB,KACb;EACH,IAAIA,OAAO,EAAE;IACXC,gBAAK,CAACC,QAAQ,CAAC,IAAAC,0BAAc,EAAC;MAAEH,OAAO,EAAEA;IAAQ,CAA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+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isOwnMessage = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Bug #41: during reconnect catch-up (app was backgrounded/offline, then
|
|
9
|
+
* comes back online), messages replayed from MAM could transiently render
|
|
10
|
+
* on the RIGHT (as if sent by the current user) before flipping to the
|
|
11
|
+
* LEFT a moment later. Root cause: `message.user.id === walletAddress`
|
|
12
|
+
* treats `undefined === undefined` (or `'' === ''`) as a match, and the
|
|
13
|
+
* two sides could independently be empty for one frame -- the message's
|
|
14
|
+
* sender id before the MAM-derived value settled, and/or the current
|
|
15
|
+
* user's id before it rehydrated. Two blank ids must never compare equal.
|
|
16
|
+
*
|
|
17
|
+
* A second, related issue: the same logical sender id can show up in
|
|
18
|
+
* different shapes depending on which code path produced it -- a bare
|
|
19
|
+
* id ("wallet123") or a bare JID with an incidental session resource
|
|
20
|
+
* ("wallet123@host/sessionResource", as `senderJID` attrs carry on the
|
|
21
|
+
* wire -- see src/assets/test.xml). In every shape used in this
|
|
22
|
+
* codebase the identifying segment is the part BEFORE the first '@' (or
|
|
23
|
+
* before '/' when there's no '@'); anything after that -- domain,
|
|
24
|
+
* resource -- is noise. Comparing raw strings with `===` fails whenever
|
|
25
|
+
* one side still carries that noise and the other doesn't. Normalizing
|
|
26
|
+
* both sides (strip resource, strip domain, lowercase) before comparing
|
|
27
|
+
* makes the check tolerant of that drift.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Strip a MUC resource (`room@host/resource` -> `room@host`) and then a
|
|
32
|
+
* JID domain (`local@host` -> `local`), lowercasing the result. Applies
|
|
33
|
+
* to both plain ids and full/partial JIDs so either shape normalizes to
|
|
34
|
+
* the same comparable value.
|
|
35
|
+
*/
|
|
36
|
+
const normalizeId = raw => {
|
|
37
|
+
const value = String(raw ?? '').trim();
|
|
38
|
+
if (!value) {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
const withoutResource = value.split('/')[0];
|
|
42
|
+
const withoutDomain = withoutResource.includes('@') ? withoutResource.split('@')[0] : withoutResource;
|
|
43
|
+
return withoutDomain.toLowerCase();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Same precedence the rest of the app uses when it needs "who am I" as a
|
|
47
|
+
// single id: xmppUsername first, walletAddress as the fallback.
|
|
48
|
+
const resolveCurrentUserId = currentUser => {
|
|
49
|
+
if (typeof currentUser === 'string') {
|
|
50
|
+
return currentUser;
|
|
51
|
+
}
|
|
52
|
+
if (!currentUser) {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
return currentUser.xmppUsername || currentUser.walletAddress || currentUser.id || '';
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Robustly determine whether `message` was sent by `currentUser`. Never
|
|
60
|
+
* returns true from two blank/undefined ids, and tolerates bare-id vs.
|
|
61
|
+
* full-JID mismatches between the sender id and the current user id.
|
|
62
|
+
*/
|
|
63
|
+
const isOwnMessage = (message, currentUser) => {
|
|
64
|
+
const messageUserId = normalizeId(message?.user?.id);
|
|
65
|
+
if (!messageUserId) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const currentUserId = normalizeId(resolveCurrentUserId(currentUser));
|
|
69
|
+
if (!currentUserId) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return messageUserId === currentUserId;
|
|
73
|
+
};
|
|
74
|
+
exports.isOwnMessage = isOwnMessage;
|
|
75
|
+
//# sourceMappingURL=isOwnMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["normalizeId","raw","value","String","trim","withoutResource","split","withoutDomain","includes","toLowerCase","resolveCurrentUserId","currentUser","xmppUsername","walletAddress","id","isOwnMessage","message","messageUserId","user","currentUserId","exports"],"sourceRoot":"../../../src","sources":["helpers/isOwnMessage.ts"],"mappings":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OF,aAAa,KAAKE,aAAa;AACxC,CAAC;AAACC,OAAA,CAAAL,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.deriveDisplayFilename = deriveDisplayFilename;
|
|
7
6
|
exports.ensureFilenameHasExtension = ensureFilenameHasExtension;
|
|
8
7
|
exports.filenameFromUrl = filenameFromUrl;
|
|
9
8
|
exports.getExtensionForMime = getExtensionForMime;
|
|
@@ -238,17 +237,10 @@ function ensureFilenameHasExtension(fileName, mime) {
|
|
|
238
237
|
return `${base}${getExtensionForMime(mime)}`;
|
|
239
238
|
}
|
|
240
239
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*
|
|
248
|
-
* Always returns a string with a valid extension.
|
|
249
|
-
*/
|
|
250
|
-
function deriveDisplayFilename(opts) {
|
|
251
|
-
const candidate = opts.fileName && opts.fileName.trim() || opts.originalName && opts.originalName.trim() || filenameFromUrl(opts.url) || '';
|
|
252
|
-
return ensureFilenameHasExtension(candidate, opts.mime);
|
|
253
|
-
}
|
|
240
|
+
// NOTE: the "which name wins" decision (originalName vs the stored
|
|
241
|
+
// fileName vs the URL) lives in helpers/getDisplayFileName.ts - that is
|
|
242
|
+
// the single source of truth used across display, save, share and
|
|
243
|
+
// download call sites (bug #40: this used to be duplicated here with
|
|
244
|
+
// the priority backwards, so attachments showed/saved under the
|
|
245
|
+
// server's hash name instead of the sender's original one).
|
|
254
246
|
//# sourceMappingURL=mimeToExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MIME_TO_EXT","VALID_EXT_RE","AUDIO_EXTENSIONS","IOS_AUDIO_PLAYBACK_EXTENSIONS","IOS_AUDIO_UNSUPPORTED_EXTENSIONS","AUDIO_EXT_RE","RegExp","map","e","replace","join","IOS_AUDIO_PLAYBACK_EXT_RE","AUDIO_NAME_HINT_RE","isLikelyAudio","mime","fileName","url","opts","m","toLowerCase","startsWith","durationNum","duration","Number","isFinite","waveForm","trim","length","name","originalName","urlLast","filenameFromUrl","test","urlPath","noQuery","split","decodeURIComponent","getExtensionForMime","normalized","last","pop","getLowerExtension","value","match","shouldCacheAudioForIosPlayback","src","urlName","candidates","hasIosPlayableName","some","getIosAudioPlaybackCacheExtension","candidate","ext","isUnsupportedAudioForIosPlayback","includes","ensureFilenameHasExtension","base","Date","now"
|
|
1
|
+
{"version":3,"names":["MIME_TO_EXT","VALID_EXT_RE","AUDIO_EXTENSIONS","IOS_AUDIO_PLAYBACK_EXTENSIONS","IOS_AUDIO_UNSUPPORTED_EXTENSIONS","AUDIO_EXT_RE","RegExp","map","e","replace","join","IOS_AUDIO_PLAYBACK_EXT_RE","AUDIO_NAME_HINT_RE","isLikelyAudio","mime","fileName","url","opts","m","toLowerCase","startsWith","durationNum","duration","Number","isFinite","waveForm","trim","length","name","originalName","urlLast","filenameFromUrl","test","urlPath","noQuery","split","decodeURIComponent","getExtensionForMime","normalized","last","pop","getLowerExtension","value","match","shouldCacheAudioForIosPlayback","src","urlName","candidates","hasIosPlayableName","some","getIosAudioPlaybackCacheExtension","candidate","ext","isUnsupportedAudioForIosPlayback","includes","ensureFilenameHasExtension","base","Date","now"],"sourceRoot":"../../../src","sources":["helpers/mimeToExtension.ts"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;AAEA,MAAMA,WAAmC,GAAG;EAC1C;EACA,YAAY,EAAE,MAAM;EACpB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,MAAM;EACnB,YAAY,EAAE,OAAO;EACrB,YAAY,EAAE,OAAO;EACrB,YAAY,EAAE,OAAO;EACrB,WAAW,EAAE,MAAM;EACnB,eAAe,EAAE,MAAM;EACvB,YAAY,EAAE,OAAO;EAErB;EACA,WAAW,EAAE,MAAM;EACnB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MAAMH,IAAI,GAAG,CAACG,IAAI,CAACH,IAAI,IAAI,EAAE,EAAEK,WAAW,CAAC,CAAC,CAACgB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAET,IAAI,CAAC,CAAC;EAClE,IAAIZ,IAAI,KAAK,YAAY,IAAIA,IAAI,KAAK,WAAW,EAAE;IACjD,OAAO,IAAI;EACb;EACA,MAAMiC,UAAU,GAAG,CACjB9B,IAAI,CAACF,QAAQ,EACbE,IAAI,CAACY,YAAY,EACjBE,eAAe,CAACd,IAAI,CAACD,GAAG,CAAC,CAC1B;EACD,OAAO+B,UAAU,CAACE,IAAI,CAAEE,SAAS,IAAK;IACpC,MAAMC,GAAG,GAAGX,iBAAiB,CAACU,SAAS,CAAC;IACxC,OAAO/C,gCAAgC,CAACkD,QAAQ,CAC9CF,GACF,CAAC;EACH,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,0BAA0BA,CACxCxC,QAAmC,EACnCD,IAA+B,EACvB;EACR,MAAM0C,IAAI,GACPzC,QAAQ,IAAIA,QAAQ,CAACW,IAAI,CAAC,CAAC,IAAK,SAAS+B,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE;EACxD,IAAIzD,YAAY,CAAC+B,IAAI,CAACwB,IAAI,CAAC,EAAE;IAAC,OAAOA,IAAI;EAAC;EAC1C,OAAO,GAAGA,IAAI,GAAGnB,mBAAmB,CAACvB,IAAI,CAAC,EAAE;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var _reactRedux = require("react-redux");
|
|
9
9
|
var _roomsSlice = require("../roomStore/roomsSlice");
|
|
10
10
|
var _roomStore = require("../roomStore");
|
|
11
|
+
var _getServerReadTimestamp = require("../helpers/getServerReadTimestamp");
|
|
11
12
|
/**
|
|
12
13
|
* Public hook for consumers embedding `<ChatRoom>` inside a tab-based
|
|
13
14
|
* navigator. Mirrors the mount/unmount unread-tracking that ChatRoom
|
|
@@ -18,7 +19,10 @@ var _roomStore = require("../roomStore");
|
|
|
18
19
|
* Without this hook, `useUnread()` will always return 0 for the chat
|
|
19
20
|
* room because the SDK assumes "mounted == active". With this hook,
|
|
20
21
|
* focus marks the room visible (clearing the badge) and blur stamps
|
|
21
|
-
* `lastViewedTimestamp
|
|
22
|
+
* `lastViewedTimestamp` to the newest SERVER-acknowledged message so
|
|
23
|
+
* future messages count as unread. Deliberately not `Date.now()`: a
|
|
24
|
+
* device clock running ahead would write a future marker that the
|
|
25
|
+
* forward-only private-store merge could never correct again (bug #38).
|
|
22
26
|
*
|
|
23
27
|
* Usage with React Navigation:
|
|
24
28
|
*
|
|
@@ -44,14 +48,19 @@ const useChatRoomFocus = ({
|
|
|
44
48
|
isFocused: false
|
|
45
49
|
});
|
|
46
50
|
const leaveRoom = jid => {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const state = _roomStore.store.getState();
|
|
52
|
+
const rooms = state.rooms?.rooms;
|
|
53
|
+
const timestamp = (0, _getServerReadTimestamp.getServerReadTimestamp)(rooms?.[jid], state.roomHeapSlice);
|
|
54
|
+
// Only stamp when we actually have something to anchor to - skip
|
|
55
|
+
// rather than fall back to the device clock (bug #38).
|
|
56
|
+
if (timestamp > 0) {
|
|
57
|
+
dispatch((0, _roomsSlice.setLastViewedTimestamp)({
|
|
58
|
+
chatJID: jid,
|
|
59
|
+
timestamp
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
52
62
|
dispatch((0, _roomsSlice.clearVisibleRoom)());
|
|
53
|
-
|
|
54
|
-
_roomStore.store.getState().chatSettingStore?.client?.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
63
|
+
state.chatSettingStore?.client?.flushLastViewedToPrivateStoreStanza(rooms, {
|
|
55
64
|
visibleRoomJID: jid
|
|
56
65
|
}).catch(() => {});
|
|
57
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactRedux","_roomsSlice","_roomStore","useChatRoomFocus","roomJID","isFocused","dispatch","useDispatch","prevRef","useRef","leaveRoom","jid","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactRedux","_roomsSlice","_roomStore","_getServerReadTimestamp","useChatRoomFocus","roomJID","isFocused","dispatch","useDispatch","prevRef","useRef","leaveRoom","jid","state","store","getState","rooms","timestamp","getServerReadTimestamp","roomHeapSlice","setLastViewedTimestamp","chatJID","clearVisibleRoom","chatSettingStore","client","flushLastViewedToPrivateStoreStanza","visibleRoomJID","catch","useEffect","prev","current","setCurrentRoom","setVisibleRoom","exports","_default","default"],"sourceRoot":"../../../src","sources":["hooks/useChatRoomFocus.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,gBAAgB,GAAGA,CAAC;EAC/BC,OAAO;EACPC;AACuB,CAAC,KAAK;EAC7B,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMC,OAAO,GAAG,IAAAC,aAAM,EAAiD;IACrEL,OAAO,EAAE,IAAI;IACbC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,MAAMK,SAAS,GAAIC,GAAW,IAAK;IACjC,MAAMC,KAAK,GAAGC,gBAAK,CAACC,QAAQ,CAAC,CAAC;IAC9B,MAAMC,KAAK,GAAGH,KAAK,CAACG,KAAK,EAAEA,KAAK;IAChC,MAAMC,SAAS,GAAG,IAAAC,8C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CM,SAAS,CAACkB,IAAI,CAACxB,OAAO,CAAC;MACzB;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAAC4B,OAAA,CAAA7B,gBAAA,GAAAA,gBAAA;AAAA,IAAA8B,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEa/B,gBAAgB","ignoreList":[]}
|
|
@@ -9,7 +9,6 @@ var _reactRedux = require("react-redux");
|
|
|
9
9
|
var _xmppProvider = require("../context/xmppProvider");
|
|
10
10
|
var _chatAutoEnterer = require("../helpers/chatAutoEnterer");
|
|
11
11
|
var _initRoomsPresence = require("../helpers/initRoomsPresence");
|
|
12
|
-
var _updatedChatLastTimestamps = require("../helpers/updatedChatLastTimestamps");
|
|
13
12
|
var _updateMessagesTillLast = require("../helpers/updateMessagesTillLast");
|
|
14
13
|
var _authRefresh = require("../networking/authRefresh");
|
|
15
14
|
var _chatSettingsSlice = require("../roomStore/chatSettingsSlice");
|
|
@@ -141,11 +140,17 @@ const useChatWrapperInit = ({
|
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
try {
|
|
143
|
+
// getChatsPrivateStoreRequestStanza hydrates redux itself
|
|
144
|
+
// (dispatch(applyPrivateStoreMarkers(...)) internally,
|
|
145
|
+
// clamped + forward-only) - do not also apply the raw
|
|
146
|
+
// return value here. That used to double-dispatch via
|
|
147
|
+
// updatedChatLastTimestamps' unconditional
|
|
148
|
+
// setLastViewedTimestamp, which has neither the
|
|
149
|
+
// forward-only guard nor the future-marker clamp, so on
|
|
150
|
+
// every reconnect it could silently re-clobber a value
|
|
151
|
+
// the clamp had just corrected (bug #38).
|
|
144
152
|
const roomTimestampObject = await newClient.getChatsPrivateStoreRequestStanza();
|
|
145
153
|
console.log('Got chats private store', roomTimestampObject?.length || 0);
|
|
146
|
-
if (roomTimestampObject) {
|
|
147
|
-
(0, _updatedChatLastTimestamps.updatedChatLastTimestamps)(roomTimestampObject, dispatch);
|
|
148
|
-
}
|
|
149
154
|
if (!hasSyncedHistoryRef.current) {
|
|
150
155
|
console.log('Updating messages till last');
|
|
151
156
|
await (0, _updateMessagesTillLast.updateMessagesTillLast)(rooms, newClient);
|
|
@@ -180,11 +185,11 @@ const useChatWrapperInit = ({
|
|
|
180
185
|
setInited(true);
|
|
181
186
|
console.log(' Getting chats private store for existing client');
|
|
182
187
|
try {
|
|
188
|
+
// See the "new client" branch above: getChatsPrivateStoreRequestStanza
|
|
189
|
+
// already hydrates redux (clamped + forward-only); do not
|
|
190
|
+
// also apply the raw return value here.
|
|
183
191
|
const roomTimestampObject = await client.getChatsPrivateStoreRequestStanza();
|
|
184
192
|
console.log('Got chats private store for existing client', roomTimestampObject?.length || 0);
|
|
185
|
-
if (roomTimestampObject) {
|
|
186
|
-
(0, _updatedChatLastTimestamps.updatedChatLastTimestamps)(roomTimestampObject, dispatch);
|
|
187
|
-
}
|
|
188
193
|
if (!hasSyncedHistoryRef.current) {
|
|
189
194
|
console.log('Updating messages till last for existing client');
|
|
190
195
|
await (0, _updateMessagesTillLast.updateMessagesTillLast)(rooms, client);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactRedux","_xmppProvider","_chatAutoEnterer","_initRoomsPresence","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactRedux","_xmppProvider","_chatAutoEnterer","_initRoomsPresence","_updateMessagesTillLast","_authRefresh","_chatSettingsSlice","_roomsSlice","_useRoomState","_useChatSettingState","_isChatIdPresentInArray","_useGetNewArchRoom","_interopRequireDefault","_getRoomsWithRetry","_shallowEqual","e","__esModule","default","useChatWrapperInit","roomJID","wasAutoSelected","config","dispatch","useDispatch","inited","setInited","useState","showModal","setShowModal","isConnectionLost","setConnectionLost","isRetrying","setIsRetrying","hasSyncedHistoryRef","useRef","client","initializeClient","setClient","useXmppClient","syncRooms","useGetNewArchRoom","rooms","useSelector","state","roomsList","useRoomState","user","useChatSettingState","useEffect","xmppPassword","console","log","close","lastSyncedConfigRef","undefined","shallowEqual","current","setConfig","getRoomsWithRertyRequest","retryRooms","getRoomsWithRetry","loadRooms","disableLoad","setIsLoading","loading","loadingText","retryTimeout","initXmmpClient","translates","enabled","translations","setLangSource","xmppUsername","error","chatAutoEnterer","newClient","defaultWallet","walletAddress","xmppSettings","status","Object","keys","length","initRoomsPresence","newArch","loadedRooms","enableRoomsRetry","isSelectedRoomPresent","isChatIdPresentInArray","getRoomsStanza","roomTimestampObject","getChatsPrivateStoreRequestStanza","updateMessagesTillLast","err","warn","refreshTokens","refreshAuthTokensQuietly","setTimeout","clearTimeout","_default","exports"],"sourceRoot":"../../../src","sources":["hooks/useChatWrapperInit.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAC,sBAAA,CAAAb,OAAA;AACA,IAAAc,kBAAA,GAAAd,OAAA;AACA,IAAAe,aAAA,GAAAf,OAAA;AAAuD,SAAAa,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAnBvD;;AAsCA,MAAMG,kBAAkB,GAAGA,CAAC;EAC1BC,OAAO;EACPC,eAAe;EACfC;AACuB,CAAC,KAA+B;EACvD,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAc,CAAC;EAC3C,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EA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SAAS,CAACF,MAAM,CAAC;cACjBL,iBAAiB,CAAC,KAAK,CAAC;YAC1B;YACA;cACET,MAAM,EAAE0E,aAAa,EAAE1B,OAAO,IAAI,IAAA2B,qCAAwB,EAAC,CAAC;YAC9D;UACF;QACF;QACA1E,QAAQ,CAAC,IAAAyC,wBAAY,EAAC;UAAEC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;MAC5C,CAAC,CAAC,OAAOS,KAAK,EAAE;QACdvB,OAAO,CAACuB,KAAK,CAAC,cAAc,EAAEA,KAAK,CAAC;QACpC7C,YAAY,CAAC,KAAK,CAAC;QACnBE,iBAAiB,CAAC,IAAI,CAAC;QACvBL,SAAS,CAAC,KAAK,CAAC;QAChBH,QAAQ,CAAC,IAAAyC,wBAAY,EAAC;UAAEC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;QAC1CE,YAAY,GAAG+B,UAAU,CAAC9B,cAAc,EAAE,IAAI,CAAC;MACjD;IACF,CAAC;IAEDA,cAAc,CAAC,CAAC;IAEhB,OAAO,MAAM;MACX+B,YAAY,CAAChC,YAAY,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAACpB,IAAI,CAACG,YAAY,EAAEH,IAAI,CAAC0B,YAAY,CAAC,CAAC;EAE1C,OAAO;IACLrC,MAAM;IACNX,MAAM;IACNO,UAAU;IACVJ,SAAS;IACTE,gBAAgB;IAChBQ,SAAS,EAAEA,SAAgB;IAC3BZ,SAAS;IACTG;EACF,CAAC;AACH,CAAC;AAAC,IAAAuE,QAAA,GAAAC,OAAA,CAAAnF,OAAA,GAEaC,kBAAkB","ignoreList":[]}
|
|
@@ -85,9 +85,6 @@ const en = {
|
|
|
85
85
|
'action.save': 'Save',
|
|
86
86
|
'action.delete': 'Delete',
|
|
87
87
|
'action.leave': 'Leave',
|
|
88
|
-
'action.muted': 'Muted',
|
|
89
|
-
'action.unmuted': 'Unmuted',
|
|
90
|
-
'toast.muteFailed': 'Could not update notifications for this chat',
|
|
91
88
|
'action.create': 'Create',
|
|
92
89
|
'action.submit': 'Submit',
|
|
93
90
|
'action.translate': 'Translate',
|
|
@@ -315,9 +312,6 @@ const fr = {
|
|
|
315
312
|
'action.save': 'Enregistrer',
|
|
316
313
|
'action.delete': 'Supprimer',
|
|
317
314
|
'action.leave': 'Quitter',
|
|
318
|
-
'action.muted': 'En sourdine',
|
|
319
|
-
'action.unmuted': 'Activé',
|
|
320
|
-
'toast.muteFailed': 'Impossible de modifier les notifications de ce chat',
|
|
321
315
|
'action.create': 'Créer',
|
|
322
316
|
'action.submit': 'Soumettre',
|
|
323
317
|
'action.translate': 'Traduire',
|
|
@@ -545,9 +539,6 @@ const es = {
|
|
|
545
539
|
'action.save': 'Guardar',
|
|
546
540
|
'action.delete': 'Eliminar',
|
|
547
541
|
'action.leave': 'Salir',
|
|
548
|
-
'action.muted': 'Silenciado',
|
|
549
|
-
'action.unmuted': 'Activado',
|
|
550
|
-
'toast.muteFailed': 'No se pudieron cambiar las notificaciones de este chat',
|
|
551
542
|
'action.create': 'Crear',
|
|
552
543
|
'action.submit': 'Enviar',
|
|
553
544
|
'action.translate': 'Traducir',
|
|
@@ -775,9 +766,6 @@ const pt = {
|
|
|
775
766
|
'action.save': 'Guardar',
|
|
776
767
|
'action.delete': 'Eliminar',
|
|
777
768
|
'action.leave': 'Sair',
|
|
778
|
-
'action.muted': 'Muted',
|
|
779
|
-
'action.unmuted': 'Unmuted',
|
|
780
|
-
'toast.muteFailed': 'Could not update notifications for this chat',
|
|
781
769
|
'action.create': 'Criar',
|
|
782
770
|
'action.submit': 'Enviar',
|
|
783
771
|
'action.translate': 'Traduzir',
|
|
@@ -1005,9 +993,6 @@ const ht = {
|
|
|
1005
993
|
'action.save': 'Anrejistre',
|
|
1006
994
|
'action.delete': 'Efase',
|
|
1007
995
|
'action.leave': 'Kite',
|
|
1008
|
-
'action.muted': 'Muted',
|
|
1009
|
-
'action.unmuted': 'Unmuted',
|
|
1010
|
-
'toast.muteFailed': 'Could not update notifications for this chat',
|
|
1011
996
|
'action.create': 'Kreye',
|
|
1012
997
|
'action.submit': 'Soumèt',
|
|
1013
998
|
'action.translate': 'Tradui',
|
|
@@ -1235,9 +1220,6 @@ const zh = {
|
|
|
1235
1220
|
'action.save': '保存',
|
|
1236
1221
|
'action.delete': '删除',
|
|
1237
1222
|
'action.leave': '退出',
|
|
1238
|
-
'action.muted': 'Muted',
|
|
1239
|
-
'action.unmuted': 'Unmuted',
|
|
1240
|
-
'toast.muteFailed': 'Could not update notifications for this chat',
|
|
1241
1223
|
'action.create': '创建',
|
|
1242
1224
|
'action.submit': '提交',
|
|
1243
1225
|
'action.translate': '翻译',
|