@cometchat/chat-uikit-angular 4.3.25 → 4.3.26

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.
@@ -1912,7 +1912,7 @@ class CometChatUIKit {
1912
1912
  if (window) {
1913
1913
  window.CometChatUiKit = {
1914
1914
  name: "@cometchat/chat-uikit-angular",
1915
- version: "4.3.25",
1915
+ version: "4.3.26",
1916
1916
  };
1917
1917
  }
1918
1918
  if (CometChatUIKitSharedSettings) {
@@ -6641,6 +6641,12 @@ class CometChatConversationsComponent {
6641
6641
  this.ref.detectChanges();
6642
6642
  });
6643
6643
  this.ccMessageRead = CometChatMessageEvents.ccMessageRead.subscribe((messageObject) => {
6644
+ let conversation = this.getConversationFromId(messageObject.getConversationId());
6645
+ if (conversation) {
6646
+ this.updateEditedMessage(conversation.getLastMessage());
6647
+ this.resetUnreadCount(conversation.getConversationId());
6648
+ return;
6649
+ }
6644
6650
  if (!this.conversationType || this.conversationType == messageObject.getReceiverType()) {
6645
6651
  CometChat.CometChatHelper.getConversationFromMessage(messageObject).then((conversation) => {
6646
6652
  if (conversation &&
@@ -6692,6 +6698,13 @@ class CometChatConversationsComponent {
6692
6698
  }
6693
6699
  return null;
6694
6700
  }
6701
+ getConversationFromId(id) {
6702
+ let index = this.conversationList.findIndex((element) => element.getConversationId() == id);
6703
+ if (index >= 0) {
6704
+ return this.conversationList[index];
6705
+ }
6706
+ return null;
6707
+ }
6695
6708
  getConversationFromGroup(group) {
6696
6709
  let index = this.conversationList.findIndex((element) => element.getConversationType() ==
6697
6710
  CometChatUIKitConstants.MessageReceiverType.group &&
@@ -6754,25 +6767,25 @@ class CometChatConversationsComponent {
6754
6767
  }
6755
6768
  }
6756
6769
  // set unread count
6757
- resetUnreadCount() {
6758
- if (this.activeConversation) {
6759
- const conversationlist = [
6760
- ...this.conversationList,
6761
- ];
6762
- //Gets the index of user which comes offline/online
6763
- const conversationKey = conversationlist.findIndex((conversationObj) => conversationObj?.getConversationId() ===
6764
- this.activeConversation?.getConversationId());
6765
- if (conversationKey > -1) {
6766
- let conversationObj = conversationlist[conversationKey];
6767
- let newConversationObj = conversationObj;
6768
- newConversationObj.setUnreadMessageCount(0);
6769
- //newConversationObj.setUnreadMentionInMessageCount(0);
6770
- newConversationObj.getLastMessage()?.setMuid(this.getUinx());
6771
- conversationlist.splice(conversationKey, 1, newConversationObj);
6772
- this.conversationList = [...conversationlist];
6773
- this.ref.detectChanges();
6774
- }
6775
- }
6770
+ resetUnreadCount(conversationId) {
6771
+ const targetConversationId = conversationId || this.activeConversation?.getConversationId();
6772
+ if (!targetConversationId)
6773
+ return;
6774
+ const conversationIndex = this.conversationList.findIndex((conv) => conv.getConversationId() === targetConversationId);
6775
+ if (conversationIndex < 0)
6776
+ return;
6777
+ const updatedConversation = this.conversationList[conversationIndex];
6778
+ updatedConversation.setUnreadMessageCount(0);
6779
+ const lastMessage = updatedConversation.getLastMessage();
6780
+ if (lastMessage instanceof CometChat.TextMessage) {
6781
+ lastMessage.setMuid(this.getUinx());
6782
+ }
6783
+ this.conversationList = [
6784
+ ...this.conversationList.slice(0, conversationIndex),
6785
+ updatedConversation,
6786
+ ...this.conversationList.slice(conversationIndex + 1),
6787
+ ];
6788
+ this.ref.detectChanges();
6776
6789
  }
6777
6790
  // sets property from theme to style object
6778
6791
  setThemeStyle() {
@@ -9187,8 +9200,8 @@ class CometChatMessageListComponent {
9187
9200
  !lastMessage.getDeliveredAt()) {
9188
9201
  //mark the message as delivered
9189
9202
  if (!this.disableReceipt) {
9190
- CometChat.markAsDelivered(lastMessage).then((receipt) => {
9191
- let messageKey = this.messagesList.findIndex((m) => m.getId() === Number(receipt?.getMessageId()));
9203
+ CometChat.markAsDelivered(lastMessage).then(() => {
9204
+ let messageKey = this.messagesList.findIndex((m) => m.getId() === lastMessage?.getId());
9192
9205
  if (messageKey > -1) {
9193
9206
  this.markAllMessagAsDelivered(messageKey);
9194
9207
  }
@@ -9198,8 +9211,8 @@ class CometChatMessageListComponent {
9198
9211
  if (!lastMessage?.getReadAt() && !isSentByMe) {
9199
9212
  if (!this.disableReceipt) {
9200
9213
  CometChat.markAsRead(lastMessage)
9201
- .then((receipt) => {
9202
- let messageKey = this.messagesList.findIndex((m) => m.getId() === Number(receipt?.getMessageId()));
9214
+ .then(() => {
9215
+ let messageKey = this.messagesList.findIndex((m) => m.getId() === lastMessage?.getId());
9203
9216
  if (messageKey > -1) {
9204
9217
  this.markAllMessagAsRead(messageKey);
9205
9218
  }
@@ -13728,12 +13741,6 @@ class CometChatMessageComposerComponent {
13728
13741
  ? [...this.textFormatters]
13729
13742
  : [];
13730
13743
  this.mentionedUsers = [];
13731
- this.acceptHandlers = {
13732
- "image/*": this.onImageChange.bind(this),
13733
- "video/*": this.onVideoChange.bind(this),
13734
- "audio/*": this.onAudioChange.bind(this),
13735
- "file/*": this.onFileChange.bind(this),
13736
- };
13737
13744
  this.enableStickerKeyboard = false;
13738
13745
  this.toggleMediaRecorded = false;
13739
13746
  this.showAiBotList = false;
@@ -13993,9 +14000,24 @@ class CometChatMessageComposerComponent {
13993
14000
  }
13994
14001
  };
13995
14002
  this.inputChangeHandler = (event) => {
13996
- const handler = this.acceptHandlers[this.inputElementRef.nativeElement.accept] ||
13997
- this.onFileChange.bind(this);
13998
- handler(event);
14003
+ const files = event.target.files;
14004
+ if (!files || files.length === 0)
14005
+ return;
14006
+ Array.from(files).forEach((file) => {
14007
+ const fileType = file.type;
14008
+ if (fileType.startsWith("image/")) {
14009
+ this.onImageChange(event);
14010
+ }
14011
+ else if (fileType.startsWith("video/")) {
14012
+ this.onVideoChange(event);
14013
+ }
14014
+ else if (fileType.startsWith("audio/")) {
14015
+ this.onAudioChange(event);
14016
+ }
14017
+ else {
14018
+ this.onFileChange(event);
14019
+ }
14020
+ });
13999
14021
  if (this.inputElementRef?.nativeElement && this.inputElementRef.nativeElement?.value) {
14000
14022
  this.inputElementRef.nativeElement.value = "";
14001
14023
  }