@onyx-p/imlib-web 2.2.6 → 2.2.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 CHANGED
@@ -29108,7 +29108,11 @@ async function saveSentMessage(receivedMessage, options) {
29108
29108
  const cache = MessageCache$1.get();
29109
29109
  if (receivedMessage.isPersited && cache) {
29110
29110
  await cache.upsertMessage(receivedMessage);
29111
- const latestMessage = await cache.getLatestMessage(options.conversation);
29111
+ const cachedLatestMessage = await cache.getLatestMessage(options.conversation);
29112
+ let latestMessage = receivedMessage;
29113
+ if (cachedLatestMessage && Long.fromString(cachedLatestMessage.sentTime).greaterThan(Long.fromString(receivedMessage.sentTime))) {
29114
+ latestMessage = cachedLatestMessage;
29115
+ }
29112
29116
  ConversationManager$1.get().updateLatestMessage(options.conversation, latestMessage);
29113
29117
  }
29114
29118
  } catch (error) {
@@ -29186,9 +29190,11 @@ class IMClient extends EventEmitter {
29186
29190
  }
29187
29191
  return true;
29188
29192
  });
29189
- this.emit(Events.MESSAGES, {
29190
- messages: filteredMessages
29191
- });
29193
+ if (filteredMessages.length) {
29194
+ this.emit(Events.MESSAGES, {
29195
+ messages: filteredMessages
29196
+ });
29197
+ }
29192
29198
  },
29193
29199
  pullFinished: () => {
29194
29200
  this.emit(Events.PULL_OFFLINE_MESSAGE_FINISHED);
package/index.umd.js CHANGED
@@ -29114,7 +29114,11 @@
29114
29114
  const cache = MessageCache$1.get();
29115
29115
  if (receivedMessage.isPersited && cache) {
29116
29116
  await cache.upsertMessage(receivedMessage);
29117
- const latestMessage = await cache.getLatestMessage(options.conversation);
29117
+ const cachedLatestMessage = await cache.getLatestMessage(options.conversation);
29118
+ let latestMessage = receivedMessage;
29119
+ if (cachedLatestMessage && Long.fromString(cachedLatestMessage.sentTime).greaterThan(Long.fromString(receivedMessage.sentTime))) {
29120
+ latestMessage = cachedLatestMessage;
29121
+ }
29118
29122
  ConversationManager$1.get().updateLatestMessage(options.conversation, latestMessage);
29119
29123
  }
29120
29124
  } catch (error) {
@@ -29192,9 +29196,11 @@
29192
29196
  }
29193
29197
  return true;
29194
29198
  });
29195
- this.emit(exports.Events.MESSAGES, {
29196
- messages: filteredMessages
29197
- });
29199
+ if (filteredMessages.length) {
29200
+ this.emit(exports.Events.MESSAGES, {
29201
+ messages: filteredMessages
29202
+ });
29203
+ }
29198
29204
  },
29199
29205
  pullFinished: () => {
29200
29206
  this.emit(exports.Events.PULL_OFFLINE_MESSAGE_FINISHED);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",