Skip to content

Commit fb76d16

Browse files
committed
Updated UIKit version to 4.3.26
1 parent fa6e50a commit fb76d16

File tree

11 files changed

+174
-111
lines changed

11 files changed

+174
-111
lines changed

CometChatConversations/cometchat-conversations/cometchat-conversations.component.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,13 @@ export declare class CometChatConversationsComponent implements OnInit, OnChange
229229
subscribeToEvents(): void;
230230
unsubscribeToEvents(): void;
231231
getConversationFromUser(user: CometChat.User): import("@cometchat/chat-sdk-javascript").Conversation | null;
232+
getConversationFromId(id: string): import("@cometchat/chat-sdk-javascript").Conversation | null;
232233
getConversationFromGroup(group: CometChat.Group): CometChat.Conversation | null;
233234
ngOnChanges(change: SimpleChanges): void;
234235
ngOnDestroy(): void;
235236
setConversationOptions(): void;
236237
onClick(conversation: CometChat.Conversation): void;
237-
resetUnreadCount(): void;
238+
resetUnreadCount(conversationId?: string): void;
238239
setThemeStyle(): void;
239240
setListItemStyle(): void;
240241
setAvatarStyle(): void;

CometChatMessageComposer/cometchat-message-composer/cometchat-message-composer.component.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export declare class CometChatMessageComposerComponent implements OnInit, OnChan
114114
textFormatterList: Array<CometChatTextFormatter>;
115115
mentionsTextFormatterInstance: CometChatMentionsFormatter;
116116
mentionedUsers: Array<CometChat.User | CometChat.GroupMember>;
117-
acceptHandlers: any;
118117
enableStickerKeyboard: boolean;
119118
toggleMediaRecorded: boolean;
120119
showAiBotList: boolean;

esm2020/CometChatConversations/cometchat-conversations/cometchat-conversations.component.mjs

Lines changed: 32 additions & 19 deletions
Large diffs are not rendered by default.

esm2020/CometChatMessageComposer/cometchat-message-composer/cometchat-message-composer.component.mjs

Lines changed: 19 additions & 10 deletions
Large diffs are not rendered by default.

esm2020/CometChatMessageList/cometchat-message-list/cometchat-message-list.component.mjs

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

esm2020/Shared/CometChatUIkit/CometChatUIKit.mjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

