diff --git a/.DS_Store b/.DS_Store index 3541494..d021e3b 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/README.md b/README.md index 7afa4f9..d46ebf6 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@

+ # CometChat React Native UI Kit

@@ -21,9 +22,9 @@

-CometChat React Native UI Kit is a collection of custom UI Components designed to build text chat and voice/video calling features in your application. +CometChat React Native UI Kit is a collection of custom UI Components designed to build text chat and voice/video calling features in your application. -The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly. +The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly. --- @@ -39,9 +40,10 @@ Before you begin, ensure you have met the following requirements: - [React-Native](https://reactnative.dev/docs/environment-setup) -|
**Note:** Support for Expo CLI based apps.
| -|-----------------------------------------| -|If you are using Expo CLI to build a React Native app, the calling component will not work as our calling component needs native-level changes.However, you can create a React Native app using React Native CLI or use the 'expo eject' command to convert your app from an expo-managed workflow to a bare workflow.| +|
**Note:** Support for Expo CLI based apps.
| +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| If you are using Expo CLI to build a React Native app, the calling component will not work as our calling component needs native-level changes.However, you can create a React Native app using React Native CLI or use the 'expo eject' command to convert your app from an expo-managed workflow to a bare workflow. | + --- ## Installing CometChat React Native UI Kit @@ -58,7 +60,7 @@ To install React-Native UI Kit, you need to first register on CometChat Dashboar ### ii. Add the CometChat Dependency ```javascript - npm install @cometchat-pro/react-native-chat@2.2.1 --save + npm install @cometchat-pro/react-native-chat@3.0.0-beta1 --save ``` ### iii. Other required DEPENDENCIES @@ -88,7 +90,6 @@ These packages help make the ui-kit smooth and functioning [emoji-mart-native](https://www.npmjs.com/package/emoji-mart-native)

- ## 2. Configure CometChat inside your app ### i. Initialize CometChat 🌟 @@ -97,7 +98,7 @@ The `init()` method initializes the settings required for CometChat. We suggest calling the `init()` method on app startup, preferably in the `created()` method of the Application class. ```javascript -import {CometChat} from '@cometchat-pro/react-native-chat'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const appID = 'APP_ID'; const region = 'REGION'; @@ -126,7 +127,7 @@ CometChat.init(appID, appSetting).then( This method takes `UID` and `Auth Key` as input parameters and returns the User object containing all the information of the logged-in user.. ```javascript -import {CometChat} from '@cometchat-pro/react-native-chat'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const authKey = 'AUTH_KEY'; const uid = 'SUPERHERO1'; @@ -152,7 +153,7 @@ CometChat.login(uid, authKey).then( ## 3. Add UI Kit to your project - Clone this repository. -- Copy the `cometchat-pro-react-native-ui-kit` folder to your source folder. +- Copy the `react-native-chat-ui-kit` folder to your source folder. - Copy all the peer dependencies from package.json into your project's package.json and install them using `npm install`.
@@ -165,18 +166,16 @@ Usage of application in project ```javascript import React from 'react'; -import {View} from 'react-native'; -import {CometChatUI} from '../cometchat-pro-react-native-ui-kit'; +import { View } from 'react-native'; +import { CometChatUI } from '../cometchat-pro-react-native-ui-kit'; export default function CometChatUIView() { return ( - + ); } - - ``` --- diff --git a/package.json b/package.json index fd18f2a..b411ede 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cometchat-pro-react-native-ui-kit", - "version": "2.2.1-1", + "version": "3.0.0-beta1-1", "description": "Chat UI Kit for React Native App", "main": "./src/index.js", "scripts": { @@ -48,8 +48,8 @@ "prettier": "^2.1.2" }, "dependencies": { - "@cometchat-pro/react-native-calls": "1.0.8", - "@cometchat-pro/react-native-chat": "2.2.1", + "@cometchat-pro/react-native-calls": "2.0.1", + "@cometchat-pro/react-native-chat": "3.0.0-beta1", "@react-native-community/async-storage": "^1.12.1", "lodash": "^4.17.20", "react-native-autolink": "^3.0.0", diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..16257b9 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/components/.DS_Store b/src/components/.DS_Store new file mode 100644 index 0000000..0245116 Binary files /dev/null and b/src/components/.DS_Store differ diff --git a/src/components/Calls/CometChatIncomingCall/index.js b/src/components/Calls/CometChatIncomingCall/index.js index ecefdec..6576026 100644 --- a/src/components/Calls/CometChatIncomingCall/index.js +++ b/src/components/Calls/CometChatIncomingCall/index.js @@ -68,7 +68,7 @@ export default (props) => { receiverType === 'user' ? message.sender.uid : message.receiverId; if (Object.prototype.hasOwnProperty.call(message, 'readAt') === false) { - CometChat.markAsRead(message.id, receiverId, receiverType); + CometChat.markAsRead(message); } } catch (error) { logger(error); diff --git a/src/components/Calls/CometChatOutgoingCall/index.js b/src/components/Calls/CometChatOutgoingCall/index.js index 7566933..0e65eb3 100644 --- a/src/components/Calls/CometChatOutgoingCall/index.js +++ b/src/components/Calls/CometChatOutgoingCall/index.js @@ -290,7 +290,7 @@ class CometChatOutgoingCall extends React.PureComponent { const id = type === 'user' ? message.sender.uid : message.receiverId; if (Object.prototype.hasOwnProperty.call(message, 'readAt') === false) { - CometChat.markAsRead(message.id, id, type); + CometChat.markAsRead(message); } } catch (error) { logger(error); diff --git a/src/components/Chats/CometChatConversationListWithMessages/index.js b/src/components/Chats/CometChatConversationListWithMessages/index.js index 51b31d3..b3c654f 100644 --- a/src/components/Chats/CometChatConversationListWithMessages/index.js +++ b/src/components/Chats/CometChatConversationListWithMessages/index.js @@ -409,7 +409,7 @@ class CometChatConversationListWithMessages extends React.Component { Object.prototype.hasOwnProperty.call(incomingCallMessage, readAt) === false ) { - CometChat.markAsRead(incomingCallMessage.id, receiverId, receiverType); + CometChat.markAsRead(incomingCallMessage); } // updating unread count in chats list diff --git a/src/components/Groups/CometChatGroupList/index.js b/src/components/Groups/CometChatGroupList/index.js index 5f4bec4..a24ee27 100644 --- a/src/components/Groups/CometChatGroupList/index.js +++ b/src/components/Groups/CometChatGroupList/index.js @@ -460,19 +460,7 @@ class CometChatGroupList extends React.Component { markMessagesRead = (message) => { if (!(message.getReadAt() || message.getReadByMeAt())) { - if (message.getReceiverType() === CometChat.RECEIVER_TYPE.USER) { - CometChat.markAsRead( - message.getId().toString(), - message.getSender().getUid(), - message.getReceiverType(), - ); - } else { - CometChat.markAsRead( - message.getId().toString(), - message.getReceiverId(), - message.getReceiverType(), - ); - } + CometChat.markAsRead(message); } }; diff --git a/src/components/Groups/CometChatGroupListWithMessages/index.js b/src/components/Groups/CometChatGroupListWithMessages/index.js index 0d498ae..2ebdce3 100644 --- a/src/components/Groups/CometChatGroupListWithMessages/index.js +++ b/src/components/Groups/CometChatGroupListWithMessages/index.js @@ -511,7 +511,7 @@ class CometChatGroupListWithMessages extends React.Component { Object.prototype.hasOwnProperty.call(incomingCallMessage, 'readAt') === false ) { - CometChat.markAsRead(incomingCallMessage.id, receiverId, receiverType); + CometChat.markAsRead(incomingCallMessage); } const { item, type } = this.state; diff --git a/src/components/Messages/CometChatMessageList/index.js b/src/components/Messages/CometChatMessageList/index.js index 9d3e1bd..cc41884 100644 --- a/src/components/Messages/CometChatMessageList/index.js +++ b/src/components/Messages/CometChatMessageList/index.js @@ -170,23 +170,7 @@ class CometChatMessageList extends React.PureComponent { message.getSender().getUid() !== user.getUid() && !message.getReadAt() ) { - if ( - message.getReceiverType() === CometChat.RECEIVER_TYPE.USER - ) { - CometChat.markAsRead( - message.getId().toString(), - message.getSender().getUid(), - message.getReceiverType(), - ); - } else if ( - message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP - ) { - CometChat.markAsRead( - message.getId().toString(), - message.getReceiverId(), - message.getReceiverType(), - ); - } + CometChat.markAsRead(message); } this.props.actionGenerated(actions.MESSAGE_READ, message); }); @@ -417,11 +401,7 @@ class CometChatMessageList extends React.PureComponent { message.getReceiverId() === this.props.item.guid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getReceiverId(), - message.getReceiverType(), - ); + CometChat.markAsRead(message); } this.props.actionGenerated(actions.MESSAGE_RECEIVED, [message]); @@ -431,11 +411,7 @@ class CometChatMessageList extends React.PureComponent { message.getSender().uid === this.props.item.uid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getSender().uid, - message.getReceiverType(), - ); + CometChat.markAsRead(message); } this.props.actionGenerated(actions.MESSAGE_RECEIVED, [message]); @@ -458,11 +434,7 @@ class CometChatMessageList extends React.PureComponent { message.getReceiverId() === this.props.item.guid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getReceiverId(), - message.getReceiverType(), - ); + CometChat.markAsRead(message); } if (Object.prototype.hasOwnProperty.call(message, 'metadata')) { @@ -487,11 +459,7 @@ class CometChatMessageList extends React.PureComponent { message.getSender().uid === this.props.item.uid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getSender().uid, - message.getReceiverType(), - ); + CometChat.markAsRead(message); } if (Object.prototype.hasOwnProperty.call(message, 'metadata')) { @@ -560,11 +528,7 @@ class CometChatMessageList extends React.PureComponent { message.getReceiverId() === this.props.item.guid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getReceiverId(), - message.getReceiverType(), - ); + CometChat.markAsRead(message); } this.props.actionGenerated(actions.CALL_UPDATED, message); @@ -574,11 +538,7 @@ class CometChatMessageList extends React.PureComponent { message.getSender().uid === this.props.item.uid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getSender().uid, - message.getReceiverType(), - ); + CometChat.markAsRead(message); } this.props.actionGenerated(actions.CALL_UPDATED, message); @@ -604,11 +564,7 @@ class CometChatMessageList extends React.PureComponent { message.getReceiver().guid === this.props.item.guid ) { if (!message.getReadAt()) { - CometChat.markAsRead( - message.getId().toString(), - message.getReceiverId(), - message.getReceiverType(), - ); + CometChat.markAsRead(message); } this.props.actionGenerated( diff --git a/src/components/Users/CometChatUserListWithMessages/index.js b/src/components/Users/CometChatUserListWithMessages/index.js index 0bda363..59cab9e 100644 --- a/src/components/Users/CometChatUserListWithMessages/index.js +++ b/src/components/Users/CometChatUserListWithMessages/index.js @@ -290,7 +290,7 @@ class CometChatUserListWithMessages extends React.Component { Object.prototype.hasOwnProperty.call(incomingCallMessage, 'readAt') === false ) { - CometChat.markAsRead(incomingCallMessage.id, receiverId, receiverType); + CometChat.markAsRead(incomingCallMessage); } const { item, type } = this.state;