@onyx-p/imlib-web 1.7.7 → 1.7.8

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 +40 -35
  2. package/index.umd.js +40 -35
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -20457,17 +20457,17 @@ class MessageReceiptManager {
20457
20457
  return acc;
20458
20458
  }, {})).map(([conversationId, messageIds]) => ({
20459
20459
  destId: Long.fromString(conversationId),
20460
- msgIds: messageIds
20460
+ msgId: messageIds.map(id => Long.fromString(id))
20461
20461
  }));
20462
20462
  const groupReceiptMessages = groupMessages.reduce((acc, msg) => {
20463
20463
  const existingGroup = acc.find(g => g.groupId.equals(Long.fromString(msg.targetId)) && g.userId.equals(Long.fromString(msg.senderUserId)));
20464
20464
  if (existingGroup) {
20465
- existingGroup.msgIds.push(msg.messageUId);
20465
+ existingGroup.msgId.push(Long.fromString(msg.messageUId));
20466
20466
  } else {
20467
20467
  acc.push({
20468
20468
  groupId: Long.fromString(msg.targetId),
20469
20469
  userId: Long.fromString(msg.senderUserId),
20470
- msgIds: [msg.messageUId]
20470
+ msgId: [Long.fromString(msg.messageUId)]
20471
20471
  });
20472
20472
  }
20473
20473
  return acc;
@@ -20671,11 +20671,11 @@ class MessageLoader {
20671
20671
  this.watcher.onRecall?.(recallMessageUIds);
20672
20672
  }
20673
20673
  });
