@onyx-p/imlib-web 1.9.0 → 1.9.2

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.
Files changed (3) hide show
  1. package/index.esm.js +19 -10
  2. package/index.umd.js +19 -10
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -20716,9 +20716,7 @@ class MessageLoader {
20716
20716
  outputMsgs.forEach((l, dialogId) => {
20717
20717
  let messageList = [];
20718
20718
  l.forEach(m => {
20719
- if (m.messageDirection === MessageDirection.SEND && m.messageId && SentMessageStore.has(m.messageId)) {
20720
- SentMessageStore.remove(m.messageId);
20721
- } else if (m.messageType === MessageTypes.RECALL && RecallMessageStore.has(m.content.messageUId)) {
20719
+ if (m.messageType === MessageTypes.RECALL && RecallMessageStore.has(m.content.messageUId)) {
20722
20720
  RecallMessageStore.remove(m.content.messageUId);
20723
20721
  } else {
20724
20722
  m.isOffLineMessage = isOffLineMessage;
@@ -28428,24 +28426,30 @@ class MessageCache {
28428
28426
  }
28429
28427
  const messageUIdSet = new Set(event.messageUIdList);
28430
28428
  let updated = false;
28431
- for (let i = 0; i < cachedMessages.length; i++) {
28432
- const message = cachedMessages[i];
28429
+ const updatedMessages = cachedMessages.map((message, index) => {
28433
28430
  if (messageUIdSet.has(message.messageUId)) {
28434
28431
  if (type === 0) {
28435
28432
  if (message.receivedStatus < ReceivedStatus.RECEIVED) {
28436
- message.receivedStatus = ReceivedStatus.RECEIVED;
28437
28433
  updated = true;
28434
+ return {
28435
+ ...message,
28436
+ receivedStatus: ReceivedStatus.RECEIVED
28437
+ };
28438
28438
  }
28439
28439
  } else {
28440
28440
  if (message.receivedStatus < ReceivedStatus.READ) {
28441
- message.receivedStatus = ReceivedStatus.READ;
28442
28441
  updated = true;
28442
+ return {
28443
+ ...message,
28444
+ receivedStatus: ReceivedStatus.READ
28445
+ };
28443
28446
  }
28444
28447
  }
28445
28448
  }
28446
- }
28449
+ return message;
28450
+ });
28447
28451
  if (updated) {
28448
- this.messageCache.set(dialogId, cachedMessages);
28452
+ this.messageCache.set(dialogId, updatedMessages);
28449
28453
  }
28450
28454
  }
28451
28455
  clearBurnAfterReadingExpiredMessages(conversation) {
@@ -28530,8 +28534,13 @@ class IMClient extends EventEmitter {
28530
28534
  },
28531
28535
  batchMessage: messages => {
28532
28536
  MessageCache.get().addMessages(messages);
28537
+ const filteredMessages = messages.filter(m => {
28538
+ if (m.messageDirection === MessageDirection.SEND && m.messageId && SentMessageStore.has(m.messageId)) {
28539
+ SentMessageStore.remove(m.messageId);
28540
+ }
28541
+ });
28533
28542
  this.emit(Events.MESSAGES, {
28534
- messages
28543
+ messages: filteredMessages
28535
28544
  });
28536
28545
  },
28537
28546
  pullFinished: () => {
package/index.umd.js CHANGED
@@ -20722,9 +20722,7 @@
20722
20722
  outputMsgs.forEach((l, dialogId) => {
20723
20723
  let messageList = [];
20724
20724
  l.forEach(m => {
20725
- if (m.messageDirection === exports.MessageDirection.SEND && m.messageId && SentMessageStore.has(m.messageId)) {
20726
- SentMessageStore.remove(m.messageId);
20727
- } else if (m.messageType === MessageTypes.RECALL && RecallMessageStore.has(m.content.messageUId)) {
20725
+ if (m.messageType === MessageTypes.RECALL && RecallMessageStore.has(m.content.messageUId)) {
20728
20726
  RecallMessageStore.remove(m.content.messageUId);
20729
20727
  } else {
20730
20728
  m.isOffLineMessage = isOffLineMessage;
@@ -28434,24 +28432,30 @@
28434
28432
  }
28435
28433
  const messageUIdSet = new Set(event.messageUIdList);
28436
28434
  let updated = false;
28437
- for (let i = 0; i < cachedMessages.length; i++) {
28438
- const message = cachedMessages[i];
28435
+ const updatedMessages = cachedMessages.map((message, index) => {
28439
28436
  if (messageUIdSet.has(message.messageUId)) {
28440
28437
  if (type === 0) {
28441
28438
  if (message.receivedStatus < exports.ReceivedStatus.RECEIVED) {
28442
- message.receivedStatus = exports.ReceivedStatus.RECEIVED;
28443
28439
  updated = true;
28440
+ return {
28441
+ ...message,
28442
+ receivedStatus: exports.ReceivedStatus.RECEIVED
28443
+ };
28444
28444
  }
28445
28445
  } else {
28446
28446
  if (message.receivedStatus < exports.ReceivedStatus.READ) {
28447
- message.receivedStatus = exports.ReceivedStatus.READ;
28448
28447
  updated = true;
28448
+ return {
28449
+ ...message,
28450
+ receivedStatus: exports.ReceivedStatus.READ
28451
+ };
28449
28452
  }
28450
28453
  }
28451
28454
  }
28452
- }
28455
+ return message;
28456
+ });
28453
28457
  if (updated) {
28454
- this.messageCache.set(dialogId, cachedMessages);
28458
+ this.messageCache.set(dialogId, updatedMessages);
28455
28459
  }
28456
28460
  }
28457
28461
  clearBurnAfterReadingExpiredMessages(conversation) {
@@ -28536,8 +28540,13 @@
28536
28540
  },
28537
28541
  batchMessage: messages => {
28538
28542
  MessageCache.get().addMessages(messages);
28543
+ const filteredMessages = messages.filter(m => {
28544
+ if (m.messageDirection === exports.MessageDirection.SEND && m.messageId && SentMessageStore.has(m.messageId)) {
28545
+ SentMessageStore.remove(m.messageId);
28546
+ }
28547
+ });
28539
28548
  this.emit(exports.Events.MESSAGES, {
28540
- messages
28549
+ messages: filteredMessages
28541
28550
  });
28542
28551
  },
28543
28552
  pullFinished: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",