From 234040384a00664c342ed3bb94c7495b61b98a16 Mon Sep 17 00:00:00 2001 From: "Tirath.CometChat" Date: Mon, 5 Apr 2021 14:35:48 +0530 Subject: [PATCH] updated to v3 SDK --- .DS_Store | Bin 6148 -> 6148 bytes README.md | 29 ++++----- package.json | 6 +- src/.DS_Store | Bin 0 -> 6148 bytes src/components/.DS_Store | Bin 0 -> 8196 bytes .../Calls/CometChatIncomingCall/index.js | 2 +- .../Calls/CometChatOutgoingCall/index.js | 2 +- .../index.js | 2 +- .../Groups/CometChatGroupList/index.js | 14 +--- .../CometChatGroupListWithMessages/index.js | 2 +- .../Messages/CometChatMessageList/index.js | 60 +++--------------- .../CometChatUserListWithMessages/index.js | 2 +- 12 files changed, 31 insertions(+), 88 deletions(-) create mode 100644 src/.DS_Store create mode 100644 src/components/.DS_Store diff --git a/.DS_Store b/.DS_Store index 354149475288b9a1b33edf1bc3887f3dca27fede..d021e3bb1bd1f7f910d89ad213a40dda32363af2 100644 GIT binary patch delta 54 zcmZoMXffFEpOx|SB(?@&sp@K7LqiKw9R*`!gIXPhYIF0+6WGKVXHQ?P7ZNZLtD>;+{&uz Yn%cS

+ # 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 0000000000000000000000000000000000000000..16257b96806df2bd8cde7ba9c9e6b9b424787223 GIT binary patch literal 6148 zcmeHK!H&}~5FK~Bi&KQ?0cjB@UywKy)T+QDA*84*hrJ;M!2!^2(o}3vHm;hK0;MPy zz5;%LZ{Y*@9C%}!iniM;Lg10cZ*0%A<(I^ciAW5lX^*H)L=w)}2vD43+|RyY4cD>< z6lM%f1&!bpl^fZ<;crxcpIwWFr0I;tD3{OgDA&Uz*9rRh<+u;O@xvIREu3UljveP) zGS0KI>UO`2#!hp0?}C&q*}Bwv8J+4`RK?Y_9K@67Tzec>r-_T7Xq_+PIC+|lX2``Ubdv)8+Kr=$A)?xLgS2M67b zy4}CKSOjwadhfx}$=SR2^AC%UpUr|u;1xD@+2Jqvg5X?<-b9lk*TpOJGgndu`BHoU zZ|N4jrgBZfugLjb!hj~oEg||8(U9X+hS*>{(mEcr&}r?pH}y?F(^0$zdb3b+kV zUfiDId%OZ(f&Wwi-X9d4F?3j4G+PG>a|Hl4(QFJc|1L5|ISd`v7SRI}mI|~~;jS3M z($TJ5Ug)s4Xz3)}9^Z(KI`~ND**SrE= zfqzN?(L9U}2UwCjTQ?TRXRU&tz}Yyjwz#AqFh?h_0Wfq}TSN=Y{|Fcv LeBl-NqYC^41rUit literal 0 HcmV?d00001 diff --git a/src/components/.DS_Store b/src/components/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0245116389b889d6d6d2af181f1aaece33a243ff GIT binary patch literal 8196 zcmeHMPfrs;6n}$&+g4@yk3^G=#KZ(lAfT8SLM5w&dFp=?}sn%ylGv8ETV zo{jniO#A?zym|5in0WCEcrY>Xs&8hexNbFGj3GGF%=}(w-g~qAYu}r`EdY>IwKM@R z1OOU#j(P%zUo^hXdrNDRGhK)T?E$>B&58w^689mHxXz#kM?ueEdCWJJ8yK;Ip+ALXba;CmSqiT1<=O z_2HeJ(-RZt&Wst8ljHR?FTy#>yMs`+W;c72=Lnv zw-@*(bdy_I*Rh#X##wH`S2mC;zlErmxEdu&YVL2M^`ovg zgEbaU96EfYOYiRK?e6RDALt((>OVR>d@Qf`7R=(kvdhD6j@isj*;Sgeip{_My^>vT>xxC)x6dI{ovq##en`vjA;f`CFE#@m+&0D6fhuC7DTQObNbjmcfeaAKn)Sh=z%=g(Q*W}*t zMlvqtp2SYsidnRr^2qFG{O({INoJbDsX)+SBoO%GwT6&2oh&-cp|KcF$yE(T;R0NR zEM|)uJb`EM3SPro_yC{aD`_VKmfqh#uI~|w)B#;sc zEuU^A^g6|^CI%9P($7I5()rU+I#0k71`tKvj0n7Su<#I|5i6eC!d4x-R?(p20Ug$q z*R5c0GH@WctRY_iU;6#?|Gjzf>Z%k2ih;kv0BOINy_iB*&2uN}mDkz^_BHIhalJ-> v!UP9Vjw6b49C7y#LzE3vr>ym1qoY literal 0 HcmV?d00001 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;