20674
- if (messages.length) {
20675
- let normalMessages = this.handleReceiptMessages(messages);
20674
+ let normalMessages = this.handleReceiptMessages(messages);
20675
+ if (normalMessages.length) {
20676
20676
  this.watcher.batchMessage?.(normalMessages);
20677
+ MessageReceiptManager$1.get()?.sendArrivalReceipts(normalMessages);
20677
20678
  }
20678
- MessageReceiptManager$1.get()?.sendArrivalReceipts(messages);
20679
20679
  if (done) {
20680
20680
  if (seqno.ge(this.serverMsgSeqno)) {
20681
20681
  this.serverMsgSeqno = seqno;
@@ -20695,37 +20695,42 @@ class MessageLoader {
20695
20695
  });
20696
20696
  }
20697
20697
  handleReceiptMessages(messages) {
20698
- const normalMessages = [];
20699
- const receiptnotificationMessages = [];
20700
- messages.forEach(msg => {
20701
- if (msg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.GROUP_READ_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_READ_RECEIPT) {
20702
- receiptnotificationMessages.push(msg);
20703
- } else {
20704
- normalMessages.push(msg);
20705
- }
20706
- });
20707
- const sentMessages = normalMessages.filter(m => m.messageDirection === MessageDirection.SEND);
20708
- receiptnotificationMessages.forEach(notiMsg => {
20709
- const notiContent = notiMsg.content;
20710
- const isArrivalReceipt = notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT;
20711
- sentMessages.forEach(msg => {
20712
- if (notiContent.msgIdList.includes(msg.messageUId)) {
20713
- if (isArrivalReceipt) {
20714
- msg.receivedStatus = ReceivedStatus.RECEIVED;
20715
- } else {
20716
- msg.receivedStatus = ReceivedStatus.READ;
20717
- }
20698
+ try {
20699
+ const normalMessages = [];
20700
+ const receiptnotificationMessages = [];
20701
+ messages.forEach(msg => {
20702
+ if (msg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.GROUP_READ_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_READ_RECEIPT) {
20703
+ receiptnotificationMessages.push(msg);
20704
+ } else {
20705
+ normalMessages.push(msg);
20718
20706
  }
20719
20707
  });
20720
- this.watcher.onReceiptReceived?.({
20721
- conversation: {
20722
- conversationType: notiMsg.conversationType,
20723
- targetId: notiMsg.targetId
20724
- },
20725
- messageUIdList: notiContent.msgIdList
20726
- }, notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT ? 0 : 1);
20727
- });
20728
- return normalMessages;
20708
+ const sentMessages = normalMessages.filter(m => m.messageDirection === MessageDirection.SEND);
20709
+ receiptnotificationMessages.forEach(notiMsg => {
20710
+ const notiContent = notiMsg.content;
20711
+ const isArrivalReceipt = notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT;
20712
+ sentMessages.forEach(msg => {
20713
+ if (notiContent.msgIdList.includes(msg.messageUId)) {
20714
+ if (isArrivalReceipt) {
20715
+ msg.receivedStatus = ReceivedStatus.RECEIVED;
20716
+ } else {
20717
+ msg.receivedStatus = ReceivedStatus.READ;
20718
+ }
20719
+ }
20720
+ });
20721
+ this.watcher.onReceiptReceived?.({
20722
+ conversation: {
20723
+ conversationType: notiMsg.conversationType,
20724
+ targetId: notiMsg.targetId
20725
+ },
20726
+ messageUIdList: notiContent.msgIdList
20727
+ }, notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT ? 0 : 1);
20728
+ });
20729
+ return normalMessages;
20730
+ } catch (error) {
20731
+ logger.error('handleReceiptMessages error', error);
20732
+ return [];
20733
+ }
20729
20734
  }
20730
20735
  isExistPersistedMessage(messageList) {
20731
20736
  return messageList.some(m => m.isPersited);
package/index.umd.js CHANGED
@@ -20463,17 +20463,17 @@
20463
20463
  return acc;
20464
20464
  }, {})).map(([conversationId, messageIds]) => ({
20465
20465
  destId: Long.fromString(conversationId),
20466
- msgIds: messageIds
20466
+ msgId: messageIds.map(id => Long.fromString(id))
20467
20467
  }));
20468
20468
  const groupReceiptMessages = groupMessages.reduce((acc, msg) => {
20469
20469
  const existingGroup = acc.find(g => g.groupId.equals(Long.fromString(msg.targetId)) && g.userId.equals(Long.fromString(msg.senderUserId)));
20470
20470
  if (existingGroup) {
20471
- existingGroup.msgIds.push(msg.messageUId);
20471
+ existingGroup.msgId.push(Long.fromString(msg.messageUId));
20472
20472
  } else {
20473
20473
  acc.push({
20474
20474
  groupId: Long.fromString(msg.targetId),
20475
20475
  userId: Long.fromString(msg.senderUserId),
20476
- msgIds: [msg.messageUId]
20476
+ msgId: [Long.fromString(msg.messageUId)]
20477
20477
  });
20478
20478
  }
20479
20479
  return acc;
@@ -20677,11 +20677,11 @@
20677
20677
  this.watcher.onRecall?.(recallMessageUIds);
20678
20678
  }
20679
20679
  });
20680
- if (messages.length) {
20681
- let normalMessages = this.handleReceiptMessages(messages);
20680
+ let normalMessages = this.handleReceiptMessages(messages);
20681
+ if (normalMessages.length) {
20682
20682
  this.watcher.batchMessage?.(normalMessages);
20683
+ MessageReceiptManager$1.get()?.sendArrivalReceipts(normalMessages);
20683
20684
  }
20684
- MessageReceiptManager$1.get()?.sendArrivalReceipts(messages);
20685
20685
  if (done) {
20686
20686
  if (seqno.ge(this.serverMsgSeqno)) {
20687
20687
  this.serverMsgSeqno = seqno;
@@ -20701,37 +20701,42 @@
20701
20701
  });
20702
20702
  }
20703
20703
  handleReceiptMessages(messages) {
20704
- const normalMessages = [];
20705
- const receiptnotificationMessages = [];
20706
- messages.forEach(msg => {
20707
- if (msg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.GROUP_READ_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_READ_RECEIPT) {
20708
- receiptnotificationMessages.push(msg);
20709
- } else {
20710
- normalMessages.push(msg);
20711
- }
20712
- });
20713
- const sentMessages = normalMessages.filter(m => m.messageDirection === exports.MessageDirection.SEND);
20714
- receiptnotificationMessages.forEach(notiMsg => {
20715
- const notiContent = notiMsg.content;
20716
- const isArrivalReceipt = notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT;
20717
- sentMessages.forEach(msg => {
20718
- if (notiContent.msgIdList.includes(msg.messageUId)) {
20719
- if (isArrivalReceipt) {
20720
- msg.receivedStatus = exports.ReceivedStatus.RECEIVED;
20721
- } else {
20722
- msg.receivedStatus = exports.ReceivedStatus.READ;
20723
- }
20704
+ try {
20705
+ const normalMessages = [];
20706
+ const receiptnotificationMessages = [];
20707
+ messages.forEach(msg => {
20708
+ if (msg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.GROUP_READ_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT || msg.messageType === NotiMessageTypes.PRIVATE_READ_RECEIPT) {
20709
+ receiptnotificationMessages.push(msg);
20710
+ } else {
20711
+ normalMessages.push(msg);
20724
20712
  }
20725
20713
  });
20726
- this.watcher.onReceiptReceived?.({
20727
- conversation: {
20728
- conversationType: notiMsg.conversationType,
20729
- targetId: notiMsg.targetId
20730
- },
20731
- messageUIdList: notiContent.msgIdList
20732
- }, notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT ? 0 : 1);
20733
- });
20734
- return normalMessages;
20714
+ const sentMessages = normalMessages.filter(m => m.messageDirection === exports.MessageDirection.SEND);
20715
+ receiptnotificationMessages.forEach(notiMsg => {
20716
+ const notiContent = notiMsg.content;
20717
+ const isArrivalReceipt = notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT;
20718
+ sentMessages.forEach(msg => {
20719
+ if (notiContent.msgIdList.includes(msg.messageUId)) {
20720
+ if (isArrivalReceipt) {
20721
+ msg.receivedStatus = exports.ReceivedStatus.RECEIVED;
20722
+ } else {
20723
+ msg.receivedStatus = exports.ReceivedStatus.READ;
20724
+ }
20725
+ }
20726
+ });
20727
+ this.watcher.onReceiptReceived?.({
20728
+ conversation: {
20729
+ conversationType: notiMsg.conversationType,
20730
+ targetId: notiMsg.targetId
20731
+ },
20732
+ messageUIdList: notiContent.msgIdList
20733
+ }, notiMsg.messageType === NotiMessageTypes.GROUP_ARRIVAL_RECEIPT || notiMsg.messageType === NotiMessageTypes.PRIVATE_ARRIVAL_RECEIPT ? 0 : 1);
20734
+ });
20735
+ return normalMessages;
20736
+ } catch (error) {
20737
+ logger.error('handleReceiptMessages error', error);
20738
+ return [];
20739
+ }
20735
20740
  }
20736
20741
  isExistPersistedMessage(messageList) {
20737
20742
  return messageList.some(m => m.isPersited);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",