@onyx-p/imlib-web 2.0.5 → 2.0.7
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/index.esm.js +3 -6
- package/index.umd.js +3 -6
- package/package.json +1 -1
package/index.esm.js
CHANGED
@@ -28704,9 +28704,7 @@ class IMClient extends EventEmitter {
|
|
28704
28704
|
});
|
28705
28705
|
}
|
28706
28706
|
async getPreviousHistoryMessages(conversation, timestamp, count = 20) {
|
28707
|
-
logger.warn('getPreviousHistoryMessages', conversation, timestamp, count);
|
28708
28707
|
const cachedResult = MessageCache.get().getPreviousMessages(conversation, timestamp ?? '0', count);
|
28709
|
-
logger.warn('getPreviousHistoryMessages cachedResult', cachedResult);
|
28710
28708
|
if (!timestamp && cachedResult.messages.length) {
|
28711
28709
|
ConversationManager$1.get().refreshLatestMessage(conversation, cachedResult.messages[cachedResult.messages.length - 1]);
|
28712
28710
|
}
|
@@ -28719,17 +28717,17 @@ class IMClient extends EventEmitter {
|
|
28719
28717
|
}
|
28720
28718
|
};
|
28721
28719
|
}
|
28720
|
+
const remotesTimestamp = cachedResult.messages[0]?.sentTime ?? timestamp;
|
28722
28721
|
const remotesResult = await this.getRemoteHistoryMessages(conversation, {
|
28723
|
-
timestamp:
|
28722
|
+
timestamp: remotesTimestamp,
|
28724
28723
|
count: count - cachedResult.messages.length,
|
28725
28724
|
order: 0
|
28726
28725
|
});
|
28727
|
-
logger.warn('getPreviousHistoryMessages remotesResult', remotesResult);
|
28728
28726
|
if (remotesResult.code !== ErrorCode.SUCCESS) {
|
28729
28727
|
return remotesResult;
|
28730
28728
|
}
|
28731
28729
|
const remotesMessages = remotesResult.data.list;
|
28732
|
-
if (!
|
28730
|
+
if (!remotesTimestamp) {
|
28733
28731
|
ConversationManager$1.get().refreshLatestMessage(conversation, remotesMessages[remotesMessages.length - 1]);
|
28734
28732
|
}
|
28735
28733
|
MessageCache.get().addMessages(remotesMessages, conversation, !remotesResult.data.hasMore);
|
@@ -30108,7 +30106,6 @@ const getRemoteHistoryMessages = async (conversation, options) => {
|
|
30108
30106
|
assert('conversation', conversation, AssertRules.CONVERSATION, true);
|
30109
30107
|
const paramsStr = 'conversationType:' + conversation.conversationType + ',targetId:' + conversation.targetId;
|
30110
30108
|
logger.debug('get remote history message ->' + paramsStr);
|
30111
|
-
logger.warn('getRemoteHistoryMessages options', options);
|
30112
30109
|
if (isDef(options.timestamp)) {
|
30113
30110
|
options.timestamp = options.timestamp.toString();
|
30114
30111
|
}
|
package/index.umd.js
CHANGED
@@ -28710,9 +28710,7 @@
|
|
28710
28710
|
});
|
28711
28711
|
}
|
28712
28712
|
async getPreviousHistoryMessages(conversation, timestamp, count = 20) {
|
28713
|
-
logger.warn('getPreviousHistoryMessages', conversation, timestamp, count);
|
28714
28713
|
const cachedResult = MessageCache.get().getPreviousMessages(conversation, timestamp ?? '0', count);
|
28715
|
-
logger.warn('getPreviousHistoryMessages cachedResult', cachedResult);
|
28716
28714
|
if (!timestamp && cachedResult.messages.length) {
|
28717
28715
|
ConversationManager$1.get().refreshLatestMessage(conversation, cachedResult.messages[cachedResult.messages.length - 1]);
|
28718
28716
|
}
|
@@ -28725,17 +28723,17 @@
|
|
28725
28723
|
}
|
28726
28724
|
};
|
28727
28725
|
}
|
28726
|
+
const remotesTimestamp = cachedResult.messages[0]?.sentTime ?? timestamp;
|
28728
28727
|
const remotesResult = await this.getRemoteHistoryMessages(conversation, {
|
28729
|
-
timestamp:
|
28728
|
+
timestamp: remotesTimestamp,
|
28730
28729
|
count: count - cachedResult.messages.length,
|
28731
28730
|
order: 0
|
28732
28731
|
});
|
28733
|
-
logger.warn('getPreviousHistoryMessages remotesResult', remotesResult);
|
28734
28732
|
if (remotesResult.code !== exports.ErrorCode.SUCCESS) {
|
28735
28733
|
return remotesResult;
|
28736
28734
|
}
|
28737
28735
|
const remotesMessages = remotesResult.data.list;
|
28738
|
-
if (!
|
28736
|
+
if (!remotesTimestamp) {
|
28739
28737
|
ConversationManager$1.get().refreshLatestMessage(conversation, remotesMessages[remotesMessages.length - 1]);
|
28740
28738
|
}
|
28741
28739
|
MessageCache.get().addMessages(remotesMessages, conversation, !remotesResult.data.hasMore);
|
@@ -30114,7 +30112,6 @@
|
|
30114
30112
|
assert('conversation', conversation, AssertRules.CONVERSATION, true);
|
30115
30113
|
const paramsStr = 'conversationType:' + conversation.conversationType + ',targetId:' + conversation.targetId;
|
30116
30114
|
logger.debug('get remote history message ->' + paramsStr);
|
30117
|
-
logger.warn('getRemoteHistoryMessages options', options);
|
30118
30115
|
if (isDef(options.timestamp)) {
|
30119
30116
|
options.timestamp = options.timestamp.toString();
|
30120
30117
|
}
|