fesm2015/cometchat-chat-uikit-angular.mjs

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ class CometChatUIKit {
19431943
if (window) {
19441944
window.CometChatUiKit = {
19451945
name: "@cometchat/chat-uikit-angular",
1946-
version: "4.3.25",
1946+
version: "4.3.26",
19471947
};
19481948
}
19491949
if (CometChatUIKitSharedSettings) {
@@ -6692,6 +6692,12 @@ class CometChatConversationsComponent {
66926692
this.ref.detectChanges();
66936693
});
66946694
this.ccMessageRead = CometChatMessageEvents.ccMessageRead.subscribe((messageObject) => {
6695+
let conversation = this.getConversationFromId(messageObject.getConversationId());
6696+
if (conversation) {
6697+
this.updateEditedMessage(conversation.getLastMessage());
6698+
this.resetUnreadCount(conversation.getConversationId());
6699+
return;
6700+
}
66956701
if (!this.conversationType || this.conversationType == messageObject.getReceiverType()) {
66966702
CometChat.CometChatHelper.getConversationFromMessage(messageObject).then((conversation) => {
66976703
var _a;
@@ -6745,6 +6751,13 @@ class CometChatConversationsComponent {
67456751
}
67466752
return null;
67476753
}
6754+
getConversationFromId(id) {
6755+
let index = this.conversationList.findIndex((element) => element.getConversationId() == id);
6756+
if (index >= 0) {
6757+
return this.conversationList[index];
6758+
}
6759+
return null;
6760+
}
67486761
getConversationFromGroup(group) {
67496762
let index = this.conversationList.findIndex((element) => element.getConversationType() ==
67506763
CometChatUIKitConstants.MessageReceiverType.group &&
@@ -6807,29 +6820,26 @@ class CometChatConversationsComponent {
68076820
}
68086821
}
68096822
// set unread count
6810-
resetUnreadCount() {
6823+
resetUnreadCount(conversationId) {
68116824
var _a;
6812-
if (this.activeConversation) {
6813-
const conversationlist = [
6814-
...this.conversationList,
6815-
];
6816-
//Gets the index of user which comes offline/online
6817-
const conversationKey = conversationlist.findIndex((conversationObj) => {
6818-
var _a;
6819-
return (conversationObj === null || conversationObj === void 0 ? void 0 : conversationObj.getConversationId()) ===
6820-
((_a = this.activeConversation) === null || _a === void 0 ? void 0 : _a.getConversationId());
6821-
});
6822-
if (conversationKey > -1) {
6823-
let conversationObj = conversationlist[conversationKey];
6824-
let newConversationObj = conversationObj;
6825-
newConversationObj.setUnreadMessageCount(0);
6826-
//newConversationObj.setUnreadMentionInMessageCount(0);
6827-
(_a = newConversationObj.getLastMessage()) === null || _a === void 0 ? void 0 : _a.setMuid(this.getUinx());
6828-
conversationlist.splice(conversationKey, 1, newConversationObj);
6829-
this.conversationList = [...conversationlist];
6830-
this.ref.detectChanges();
6831-
}
6832-
}
6825+
const targetConversationId = conversationId || ((_a = this.activeConversation) === null || _a === void 0 ? void 0 : _a.getConversationId());
6826+
if (!targetConversationId)
6827+
return;
6828+
const conversationIndex = this.conversationList.findIndex((conv) => conv.getConversationId() === targetConversationId);
6829+
if (conversationIndex < 0)
6830+
return;
6831+
const updatedConversation = this.conversationList[conversationIndex];
6832+
updatedConversation.setUnreadMessageCount(0);
6833+
const lastMessage = updatedConversation.getLastMessage();
6834+
if (lastMessage instanceof CometChat.TextMessage) {
6835+
lastMessage.setMuid(this.getUinx());
6836+
}
6837+
this.conversationList = [
6838+
...this.conversationList.slice(0, conversationIndex),
6839+
updatedConversation,
6840+
...this.conversationList.slice(conversationIndex + 1),
6841+
];
6842+
this.ref.detectChanges();
68336843
}
68346844
// sets property from theme to style object
68356845
setThemeStyle() {
@@ -9257,8 +9267,8 @@ class CometChatMessageListComponent {
92579267
!lastMessage.getDeliveredAt()) {
92589268
//mark the message as delivered
92599269
if (!this.disableReceipt) {
9260-
CometChat.markAsDelivered(lastMessage).then((receipt) => {
9261-
let messageKey = this.messagesList.findIndex((m) => m.getId() === Number(receipt === null || receipt === void 0 ? void 0 : receipt.getMessageId()));
9270+
CometChat.markAsDelivered(lastMessage).then(() => {
9271+
let messageKey = this.messagesList.findIndex((m) => m.getId() === (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.getId()));
92629272
if (messageKey > -1) {
92639273
this.markAllMessagAsDelivered(messageKey);
92649274
}
@@ -9268,8 +9278,8 @@ class CometChatMessageListComponent {
92689278
if (!(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.getReadAt()) && !isSentByMe) {
92699279
if (!this.disableReceipt) {
92709280
CometChat.markAsRead(lastMessage)
9271-
.then((receipt) => {
9272-
let messageKey = this.messagesList.findIndex((m) => m.getId() === Number(receipt === null || receipt === void 0 ? void 0 : receipt.getMessageId()));
9281+
.then(() => {
9282+
let messageKey = this.messagesList.findIndex((m) => m.getId() === (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.getId()));
92739283
if (messageKey > -1) {
92749284
this.markAllMessagAsRead(messageKey);
92759285
}
@@ -13797,12 +13807,6 @@ class CometChatMessageComposerComponent {
1379713807
? [...this.textFormatters]
1379813808
: [];
1379913809
this.mentionedUsers = [];
13800-
this.acceptHandlers = {
13801-
"image/*": this.onImageChange.bind(this),
13802-
"video/*": this.onVideoChange.bind(this),
13803-
"audio/*": this.onAudioChange.bind(this),
13804-
"file/*": this.onFileChange.bind(this),
13805-
};
1380613810
this.enableStickerKeyboard = false;
1380713811
this.toggleMediaRecorded = false;
1380813812
this.showAiBotList = false;
@@ -14066,9 +14070,24 @@ class CometChatMessageComposerComponent {
1406614070
};
1406714071
this.inputChangeHandler = (event) => {
1406814072
var _a, _b;
14069-
const handler = this.acceptHandlers[this.inputElementRef.nativeElement.accept] ||
14070-
this.onFileChange.bind(this);
14071-
handler(event);
14073+
const files = event.target.files;
14074+
if (!files || files.length === 0)
14075+
return;
14076+
Array.from(files).forEach((file) => {
14077+
const fileType = file.type;
14078+
if (fileType.startsWith("image/")) {
14079+
this.onImageChange(event);
14080+
}
14081+
else if (fileType.startsWith("video/")) {
14082+
this.onVideoChange(event);
14083+
}
14084+
else if (fileType.startsWith("audio/")) {
14085+
this.onAudioChange(event);
14086+
}
14087+
else {
14088+
this.onFileChange(event);
14089+
}
14090+
});
1407214091
if (((_a = this.inputElementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) && ((_b = this.inputElementRef.nativeElement) === null || _b === void 0 ? void 0 : _b.value)) {
1407314092
this.inputElementRef.nativeElement.value = "";
1407414093
}

fesm2015/cometchat-chat-uikit-angular.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fesm2020/cometchat-chat-uikit-angular.mjs

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,7 @@ class CometChatUIKit {
19121912
if (window) {
19131913
window.CometChatUiKit = {
19141914
name: "@cometchat/chat-uikit-angular",
1915-
version: "4.3.25",
1915+
version: "4.3.26",
19161916
};
19171917
}
19181918
if (CometChatUIKitSharedSettings) {
@@ -6641,6 +6641,12 @@ class CometChatConversationsComponent {
66416641
this.ref.detectChanges();
66426642
});
66436643
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+
}
66446650
if (!this.conversationType || this.conversationType == messageObject.getReceiverType()) {
66456651
CometChat.CometChatHelper.getConversationFromMessage(messageObject).then((conversation) => {
66466652
if (conversation &&
@@ -6692,6 +6698,13 @@ class CometChatConversationsComponent {
66926698
}
66936699
return null;
66946700
}
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+
}
66956708
getConversationFromGroup(group) {
66966709
let index = this.conversationList.findIndex((element) => element.getConversationType() ==
66976710
CometChatUIKitConstants.MessageReceiverType.group &&
@@ -6754,25 +6767,25 @@ class CometChatConversationsComponent {
67546767
}
67556768
}
67566769
// 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();
67766789
}
67776790
// sets property from theme to style object
67786791
setThemeStyle() {
@@ -9187,8 +9200,8 @@ class CometChatMessageListComponent {
91879200
!lastMessage.getDeliveredAt()) {
91889201
//mark the message as delivered
91899202
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());
91929205
if (messageKey > -1) {
91939206
this.markAllMessagAsDelivered(messageKey);
91949207
}
@@ -9198,8 +9211,8 @@ class CometChatMessageListComponent {
91989211
if (!lastMessage?.getReadAt() && !isSentByMe) {
91999212
if (!this.disableReceipt) {
92009213
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());
92039216
if (messageKey > -1) {
92049217
this.markAllMessagAsRead(messageKey);
92059218
}
@@ -13728,12 +13741,6 @@ class CometChatMessageComposerComponent {
1372813741
? [...this.textFormatters]
1372913742
: [];
1373013743
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-
};
1373713744
this.enableStickerKeyboard = false;
1373813745
this.toggleMediaRecorded = false;
1373913746
this.showAiBotList = false;
@@ -13993,9 +14000,24 @@ class CometChatMessageComposerComponent {
1399314000
}
1399414001
};
1399514002
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+
});
1399914021
if (this.inputElementRef?.nativeElement && this.inputElementRef.nativeElement?.value) {
1400014022
this.inputElementRef.nativeElement.value = "";
1400114023
}

fesm2020/cometchat-chat-uikit-angular.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cometchat/chat-uikit-angular",
3-
"version": "4.3.25",
3+
"version": "4.3.26",
44
"license": "https://www.cometchat.com/legal-terms-of-service",
55
"homepage": "https://www.cometchat.com",
66
"repository": "https://github.com/cometchat/cometchat-uikit-angular",
@@ -24,7 +24,7 @@
2424
],
2525
"description": "Ready-to-use Chat UI Components for Angular (JavaScript/Web)",
2626
"peerDependencies": {
27-
"@cometchat/chat-sdk-javascript": "^4.0.10",
27+
"@cometchat/chat-sdk-javascript": "^4.0.11",
2828
"@cometchat/uikit-elements": "~4.3.23",
2929
"@cometchat/uikit-resources": "~4.3.18",
3030
"@cometchat/uikit-shared": "~4.3.24"

0 commit comments

Comments
 (0)