@droppii-org/chat-sdk 0.1.17 → 0.1.18
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AA2BA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AA2BA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CA4V3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -73,7 +73,7 @@ const MessageList = (props) => {
|
|
|
73
73
|
revokeMessage,
|
|
74
74
|
handleCloseRevoke,
|
|
75
75
|
]);
|
|
76
|
-
const handleMarkConversationMessageAsRead = () => {
|
|
76
|
+
const handleMarkConversationMessageAsRead = useCallback(() => {
|
|
77
77
|
var _a, _b, _c, _d, _e;
|
|
78
78
|
const lastMessage = (_b = (_a = latestLoadState === null || latestLoadState === void 0 ? void 0 : latestLoadState.current) === null || _a === void 0 ? void 0 : _a.messageList) === null || _b === void 0 ? void 0 : _b[0];
|
|
79
79
|
if (!((_c = latestLoadState === null || latestLoadState === void 0 ? void 0 : latestLoadState.current) === null || _c === void 0 ? void 0 : _c.hasMoreNew) &&
|
|
@@ -84,7 +84,7 @@ const MessageList = (props) => {
|
|
|
84
84
|
((_e = scrollRef.current) === null || _e === void 0 ? void 0 : _e.scrollTop) >= BOTTOM_THRESHOLD) {
|
|
85
85
|
markConversationMessageAsRead(conversationId);
|
|
86
86
|
}
|
|
87
|
-
};
|
|
87
|
+
}, [conversationId, moreNewLoading, user === null || user === void 0 ? void 0 : user.userID]);
|
|
88
88
|
const scrollToBottom = () => {
|
|
89
89
|
handleMarkConversationMessageAsRead();
|
|
90
90
|
setTimeout(() => {
|
|
@@ -167,6 +167,18 @@ const MessageList = (props) => {
|
|
|
167
167
|
loadState.initLoading,
|
|
168
168
|
handleMarkConversationMessageAsRead,
|
|
169
169
|
]);
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (!loadState.hasMoreNew &&
|
|
172
|
+
!loadState.initLoading &&
|
|
173
|
+
loadState.messageList.length > 0) {
|
|
174
|
+
handleMarkConversationMessageAsRead();
|
|
175
|
+
}
|
|
176
|
+
}, [
|
|
177
|
+
loadState.messageList.length,
|
|
178
|
+
loadState.hasMoreNew,
|
|
179
|
+
loadState.initLoading,
|
|
180
|
+
handleMarkConversationMessageAsRead,
|
|
181
|
+
]);
|
|
170
182
|
useEffect(() => {
|
|
171
183
|
if (!openMenuId)
|
|
172
184
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAM3C,QAAA,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAM3C,QAAA,MAAM,oBAAoB,gFA2LvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -22,7 +22,6 @@ const useConversationStore = create((set, get) => ({
|
|
|
22
22
|
// conversation
|
|
23
23
|
conversationList: [],
|
|
24
24
|
currentConversation: undefined,
|
|
25
|
-
unreadCount: 0,
|
|
26
25
|
currentGroupInfo: undefined,
|
|
27
26
|
currentMemberInGroup: undefined,
|
|
28
27
|
getConversationListByReq: async (isOffset) => {
|
|
@@ -47,13 +46,10 @@ const useConversationStore = create((set, get) => ({
|
|
|
47
46
|
return tmpConversationList.length === CONVERSATION_SPLIT_COUNT;
|
|
48
47
|
},
|
|
49
48
|
updateConversationList: (list, type) => {
|
|
50
|
-
var _a;
|
|
51
49
|
const idx = list.findIndex((c) => { var _a; return c.conversationID === ((_a = get().currentConversation) === null || _a === void 0 ? void 0 : _a.conversationID); });
|
|
52
50
|
if (idx > -1) {
|
|
53
51
|
get().updateCurrentConversation(list[idx]);
|
|
54
|
-
|
|
55
|
-
set({ conversationData: list[idx] });
|
|
56
|
-
}
|
|
52
|
+
set({ conversationData: list[idx] });
|
|
57
53
|
}
|
|
58
54
|
if (type === "filter") {
|
|
59
55
|
set((state) => ({
|
|
@@ -148,7 +144,6 @@ const useConversationStore = create((set, get) => ({
|
|
|
148
144
|
selectedSourceId: "",
|
|
149
145
|
conversationList: [],
|
|
150
146
|
currentConversation: undefined,
|
|
151
|
-
unreadCount: 0,
|
|
152
147
|
currentGroupInfo: undefined,
|
|
153
148
|
currentMemberInGroup: undefined,
|
|
154
149
|
quotedMessage: null,
|