Skip to content

Commit

Permalink
v4.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitninawe-cometchat committed Jun 4, 2024
1 parent ad3a166 commit 55b03b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

[![Platform](https://img.shields.io/badge/Platform-ReactNative-brightgreen.svg)](#)
[![Platform](https://img.shields.io/badge/Language-TypeScript-yellowgreen.svg)](#)
![Version](https://shields.io/badge/version-v4.1.1-orange)
![Version](https://shields.io/badge/version-v4.1.2-orange)
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)

## Table of contents
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cometchat/chat-uikit-react-native",
"version": "4.1.1",
"version": "4.1.2",
"description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
"main": "src/index",
"module": "src/index",
Expand Down
12 changes: 6 additions & 6 deletions src/CometChatMessageList/CometChatMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,19 @@ export const CometChatMessageList = forwardRef<
.fetchNext()
.then(newMessages => {
let cleanUpdatedList = [...updatedList];
for (let i = 0; i < cleanUpdatedList.length; i++) {
for (let i = (cleanUpdatedList.length - 1); i >= 0; i--) {
if (cleanUpdatedList[i].id == lastID.current) break;
if (cleanUpdatedList[i].id == undefined)
if (cleanUpdatedList[i].id == undefined || Number.isNaN(parseInt(cleanUpdatedList[i].id)))
cleanUpdatedList.splice(i, 1);
}
// console.log("newMessages", newMessages.length, JSON.stringify(newMessages))
if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[0]?.["muid"]) {
let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[0]?.["muid"]);
if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]) {
let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]);
if (localFileExists > -1) {
cleanUpdatedList.shift();
}
}
let tmpList = [...newMessages.reverse(), ...cleanUpdatedList];
let tmpList = [...cleanUpdatedList, ...newMessages.reverse()];
tmpList = tmpList.map((item: CometChat.BaseMessage, index) => {
if (item.getCategory() === MessageCategoryConstants.interactive) {
return InteractiveMessageUtils.convertInteractiveMessage(item);
Expand Down Expand Up @@ -570,7 +570,7 @@ export const CometChatMessageList = forwardRef<
const deleteMessage = (message: CometChat.BaseMessage) => {
CometChat.deleteMessage(message.getId().toString())
.then(res => {
messageEdited(res, false);
CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageDeleted, { message: res });
setShowMessageOptions([]);
})
.catch(rej => {
Expand Down
3 changes: 3 additions & 0 deletions src/shared/utils/conversationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export class CometChatConversationUtils {
} else if (lastMessage.getCategory() == CometChat.CATEGORY_CUSTOM as CometChat.MessageCategory) {
msgText = lastMessage.getType();
} else if (lastMessage.getCategory() == CometChat.CATEGORY_ACTION as CometChat.MessageCategory) {
if ((lastMessage as CometChat.Action)?.getAction() === CometChat.ACTION_TYPE.MESSSAGE_DELETED) {
return localize("THIS_MESSAGE_DELETED");
}
msgText = (lastMessage as CometChat.Action).getMessage();
} else if (lastMessage.getCategory() === CometChat.CATEGORY_INTERACTIVE) {
msgText = lastMessage.getType() === "form" ? `${localize('FORM')} 📋` : `${localize('CARD')} 🪧`;
Expand Down

0 comments on commit 55b03b5

Please sign in to comment.