diff --git a/CometChatWorkspace/cometchat-app/App.js b/CometChatWorkspace/cometchat-app/App.js index 46d2377..33b91d6 100644 --- a/CometChatWorkspace/cometchat-app/App.js +++ b/CometChatWorkspace/cometchat-app/App.js @@ -13,34 +13,34 @@ import { Platform, } from 'react-native'; import {PersistGate} from 'redux-persist/integration/react'; -import theme from './react-native-chat-ui-kit/src/resources/theme'; - - const styles = StyleSheet.create({ - defaultFontFamily: { - fontFamily: theme.fontFamily, - }, - }); +import theme from './cometchat-pro-react-native-ui-kit/src/resources/theme'; + +const styles = StyleSheet.create({ + defaultFontFamily: { + fontFamily: theme.fontFamily, + }, +}); const customProps = {style: styles.defaultFontFamily}; // To set default font family, avoiding issues with specific android fonts like OnePlus Slate function setDefaultFontFamily() { - const TextRender = Text.render; - const initialDefaultProps = Text.defaultProps; - Text.defaultProps = { - ...initialDefaultProps, - ...customProps, - }; - Text.render = function render(props) { - let oldProps = props; - props = {...props, style: [customProps.style, props.style]}; - try { - return TextRender.apply(this, arguments); - } finally { - props = oldProps; - } - }; - } + const TextRender = Text.render; + const initialDefaultProps = Text.defaultProps; + Text.defaultProps = { + ...initialDefaultProps, + ...customProps, + }; + Text.render = function render(props) { + let oldProps = props; + props = {...props, style: [customProps.style, props.style]}; + try { + return TextRender.apply(this, arguments); + } finally { + props = oldProps; + } + }; +} const App = () => { LogBox.ignoreAllLogs(); @@ -50,7 +50,7 @@ const App = () => { .build(); useEffect(() => { - console.log("init***") + console.log('init***'); CometChat.init(COMETCHAT_CONSTANTS.APP_ID, appSetting).catch(() => { return null; }); diff --git a/CometChatWorkspace/cometchat-app/CONSTS.js b/CometChatWorkspace/cometchat-app/CONSTS.js index 52e11fa..c0a0bad 100644 --- a/CometChatWorkspace/cometchat-app/CONSTS.js +++ b/CometChatWorkspace/cometchat-app/CONSTS.js @@ -1,5 +1,5 @@ export const COMETCHAT_CONSTANTS = { - APP_ID: "APP_ID", - REGION: "REGION", - AUTH_KEY: "AUTH_KEY", + APP_ID: 'APP_ID', + REGION: 'REGION', + AUTH_KEY: 'AUTH_KEY', }; diff --git a/CometChatWorkspace/cometchat-app/StackNavigator.js b/CometChatWorkspace/cometchat-app/StackNavigator.js index 802dac1..18af8d3 100644 --- a/CometChatWorkspace/cometchat-app/StackNavigator.js +++ b/CometChatWorkspace/cometchat-app/StackNavigator.js @@ -15,7 +15,7 @@ import { CometChatGroupList, CometChatConversationListWithMessages, CometChatConversationList, -} from './react-native-chat-ui-kit'; +} from './cometchat-pro-react-native-ui-kit'; function StackNavigator(props) { const Stack = createStackNavigator(); diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/.eslintrc.json b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/.eslintrc.json similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/.eslintrc.json rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/.eslintrc.json diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/.npmignore b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/.npmignore similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/.npmignore rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/.npmignore diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/.prettierrc.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/.prettierrc.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/.prettierrc.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/.prettierrc.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/README.md b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/README.md similarity index 91% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/README.md rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/README.md index 2ba5386..73a5f68 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/README.md +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/README.md @@ -41,10 +41,10 @@ Before you begin, ensure you have met the following requirements: + |
**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 @@ -61,7 +61,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.0 --save + npm install @cometchat-pro/react-native-chat@2.2.1 --save ``` ### iii. Other required DEPENDENCIES @@ -85,8 +85,13 @@ These packages help make the ui-kit smooth and functioning [@react-native-picker/picker](https://github.com/react-native-picker/picker)
[react-native-async-storage/async-storage](https://github.com/react-native-async-storage/async-storage)
[@cometchat-pro/react-native-calls](https://www.npmjs.com/package/@cometchat-pro/react-native-calls)
+[rn-fetch-blob](https://www.npmjs.com/package/rn-fetch-blob)
+[react-native-autolink](https://www.npmjs.com/package/react-native-autolink)
+[react-native-screens](https://www.npmjs.com/package/react-native-screens)
+[emoji-mart-native](https://www.npmjs.com/package/emoji-mart-native)

+ ## 2. Configure CometChat inside your app ### i. Initialize CometChat 🌟 @@ -161,28 +166,20 @@ CometChat.login(uid, authKey).then( Usage of application in project -```html -import {CometChatUI} from './react-native-chat-ui-kit'; - -function StackNavigator(props) { - const Stack = createStackNavigator(); +```javascript +import React from 'react'; +import {View} from 'react-native'; +import {CometChatUI} from '../cometchat-pro-react-native-ui-kit'; +export default function CometChatUIView() { return ( - - - - - - - + + + ); } + ``` --- diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/package-lock.json b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/package-lock.json similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/package-lock.json rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/package-lock.json diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/package.json b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/package.json similarity index 74% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/package.json rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/package.json index 0c2453e..fd18f2a 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/package.json +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/package.json @@ -1,34 +1,18 @@ { "name": "cometchat-pro-react-native-ui-kit", - "version": "2.2.0", + "version": "2.2.1-1", "description": "Chat UI Kit for React Native App", "main": "./src/index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "lint": "eslint 'src/**/*.{js,jsx}' --quiet --fix" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{js,jsx}": [ - "npm run lint", - "git add --all" - ], - "*.json": [ - "git add --all" - ] - }, "repository": { "type": "git", "url": "git@git.geekyants.com:cometchat/react-native.git" }, "peerDependencies": { "@react-native-community/async-storage": "^1.12.1", - "@react-native-async-storage/async-storage": "^1.13.4", - "@react-native-picker/picker": "^1.9.4", "react-native-sound": "^0.11.0", "react-native-vector-icons": "^7.1.0", "react-native-elements": "^3.0.0-alpha.1", @@ -38,20 +22,13 @@ "react-native": "^0.63.3", "react-native-gesture-handler": "^1.9.0", "react-native-reanimated": "^1.13.2", - "react-native-screens": "^2.16.1", "reanimated-bottom-sheet": "^1.0.0-alpha.22", "react-native-video": "^5.1.0-alpha8", "react": "^16.0.1", "@react-navigation/bottom-tabs": "^5.11.2", "@react-navigation/native": "^5.8.10", "@react-navigation/stack": "^5.12.8", - "react-native-video-controls": "^2.7.1", - "rn-fetch-blob": "^0.12.0", - "lodash": "^4.17.20", - "react-native-autolink": "^3.0.0", - "@cometchat-pro/react-native-calls": "1.0.7", - "@cometchat-pro/react-native-chat": "2.2.0", - "emoji-mart-native": "^0.6.2-beta" + "react-native-video-controls": "^2.7.1" }, "author": "Inscripts", "license": "ISC", @@ -70,5 +47,14 @@ "metro-react-native-babel-preset": "^0.63.0", "prettier": "^2.1.2" }, - "dependencies": {} + "dependencies": { + "@cometchat-pro/react-native-calls": "1.0.8", + "@cometchat-pro/react-native-chat": "2.2.1", + "@react-native-community/async-storage": "^1.12.1", + "lodash": "^4.17.20", + "react-native-autolink": "^3.0.0", + "redux": "^4.0.5", + "redux-thunk": "^2.3.0", + "emoji-mart-native": "^0.6.2-beta" + } } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/screenshots/logo.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/screenshots/logo.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/screenshots/logo.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/screenshots/logo.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/screenshots/main.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/screenshots/main.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/screenshots/main.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/screenshots/main.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/controller.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/controller.js index 640c973..47f05f2 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/controller.js @@ -15,7 +15,7 @@ export class CallAlertManager { onIncomingCallCancelled: (call) => { callback(enums.INCOMING_CALL_CANCELLED, call); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/index.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/index.js index b9a3a9d..ecefdec 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/index.js @@ -122,7 +122,7 @@ export default (props) => { const incomingCallCancelled = () => { try { pauseIncomingAlert(); - setIncomingCall(null); + setIncomingCall(null); } catch (error) { logger(error); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingaudiocall.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingaudiocall.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingaudiocall.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingaudiocall.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingvideocall.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingvideocall.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingvideocall.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/resources/incomingvideocall.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatIncomingCall/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/controller.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/controller.js index 5704bc7..e043cb4 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/controller.js @@ -18,7 +18,7 @@ export class CallScreenManager { onIncomingCallCancelled: (call) => { callback(enums.INCOMING_CALL_CANCELLED, call); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/CometChatOutgoingCall/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatOutgoingCall/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Calls/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/controller.js similarity index 82% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/controller.js index cae39a5..d60a91b 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/controller.js @@ -14,7 +14,9 @@ export class ConversationListManager { callListenerId = `chatlist_call_${new Date().getTime()}`; constructor() { - this.conversationRequest = new CometChat.ConversationsRequestBuilder().setLimit(30).build(); + this.conversationRequest = new CometChat.ConversationsRequestBuilder() + .setLimit(30) + .build(); } fetchNextConversation() { @@ -33,12 +35,18 @@ export class ConversationListManager { /* when someuser/friend went offline, user will be received here */ callback(enums.USER_OFFLINE, offlineUser); }, - }) + }), ); CometChat.addGroupListener( this.groupListenerId, new CometChat.GroupListener({ - onGroupMemberScopeChanged: (message, changedUser, newScope, oldScope, changedGroup) => { + onGroupMemberScopeChanged: ( + message, + changedUser, + newScope, + oldScope, + changedGroup, + ) => { callback(enums.GROUP_MEMBER_SCOPE_CHANGED, changedGroup, message, { user: changedUser, scope: newScope, @@ -51,12 +59,26 @@ export class ConversationListManager { }); }, onGroupMemberBanned: (message, bannedUser, bannedBy, bannedFrom) => { - callback(enums.GROUP_MEMBER_BANNED, bannedFrom, message, { user: bannedUser }); + callback(enums.GROUP_MEMBER_BANNED, bannedFrom, message, { + user: bannedUser, + }); }, - onGroupMemberUnbanned: (message, unbannedUser, unbannedBy, unbannedFrom) => { - callback(enums.GROUP_MEMBER_UNBANNED, unbannedFrom, message, { user: unbannedUser }); + onGroupMemberUnbanned: ( + message, + unbannedUser, + unbannedBy, + unbannedFrom, + ) => { + callback(enums.GROUP_MEMBER_UNBANNED, unbannedFrom, message, { + user: unbannedUser, + }); }, - onMemberAddedToGroup: (message, userAdded, userAddedBy, userAddedIn) => { + onMemberAddedToGroup: ( + message, + userAdded, + userAddedBy, + userAddedIn, + ) => { callback( enums.GROUP_MEMBER_ADDED, userAddedIn, @@ -69,12 +91,16 @@ export class ConversationListManager { ); }, onGroupMemberLeft: (message, leavingUser, group) => { - callback(enums.GROUP_MEMBER_LEFT, group, message, { user: leavingUser }); + callback(enums.GROUP_MEMBER_LEFT, group, message, { + user: leavingUser, + }); }, onGroupMemberJoined: (message, joinedUser, joinedGroup) => { - callback(enums.GROUP_MEMBER_JOINED, joinedGroup, message, { user: joinedUser }); + callback(enums.GROUP_MEMBER_JOINED, joinedGroup, message, { + user: joinedUser, + }); }, - }) + }), ); CometChat.addMessageListener( @@ -95,7 +121,7 @@ export class ConversationListManager { onMessageEdited: (editedMessage) => { callback(enums.MESSAGE_EDITED, null, editedMessage); }, - }) + }), ); CometChat.addCallListener( @@ -107,7 +133,7 @@ export class ConversationListManager { onIncomingCallCancelled: (call) => { callback(enums.INCOMING_CALL_CANCELLED, null, call); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/index.js similarity index 97% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/index.js index dfed6e7..0e610c9 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/index.js @@ -459,10 +459,7 @@ class CometChatConversationList extends React.Component { } }) .catch((error) => { - logger( - 'This is an error in converting message to conversation', - error, - ); + logger('This is an error in converting message to conversation', error); }); }; @@ -490,10 +487,7 @@ class CometChatConversationList extends React.Component { } }) .catch((error) => { - logger( - 'This is an error in converting message to conversation', - error, - ); + logger('This is an error in converting message to conversation', error); }); }; @@ -557,10 +551,7 @@ class CometChatConversationList extends React.Component { } }) .catch((error) => { - logger( - 'This is an error in converting message to conversation', - error, - ); + logger('This is an error in converting message to conversation', error); }); }; @@ -608,10 +599,7 @@ class CometChatConversationList extends React.Component { } }) .catch((error) => { - logger( - 'This is an error in converting message to conversation', - error, - ); + logger('This is an error in converting message to conversation', error); }); }; @@ -657,10 +645,7 @@ class CometChatConversationList extends React.Component { } }) .catch((error) => { - logger( - 'This is an error in converting message to conversation', - error, - ); + logger('This is an error in converting message to conversation', error); }); }; @@ -708,10 +693,7 @@ class CometChatConversationList extends React.Component { } }) .catch((error) => { - logger( - 'This is an error in converting message to conversation', - error, - ); + logger('This is an error in converting message to conversation', error); }); }; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/index.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/index.js index a7ce669..84da85a 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/index.js @@ -76,7 +76,7 @@ class CometChatConversationListItem extends React.Component { } let message = null; - const { lastMessage:lastMessageObject } = this.props.conversation; + const { lastMessage: lastMessageObject } = this.props.conversation; if (Object.prototype.hasOwnProperty.call(lastMessageObject, deletedAt)) { message = @@ -277,7 +277,7 @@ class CometChatConversationListItem extends React.Component { } catch (error) { logger(error); } - }; + }; /** * Retrieve avatar from conversation object diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/resources/blue-double-tick-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/resources/blue-double-tick-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/resources/blue-double-tick-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/resources/blue-double-tick-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-double-tick-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-double-tick-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-double-tick-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-double-tick-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-tick-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-tick-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-tick-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/resources/grey-tick-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListItem/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListItem/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListWithMessages/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListWithMessages/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/CometChatConversationListWithMessages/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationListWithMessages/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Chats/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/CometChatUI/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/CometChatUI/index.js similarity index 77% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/CometChatUI/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/CometChatUI/index.js index 3a80919..2e234f7 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/CometChatUI/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/CometChatUI/index.js @@ -22,10 +22,18 @@ export default () => { let iconName; if (route.name === 'Chats') { - return ; + return ( + + ); } if (route.name === 'More') { - return ; + return ( + + ); } if (route.name === 'Users') { iconName = 'ios-person-circle-sharp'; @@ -34,7 +42,9 @@ export default () => { } // You can return any component that you like here! - return ; + return ( + + ); }, })} tabBarOptions={{ @@ -44,7 +54,10 @@ export default () => { inactiveBackgroundColor: theme.color.white, labelStyle: { fontSize: 8 * heightRatio }, }}> - + diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/controller.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/controller.js index 40a6975..225ef3b 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/controller.js @@ -36,7 +36,7 @@ export class AddMembersManager { /* when someuser/friend went offline, user will be received here */ callback(offlineUser); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/index.js index b9b4045..19ca91a 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/index.js @@ -73,11 +73,11 @@ class CometChatAddGroupMemberList extends React.Component { logger(error); } } - + /** - * updates the userList via user object updation. + * updates the userList via user object updation. * @param user : Userobject - */ + */ userUpdated = (user) => { try { @@ -95,11 +95,11 @@ class CometChatAddGroupMemberList extends React.Component { logger(error); } }; - + /** - * handles how the heading should be shown when the scroll(event) is done. - * @param nativeEvent: event object - */ + * handles how the heading should be shown when the scroll(event) is done. + * @param nativeEvent: event object + */ handleScroll = ({ nativeEvent }) => { try { @@ -118,10 +118,10 @@ class CometChatAddGroupMemberList extends React.Component { } }; -/** - * searches and fetches the user that can be added based on textInputValue. - * @param val: TextInput's value -*/ + /** + * searches and fetches the user that can be added based on textInputValue. + * @param val: TextInput's value + */ searchUsers = (val) => { try { @@ -154,11 +154,11 @@ class CometChatAddGroupMemberList extends React.Component { logger(error); } }; - + /** * fetches the users and updates the userList and filteredList - * @param - */ + * @param + */ getUsers = () => { new CometChatManager() @@ -204,12 +204,11 @@ class CometChatAddGroupMemberList extends React.Component { }); }; - /** - * updates the memberToAdd by change observed via user object is passed to and managed by CometChatAddGroupMemberListItem. + * updates the memberToAdd by change observed via user object is passed to and managed by CometChatAddGroupMemberListItem. * @param user: Userobject - * @param userState - */ + * @param userState + */ membersUpdated = (user, userState) => { if (userState) { @@ -229,9 +228,9 @@ class CometChatAddGroupMemberList extends React.Component { }; /** - * updates / add members to the group. - * @param - */ + * updates / add members to the group. + * @param + */ updateMembers = () => { try { @@ -245,7 +244,7 @@ class CometChatAddGroupMemberList extends React.Component { const indexFound = group.memberList.findIndex( (member) => member.uid === newMember.uid, ); - + if (indexFound === -1) { const newMemberAdded = new CometChat.GroupMember( newMember.uid, @@ -280,14 +279,14 @@ class CometChatAddGroupMemberList extends React.Component { }); } } catch (error) { - logger("121",error); + logger('121', error); } }; - + /** * Header component for flatlist. - * @param - */ + * @param + */ listHeaderComponent = () => { return ( @@ -296,11 +295,11 @@ class CometChatAddGroupMemberList extends React.Component { ); }; - + /** * component to display when the flatlist seems empty i.e show the decorator message. - * @param - */ + * @param + */ listEmptyContainer = () => { return ( @@ -317,11 +316,11 @@ class CometChatAddGroupMemberList extends React.Component { ); }; - + /** * to be displayed as a seperator within 2 components - * @param - */ + * @param + */ itemSeparatorComponent = ({ leadingItem }) => { if (leadingItem.header) { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberList/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/index.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/index.js index 3e9e818..8df3dad 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/index.js @@ -15,11 +15,11 @@ const CometChatAddGroupMemberListItem = (props) => { return value; }); - + /** - * handles if the participant has to be added or not in the group. - * @param - */ + * handles if the participant has to be added or not in the group. + * @param + */ const handleCheck = () => { const value = checked !== true; @@ -44,7 +44,7 @@ const CometChatAddGroupMemberListItem = (props) => { cornerRadius={18} borderColor={viewTheme.color.darkSecondary} borderWidth={1} - /> + /> {props.user.name} @@ -60,4 +60,4 @@ const CometChatAddGroupMemberListItem = (props) => { ); }; -export default CometChatAddGroupMemberListItem; \ No newline at end of file +export default CometChatAddGroupMemberListItem; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-blue-active.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-blue-active.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-blue-active.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-blue-active.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-inactive.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-inactive.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-inactive.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/resources/checkbox-inactive.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/styles.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/styles.js index b4661a4..738b845 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/styles.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatAddGroupMemberListItem/styles.js @@ -8,7 +8,7 @@ export default StyleSheet.create({ width: '50%', marginRight: 15, }, - userName:{ fontSize: 14 }, + userName: { fontSize: 14 }, rowStyle: { flexDirection: 'row', alignItems: 'center', diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberList/index.js similarity index 97% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberList/index.js index 39c3057..4b02d83 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberList/index.js @@ -27,11 +27,11 @@ export default class CometChatBanGroupMemberList extends React.Component { this.theme = { ...theme, ...props.theme }; this.sheetRef = React.createRef(null); } - + /** - *handles the unbanning of a member from the group + *handles the unbanning of a member from the group * @param memberToUnBan: memberToUnBan object - */ + */ unbanMember = (memberToUnBan) => { const group = this.context; @@ -49,10 +49,10 @@ export default class CometChatBanGroupMemberList extends React.Component { }; /** - * handles the unbanning of member if the arg. action matches the required case via unbanMember() + * handles the unbanning of member if the arg. action matches the required case via unbanMember() * @param action: actions object * @param member: member object - */ + */ updateMembers = (action, member) => { switch (action) { @@ -65,9 +65,9 @@ export default class CometChatBanGroupMemberList extends React.Component { }; /** - * handles how the header should be shown when scroll(event) is performed. + * handles how the header should be shown when scroll(event) is performed. * @param nativeEvent - */ + */ handleScroll = ({ nativeEvent }) => { try { @@ -85,11 +85,11 @@ export default class CometChatBanGroupMemberList extends React.Component { logger(error); } }; - + /** * The header component for flatlist(for memberList). - * @param - */ + * @param + */ listHeaderComponent = () => { return ( @@ -101,8 +101,8 @@ export default class CometChatBanGroupMemberList extends React.Component { /** * handles what needs to be displayed when the list is empty i.e decorator message. - * @param - */ + * @param + */ listEmptyContainer = () => { return ( @@ -119,11 +119,11 @@ export default class CometChatBanGroupMemberList extends React.Component { ); }; - + /** * provides the component to be displayed between each membersList item. * @param leadingItem - */ + */ itemSeparatorComponent = ({ leadingItem }) => { if (leadingItem.header) { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberList/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberList/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/resources/block.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/resources/block.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/resources/block.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/resources/block.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatBanGroupMemberListItem/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatCreateGroup/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatCreateGroup/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatCreateGroup/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatCreateGroup/index.js index 53f5e04..68e145a 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatCreateGroup/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatCreateGroup/index.js @@ -38,29 +38,29 @@ class CometChatCreateGroup extends React.Component { this.sheetRef.current.snapTo(0); } } - + /** * handles the change in password TextInput field. * @param feedback: TextInput's value - */ + */ passwordChangeHandler = (feedback) => { this.setState({ password: feedback }); }; /** - * handles the change in groupName TextInputField + * handles the change in groupName TextInputField * @param feedback: TextInput's value - */ + */ nameChangeHandler = (feedback) => { this.setState({ name: feedback }); }; - + /** * handles the change in Picker(group-type) * @param feedback: picker's selected value - */ + */ typeChangeHandler = (feedback) => { const type = feedback; @@ -72,12 +72,12 @@ class CometChatCreateGroup extends React.Component { this.setState({ passwordInput: false }); } }; - + /** - * handles validation of various input fields - * @param - * @returns boolean: true if validation is passed else false. - */ + * handles validation of various input fields + * @param + * @returns boolean: true if validation is passed else false. + */ validate = () => { try { @@ -95,7 +95,7 @@ class CometChatCreateGroup extends React.Component { } let password = ''; - if (groupType === enums.GROUP_TYPE_PROTECTED) { + if (groupType === CometChat.GROUP_TYPE.PROTECTED) { password = this.state.password; if (!password.length) { @@ -109,11 +109,11 @@ class CometChatCreateGroup extends React.Component { return false; } }; - + /** - * handles the creation of new group based on validations. - * @param - */ + * handles the creation of new group based on validations. + * @param + */ createGroup = () => { try { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatCreateGroup/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatCreateGroup/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatCreateGroup/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatCreateGroup/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/context.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/context.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/context.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/context.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/controller.js similarity index 74% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/controller.js index 9a97645..676c35c 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/controller.js @@ -15,8 +15,12 @@ export class GroupDetailManager { constructor(guid) { this.guid = guid; - this.groupMemberRequest = new CometChat.GroupMembersRequestBuilder(guid).setLimit(10).build(); - this.bannedGroupMemberRequest = new CometChat.BannedMembersRequestBuilder(guid) + this.groupMemberRequest = new CometChat.GroupMembersRequestBuilder(guid) + .setLimit(10) + .build(); + this.bannedGroupMemberRequest = new CometChat.BannedMembersRequestBuilder( + guid, + ) .setLimit(10) .build(); } @@ -33,7 +37,13 @@ export class GroupDetailManager { CometChat.addGroupListener( this.groupListenerId, new CometChat.GroupListener({ - onGroupMemberScopeChanged: (message, changedUser, newScope, oldScope, changedGroup) => { + onGroupMemberScopeChanged: ( + message, + changedUser, + newScope, + oldScope, + changedGroup, + ) => { callback(enums.GROUP_MEMBER_SCOPE_CHANGED, message, changedGroup, { user: changedUser, scope: newScope, @@ -60,7 +70,12 @@ export class GroupDetailManager { bannedBy, ); }, - onGroupMemberUnbanned: (message, unbannedUser, unbannedBy, unbannedFrom) => { + onGroupMemberUnbanned: ( + message, + unbannedUser, + unbannedBy, + unbannedFrom, + ) => { callback( enums.GROUP_MEMBER_UNBANNED, message, @@ -72,7 +87,12 @@ export class GroupDetailManager { unbannedBy, ); }, - onMemberAddedToGroup: (message, userAdded, userAddedBy, userAddedIn) => { + onMemberAddedToGroup: ( + message, + userAdded, + userAddedBy, + userAddedIn, + ) => { callback( enums.GROUP_MEMBER_ADDED, message, @@ -85,12 +105,16 @@ export class GroupDetailManager { ); }, onGroupMemberLeft: (message, leavingUser, group) => { - callback(enums.GROUP_MEMBER_LEFT, message, group, { user: leavingUser }); + callback(enums.GROUP_MEMBER_LEFT, message, group, { + user: leavingUser, + }); }, onGroupMemberJoined: (message, joinedUser, joinedGroup) => { - callback(enums.GROUP_MEMBER_JOINED, message, joinedGroup, { user: joinedUser }); + callback(enums.GROUP_MEMBER_JOINED, message, joinedGroup, { + user: joinedUser, + }); }, - }) + }), ); CometChat.addUserListener( @@ -98,13 +122,23 @@ export class GroupDetailManager { new CometChat.UserListener({ onUserOnline: (onlineUser) => { /* when someuser/friend comes online, user will be received here */ - callback(enums.USER_ONLINE, null, { guid: this.guid }, { user: onlineUser }); + callback( + enums.USER_ONLINE, + null, + { guid: this.guid }, + { user: onlineUser }, + ); }, onUserOffline: (offlineUser) => { /* when someuser/friend went offline, user will be received here */ - callback(enums.USER_OFFLINE, null, { guid: this.guid }, { user: offlineUser }); + callback( + enums.USER_OFFLINE, + null, + { guid: this.guid }, + { user: offlineUser }, + ); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/index.js similarity index 97% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/index.js index f6721b7..6e7301d 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/index.js @@ -86,14 +86,14 @@ export default class CometChatGroupDetails extends React.Component { this.GroupDetailManager.removeListeners(); this.GroupDetailManager = null; } - + /** - * updates the group based on the key. + * updates the group based on the key. * @param key: type enums - * @param message: message object + * @param message: message object * @param options: options for user. * @param actionBy: object, defines the action taken by which user. - */ + */ groupUpdated = (key, message, group, options, actionBy) => { try { @@ -160,11 +160,11 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** - * updates the memberList and bannedMemberList based on updation of userObject. + * updates the memberList and bannedMemberList based on updation of userObject. * @param member - */ + */ groupMemberUpdated = (member) => { try { @@ -197,11 +197,11 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** - * fetches the group members and provides with their scopes - * @param - */ + * fetches the group members and provides with their scopes + * @param + */ getGroupMembers = () => { const administratorsList = []; @@ -213,11 +213,11 @@ export default class CometChatGroupDetails extends React.Component { this.GroupDetailManager.fetchNextGroupMembers() .then((groupMembers) => { groupMembers.forEach((member) => { - if (member.scope === enums.MEMBER_SCOPE_ADMIN) { + if (member.scope === CometChat.GROUP_MEMBER_SCOPE.ADMIN) { administratorsList.push(member); } - if (member.scope === enums.MEMBER_SCOPE_MODERATOR) { + if (member.scope === CometChat.GROUP_MEMBER_SCOPE.MODERATOR) { moderatorsList.push(member); } }); @@ -244,11 +244,11 @@ export default class CometChatGroupDetails extends React.Component { ); }); }; - + /** - * fetches the members who are banned. - * @param - */ + * fetches the members who are banned. + * @param + */ getBannedGroupMembers = () => { if (this.props.item.scope === CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT) { @@ -281,11 +281,11 @@ export default class CometChatGroupDetails extends React.Component { ); }); }; - + /** * handles the deletion of the group. - * @param - */ + * @param + */ deleteGroup = () => { const item = { ...this.props.item }; @@ -300,9 +300,9 @@ export default class CometChatGroupDetails extends React.Component { }; /** - * allows the logged in user to leave the group - * @param - */ + * allows the logged in user to leave the group + * @param + */ leaveGroup = () => { try { @@ -319,12 +319,12 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** - * handles the action to be taken and provide required screen. + * handles the action to be taken and provide required screen. * @param action * @param flag - */ + */ clickHandler = (action, flag) => { switch (action) { @@ -343,10 +343,10 @@ export default class CometChatGroupDetails extends React.Component { }; /** - * handles the various actions for the members of the group + * handles the various actions for the members of the group * @param action * @param member - */ + */ membersActionHandler = (action, members) => { switch (action) { @@ -375,12 +375,12 @@ export default class CometChatGroupDetails extends React.Component { break; } }; - + /** - * handles the banning of members + * handles the banning of members * @param members * @param triggerUpdate - */ + */ banMembers = (members, triggerUpdate = true) => { try { @@ -409,12 +409,12 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** * handles the unbanning of members from the group. * @param members * @param triggerUpdate - */ + */ unbanMembers = (members, triggerUpdate = true) => { try { @@ -441,12 +441,12 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** * handles the addition of participants * @param members * @param triggerUpdate - */ + */ addParticipants = (members, triggerUpdate = true) => { try { @@ -467,12 +467,12 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** * handles the removing of participants from the group. * @param member * @param triggerUpdate - */ + */ removeParticipants = (member, triggerUpdate = true) => { try { @@ -497,12 +497,12 @@ export default class CometChatGroupDetails extends React.Component { logger(error); } }; - + /** * handles the updation of members when their scope is changed. * @param updatedMember: member object * @param triggerUpdate - */ + */ updateParticipants = (updatedMember, triggerUpdate = true) => { try { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupDetails/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupDetails/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/controller.js similarity index 72% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/controller.js index a89ee3d..3939621 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/controller.js @@ -14,7 +14,9 @@ export class GroupListManager { .setSearchKeyword(searchKey) .build(); } else { - this.groupRequest = new CometChat.GroupsRequestBuilder().setLimit(30).build(); + this.groupRequest = new CometChat.GroupsRequestBuilder() + .setLimit(30) + .build(); } } @@ -26,7 +28,13 @@ export class GroupListManager { CometChat.addGroupListener( this.groupListenerId, new CometChat.GroupListener({ - onGroupMemberScopeChanged: (message, changedUser, newScope, oldScope, changedGroup) => { + onGroupMemberScopeChanged: ( + message, + changedUser, + newScope, + oldScope, + changedGroup, + ) => { callback(enums.GROUP_MEMBER_SCOPE_CHANGED, message, changedGroup, { user: changedUser, scope: newScope, @@ -44,25 +52,39 @@ export class GroupListManager { hasJoined: false, }); }, - onGroupMemberUnbanned: (message, unbannedUser, unbannedBy, unbannedFrom) => { + onGroupMemberUnbanned: ( + message, + unbannedUser, + unbannedBy, + unbannedFrom, + ) => { callback(enums.GROUP_MEMBER_UNBANNED, message, unbannedFrom, { user: unbannedUser, hasJoined: false, }); }, - onMemberAddedToGroup: (message, userAdded, userAddedBy, userAddedIn) => { + onMemberAddedToGroup: ( + message, + userAdded, + userAddedBy, + userAddedIn, + ) => { callback(enums.GROUP_MEMBER_ADDED, message, userAddedIn, { user: userAdded, hasJoined: true, }); }, onGroupMemberLeft: (message, leavingUser, group) => { - callback(enums.GROUP_MEMBER_LEFT, message, group, { user: leavingUser }); + callback(enums.GROUP_MEMBER_LEFT, message, group, { + user: leavingUser, + }); }, onGroupMemberJoined: (message, joinedUser, joinedGroup) => { - callback(enums.GROUP_MEMBER_JOINED, message, joinedGroup, { user: joinedUser }); + callback(enums.GROUP_MEMBER_JOINED, message, joinedGroup, { + user: joinedUser, + }); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/index.js index b527186..5f4bec4 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/index.js @@ -187,12 +187,12 @@ class CometChatGroupList extends React.Component { } /** - * handles the updation of groups based on key + * handles the updation of groups based on key * @param key: type enums * @param message: message object * @param group: specifies the group to be updated. - * @param options:options for the group. - */ + * @param options:options for the group. + */ groupUpdated = (key, message, group, options) => { switch (key) { case enums.GROUP_MEMBER_SCOPE_CHANGED: @@ -213,12 +213,12 @@ class CometChatGroupList extends React.Component { break; } }; - + /** - * checks for the group and updates the fields when a member is added in the group and updates the groupList. + * checks for the group and updates the fields when a member is added in the group and updates the groupList. * @param group: group object * @param options - */ + */ updateMemberAdded = (group, options) => { try { @@ -285,12 +285,12 @@ class CometChatGroupList extends React.Component { logger(error); } }; - + /** * handles the updation of group when a member joins the group.Scope is set to participant by default. * @param group: group object - * @param options - */ + * @param options + */ updateMemberJoined = (group, options) => { try { @@ -318,12 +318,12 @@ class CometChatGroupList extends React.Component { logger(error); } }; - + /** - * handles the updation of group when the scope of member is changed. + * handles the updation of group when the scope of member is changed. * @param group * @param options - */ + */ updateMemberChanged = (group, options) => { try { @@ -345,11 +345,11 @@ class CometChatGroupList extends React.Component { logger(error); } }; - + /** - * handles the joining of a group by the participant if the requirements are met i.e if the passcode entered matches the protected group's set passcode. + * handles the joining of a group by the participant if the requirements are met i.e if the passcode entered matches the protected group's set passcode. * @param passcode - */ + */ joinGroup = (passcode) => { if (passcode !== null) { @@ -366,7 +366,7 @@ class CometChatGroupList extends React.Component { }; groups.splice(groupKey, 1, newGroupObj); this.setState({ grouplist: groups, selectedGroup: newGroupObj }); - this.props.onItemClick(newGroupObj, enums.TYPE_GROUP); + this.props.onItemClick(newGroupObj, CometChat.RECEIVER_TYPE.GROUP); this.setState({ showPasswordScreen: false }); } }) @@ -375,11 +375,11 @@ class CometChatGroupList extends React.Component { }); } }; - + /** - * handles what to display when a specific group item from groupList is clicked + * handles what to display when a specific group item from groupList is clicked * @param group: group object - */ + */ handleClick = (group) => { //handle click here @@ -409,7 +409,10 @@ class CometChatGroupList extends React.Component { groups.splice(groupKey, 1, newGroupObj); this.setState({ grouplist: groups, selectedGroup: newGroupObj }); - this.props.onItemClick(newGroupObj, enums.TYPE_GROUP); + this.props.onItemClick( + newGroupObj, + CometChat.RECEIVER_TYPE.GROUP, + ); } }) .catch((error) => { @@ -418,14 +421,14 @@ class CometChatGroupList extends React.Component { } } else { this.setState({ selectedGroup: group }); - this.props.onItemClick(group, enums.TYPE_GROUP); + this.props.onItemClick(group, CometChat.RECEIVER_TYPE.GROUP); } }; /** - * handles the searching of groups and fetching based on the updation in TextInput(Search box). + * handles the searching of groups and fetching based on the updation in TextInput(Search box). * @param e: textInput's value - */ + */ searchGroup = (e) => { //search group here this.setState( @@ -449,15 +452,15 @@ class CometChatGroupList extends React.Component { endReached = () => { this.getGroups(); }; - + /** - * handles the updation in group when messages are seen by the members. - * @param - */ + * handles the updation in group when messages are seen by the members. + * @param + */ markMessagesRead = (message) => { if (!(message.getReadAt() || message.getReadByMeAt())) { - if (message.getReceiverType() === enums.TYPE_USER) { + if (message.getReceiverType() === CometChat.RECEIVER_TYPE.USER) { CometChat.markAsRead( message.getId().toString(), message.getSender().getUid(), @@ -474,9 +477,9 @@ class CometChatGroupList extends React.Component { }; /** - * fetches the groups and updates the groupList. - * @param - */ + * fetches the groups and updates the groupList. + * @param + */ getGroups = () => { new CometChatManager() @@ -502,17 +505,14 @@ class CometChatGroupList extends React.Component { }) .catch((error) => { this.decoratorMessage = 'Error'; - logger( - '[CometChatGroupList] getUsers getLoggedInUser error', - error, - ); + logger('[CometChatGroupList] getUsers getLoggedInUser error', error); }); }; - + /** - * sets the createGroup state in order to display the modal for groupCreation. - * @param - */ + * sets the createGroup state in order to display the modal for groupCreation. + * @param + */ createGroupHandler = (flag) => { this.setState({ createGroup: flag }); @@ -522,7 +522,7 @@ class CometChatGroupList extends React.Component { * updates the fields when the member is removed from the group based on updation of groupObj and setting newGroupObj. * @param group: group object * @param options - */ + */ updateMemberRemoved = (group, options) => { try { @@ -553,12 +553,12 @@ class CometChatGroupList extends React.Component { logger(error); } }; - + /** - * updates the groupList if new group is created and closes the modal for creating Group. + * updates the groupList if new group is created and closes the modal for creating Group. * @param action * @param group - */ + */ createGroupActionHandler = (action, group) => { if (action === actions.GROUP_CREATED) { @@ -601,11 +601,11 @@ class CometChatGroupList extends React.Component { /> ); }; - + /** * handles how the header is to be shown when scroll(event) is performed. * @param nativeEvent - */ + */ handleScroll = ({ nativeEvent }) => { try { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupList/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListItem/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListItem/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListItem/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListItem/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListItem/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListItem/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListItem/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListItem/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListWithMessages/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListWithMessages/index.js similarity index 87% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListWithMessages/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListWithMessages/index.js index d2f0cf9..0d498ae 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListWithMessages/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListWithMessages/index.js @@ -24,7 +24,7 @@ class CometChatGroupListWithMessages extends React.Component { darkTheme: false, viewDetailScreen: false, item: {}, - type: enums.TYPE_GROUP, + type: CometChat.RECEIVER_TYPE.GROUP, tab: 'groups', groupToDelete: {}, groupToLeave: {}, @@ -52,31 +52,27 @@ class CometChatGroupListWithMessages extends React.Component { this.loggedInUser = user; }) .catch((error) => { - logger( - '[CometChatGroupListWithMessages] getLoggedInUser error', - error, - ); + logger('[CometChatGroupListWithMessages] getLoggedInUser error', error); }); } - + /** - * Update item, viewDetailScreen when a group from groupList is clicked. + * Update item, viewDetailScreen when a group from groupList is clicked. * @param item: item object - * @param type: group type - */ + * @param type: group type + */ itemClicked = (item, type) => { this.setState({ item: { ...item }, type, viewDetailScreen: false }, () => { this.navigateToMessageListScreen(item, type); }); }; - /** - * Navigate to CometChatMessages on clicking of the group item and checking of validations. + * Navigate to CometChatMessages on clicking of the group item and checking of validations. * @param item:item object - * @param type:group type - */ + * @param type:group type + */ navigateToMessageListScreen = (item, type) => { this.props.navigation.navigate( @@ -93,34 +89,34 @@ class CometChatGroupListWithMessages extends React.Component { }, ); }; - + /** - * On call initiated by a member - * @param - */ + * On call initiated by a member + * @param + */ callInitiated = (message) => { this.appendCallMessage(message); }; /** - * On outgoing call end - * @param - */ + * On outgoing call end + * @param + */ outgoingCallEnded = (message) => { this.setState({ outgoingCall: null, incomingCall: null }, () => { this.appendCallMessage(message); }); }; - + /** - * handles various actions related to the updation in groups. + * handles various actions related to the updation in groups. * @param action: action name * @param item: item object * @param count: members count - * @param ...otherProps: props received - */ + * @param ...otherProps: props received + */ actionHandler = (action, item, count, ...otherProps) => { switch (action) { @@ -204,12 +200,12 @@ class CometChatGroupListWithMessages extends React.Component { break; } }; - + /** - * updation of thread messages on message fetch. + * updation of thread messages on message fetch. * @param message: message object - * @param action: action name - */ + * @param action: action name + */ updateThreadMessage = (message, action) => { if ( @@ -230,9 +226,9 @@ class CometChatGroupListWithMessages extends React.Component { }; /** - * block users by logged in user. - * @param - */ + * block users by logged in user. + * @param + */ blockUser = () => { try { @@ -248,11 +244,11 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * unblock users by logged in user. - * @param - */ + * unblock users by logged in user. + * @param + */ unblockUser = () => { try { @@ -268,20 +264,20 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * handles audio call to a user/group. - * @param - */ + * handles audio call to a user/group. + * @param + */ audioCall = () => { try { let receiverId; let receiverType; - if (this.state.type === enums.TYPE_USER) { + if (this.state.type === CometChat.RECEIVER_TYPE.USER) { receiverId = this.state.item.uid; receiverType = CometChat.RECEIVER_TYPE.USER; - } else if (this.state.type === enums.TYPE_GROUP) { + } else if (this.state.type === CometChat.RECEIVER_TYPE.GROUP) { receiverId = this.state.item.guid; receiverType = CometChat.RECEIVER_TYPE.GROUP; } @@ -298,20 +294,20 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * handles video call to a user/group. - * @param - */ + * handles video call to a user/group. + * @param + */ videoCall = () => { try { let receiverId; let receiverType; - if (this.state.type === enums.TYPE_USER) { + if (this.state.type === CometChat.RECEIVER_TYPE.USER) { receiverId = this.state.item.uid; receiverType = CometChat.RECEIVER_TYPE.USER; - } else if (this.state.type === enums.TYPE_GROUP) { + } else if (this.state.type === CometChat.RECEIVER_TYPE.GROUP) { receiverId = this.state.item.guid; receiverType = CometChat.RECEIVER_TYPE.GROUP; } @@ -335,9 +331,9 @@ class CometChatGroupListWithMessages extends React.Component { }; /** - * toggle viewDetailScreen - * @param - */ + * toggle viewDetailScreen + * @param + */ toggleDetailView = () => { const viewDetail = !this.state.viewDetailScreen; @@ -345,51 +341,51 @@ class CometChatGroupListWithMessages extends React.Component { }; /** - * handles deletion of group + * handles deletion of group * @param group: group object - */ + */ deleteGroup = (group) => { this.setState({ groupToDelete: group, item: {}, - type: enums.TYPE_GROUP, + type: CometChat.RECEIVER_TYPE.GROUP, viewDetailScreen: false, }); }; - + /** - * handles the updation when logged in user leaves the group + * handles the updation when logged in user leaves the group * @param group: group object - */ + */ leaveGroup = (group) => { this.setState({ groupToLeave: group, item: {}, - type: enums.TYPE_GROUP, + type: CometChat.RECEIVER_TYPE.GROUP, viewDetailScreen: false, }); }; - + /** * updation of member count of group. * @param item:item object * @param count: member count - */ + */ updateMembersCount = (item, count) => { const group = { ...this.state.item, membersCount: count }; this.setState({ item: group, groupToUpdate: group }); }; - + /** * handles the updation of group based on key * @param key: action name * @param message: message object * @param group: group object * @param options: options object for member - */ + */ groupUpdated = (message, key, group, options) => { try { @@ -399,7 +395,7 @@ class CometChatGroupListWithMessages extends React.Component { if (options.user.uid === this.loggedInUser.uid) { this.setState({ item: {}, - type: enums.TYPE_GROUP, + type: CometChat.RECEIVER_TYPE.GROUP, viewDetailScreen: false, }); } @@ -410,7 +406,7 @@ class CometChatGroupListWithMessages extends React.Component { const newObj = { ...this.state.item, scope: options.scope }; this.setState({ item: newObj, - type: enums.TYPE_GROUP, + type: CometChat.RECEIVER_TYPE.GROUP, viewDetailScreen: false, }); } @@ -423,20 +419,20 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * Close thread messages, updation of viewDetailScreen - * @param - */ + * Close thread messages, updation of viewDetailScreen + * @param + */ closeThreadMessages = () => { this.setState({ viewDetailScreen: false, threadMessageView: false }); }; - + /** * View message thread via parentMessage * @param parentMessage: message object - */ + */ viewMessageThread = (parentMessage) => { const message = { ...parentMessage }; const threadItem = { ...this.state.item }; @@ -452,7 +448,7 @@ class CometChatGroupListWithMessages extends React.Component { /** * Sets composedThreadMessage via composed message param. * @param composedMessage: message object - */ + */ onThreadMessageComposed = (composedMessage) => { try { @@ -461,9 +457,9 @@ class CometChatGroupListWithMessages extends React.Component { } if ( - (this.state.threadMessageType === enums.TYPE_GROUP && + (this.state.threadMessageType === CometChat.RECEIVER_TYPE.GROUP && this.state.item.guid !== this.state.threadMessageItem.guid) || - (this.state.threadMessageType === enums.TYPE_USER && + (this.state.threadMessageType === CometChat.RECEIVER_TYPE.USER && this.state.item.uid !== this.state.threadMessageItem.uid) ) { return false; @@ -475,17 +471,18 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * Handles the incoming call when user hits accept + * Handles the incoming call when user hits accept * @param call - */ + */ acceptIncomingCall = (call) => { this.setState({ incomingCall: call }); const type = call.receiverType; - const id = type === enums.TYPE_USER ? call.sender.uid : call.receiverId; + const id = + type === CometChat.RECEIVER_TYPE.USER ? call.sender.uid : call.receiverId; CometChat.getConversation(id, type) .then((conversation) => { @@ -495,18 +492,18 @@ class CometChatGroupListWithMessages extends React.Component { logger('error while fetching a conversation', error); }); }; - + /** - * handles the imcoming call when user hits reject + * handles the imcoming call when user hits reject * @param incomingCallMessage: incomingCallMessage object * @param rejectedCallMessage: rejectedCallMessage object - */ + */ rejectedIncomingCall = (incomingCallMessage, rejectedCallMessage) => { try { let { receiverType } = incomingCallMessage; let receiverId = - receiverType === enums.TYPE_USER + receiverType === CometChat.RECEIVER_TYPE.USER ? incomingCallMessage.sender.uid : incomingCallMessage.receiverId; @@ -523,11 +520,11 @@ class CometChatGroupListWithMessages extends React.Component { receiverId = rejectedCallMessage.receiverId; if ( - (type === enums.TYPE_GROUP && - receiverType === enums.TYPE_GROUP && + (type === CometChat.RECEIVER_TYPE.GROUP && + receiverType === CometChat.RECEIVER_TYPE.GROUP && receiverId === item.guid) || - (type === enums.TYPE_USER && - receiverType === enums.TYPE_USER && + (type === CometChat.RECEIVER_TYPE.USER && + receiverType === CometChat.RECEIVER_TYPE.USER && receiverId === item.uid) ) { this.appendCallMessage(rejectedCallMessage); @@ -536,28 +533,28 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * on outgoing call end - * @param message: message object - */ + * on outgoing call end + * @param message: message object + */ outgoingCallEnded = (message) => { this.setState({ outgoingCall: null, incomingCall: null }); this.appendCallMessage(message); }; - + /** * image view when clicked on image * @param message: message object - */ + */ toggleImageView = (message) => { this.setState({ imageView: message }); }; - + /** - * handler for member added to the group by a user and updation of groupMessage. + * handler for member added to the group by a user and updation of groupMessage. * @param members: members object - */ + */ membersAdded = (members) => { try { @@ -579,11 +576,11 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * handler for member unbanned from the group by a user and updation of groupMessage. + * handler for member unbanned from the group by a user and updation of groupMessage. * @param members: members object - */ + */ memberUnbanned = (members) => { try { @@ -605,11 +602,11 @@ class CometChatGroupListWithMessages extends React.Component { logger(error); } }; - + /** - * handler for member scope changed in the group by a user and updation of groupMessage. + * handler for member scope changed in the group by a user and updation of groupMessage. * @param members: members object - */ + */ memberScopeChanged = (members) => { try { const messageList = []; @@ -633,9 +630,9 @@ class CometChatGroupListWithMessages extends React.Component { }; /** - * update callMessage and navigate to cometChatMessages - * @param call: call object - */ + * update callMessage and navigate to cometChatMessages + * @param call: call object + */ appendCallMessage = (call) => { const { item, type } = this.state; this.setState({ callMessage: call }, () => { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListWithMessages/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListWithMessages/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatGroupListWithMessages/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatGroupListWithMessages/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberList/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberList/index.js index 614b8a3..bea5c2f 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberList/index.js @@ -31,13 +31,13 @@ export default class CometChatViewGroupMemberList extends React.Component { this.theme = { ...theme, ...props.theme }; this.sheetRef = React.createRef(null); } - + /** - * update members of the group based on action. + * update members of the group based on action. * @param action: action name * @param member: member object * @param scope: scope object - */ + */ updateMembers = (action, member, scope) => { switch (action) { @@ -54,11 +54,11 @@ export default class CometChatViewGroupMemberList extends React.Component { break; } }; - + /** - * handler for banning of members in group + * handler for banning of members in group * @param memberToBan: memberToBan object - */ + */ banMember = (memberToBan) => { try { @@ -76,11 +76,11 @@ export default class CometChatViewGroupMemberList extends React.Component { logger(error); } }; - + /** * handler for kicking of member from group - * @param memberToKick: memberToKick object - */ + * @param memberToKick: memberToKick object + */ kickMember = (memberToKick) => { try { const { guid } = this.props.item; @@ -100,12 +100,12 @@ export default class CometChatViewGroupMemberList extends React.Component { logger(error); } }; - + /** * handler for changing of scope of members in the group. * @param member: member object * @param scope: scope object - */ + */ changeScope = (member, scope) => { try { @@ -128,11 +128,11 @@ export default class CometChatViewGroupMemberList extends React.Component { logger(error); } }; - + /** - * handler for the heading when scroll(event) is implemeted - * @param - */ + * handler for the heading when scroll(event) is implemeted + * @param + */ handleScroll = ({ nativeEvent }) => { try { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberList/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberList/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/index.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/index.js index 62a41b9..cd070f2 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/index.js @@ -14,8 +14,8 @@ export default (props) => { /** * Update member scope - * @param - */ + * @param + */ const updateMemberScope = () => { toggleChange(false); if (props.member.scope !== scope) { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/block.svg b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/block.svg similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/block.svg rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/block.svg diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/clear.svg b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/clear.svg similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/clear.svg rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/clear.svg diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/create.svg b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/create.svg similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/create.svg rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/create.svg diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/delete.svg b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/delete.svg similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/delete.svg rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/delete.svg diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/done.svg b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/done.svg similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/done.svg rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/resources/done.svg diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/style.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/style.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/style.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/CometChatViewGroupMemberListItem/style.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Groups/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Groups/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatActionMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatActionMessageBubble/index.js similarity index 76% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatActionMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatActionMessageBubble/index.js index a683892..e0acff2 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatActionMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatActionMessageBubble/index.js @@ -7,8 +7,8 @@ import style from './styles'; const CometChatActionMessageBubble = (props) => { /** * Retrieve message text from message object according to message types - * @param - */ + * @param + */ const getMessage = useCallback(() => { const call = props.message; const { loggedInUser } = props; @@ -17,13 +17,13 @@ const CometChatActionMessageBubble = (props) => { switch (call.status) { case CometChat.CALL_STATUS.INITIATED: { message = 'Call initiated'; - if (call.type === enums.CALL_TYPE_AUDIO) { - if (call.receiverType === enums.TYPE_USER) { + if (call.type === CometChat.CALL_TYPE.AUDIO) { + if (call.receiverType === CometChat.RECEIVER_TYPE.USER) { message = call.callInitiator.uid === loggedInUser.uid ? 'Outgoing audio call' : 'Incoming audio call'; - } else if (call.receiverType === enums.TYPE_GROUP) { + } else if (call.receiverType === CometChat.RECEIVER_TYPE.GROUP) { if (call.action === CometChat.CALL_STATUS.INITIATED) { message = call.callInitiator.uid === loggedInUser.uid @@ -36,13 +36,13 @@ const CometChatActionMessageBubble = (props) => { : `${call.sender.name} rejected call`; } } - } else if (call.type === enums.CALL_TYPE_VIDEO) { - if (call.receiverType === enums.TYPE_USER) { + } else if (call.type === CometChat.CALL_TYPE.VIDEO) { + if (call.receiverType === CometChat.RECEIVER_TYPE.USER) { message = call.callInitiator.uid === loggedInUser.uid ? 'Outgoing video call' : 'Incoming video call'; - } else if (call.receiverType === enums.TYPE_GROUP) { + } else if (call.receiverType === CometChat.RECEIVER_TYPE.GROUP) { if (call.action === CometChat.CALL_STATUS.INITIATED) { message = call.callInitiator.uid === loggedInUser.uid @@ -59,12 +59,14 @@ const CometChatActionMessageBubble = (props) => { break; } case CometChat.CALL_STATUS.ONGOING: { - if (call.receiverType === enums.TYPE_USER) { + if (call.receiverType === CometChat.RECEIVER_TYPE.USER) { message = 'Call accepted'; - } else if (call.receiverType === enums.TYPE_GROUP) { + } else if (call.receiverType === CometChat.RECEIVER_TYPE.GROUP) { if (call.action === CometChat.CALL_STATUS.ONGOING) { message = - call.sender.uid === loggedInUser.uid ? 'Call accepted' : `${call.sender.name} joined`; + call.sender.uid === loggedInUser.uid + ? 'Call accepted' + : `${call.sender.name} joined`; } else if (call.action === CometChat.CALL_STATUS.REJECTED) { message = call.sender.uid === loggedInUser.uid @@ -83,17 +85,18 @@ const CometChatActionMessageBubble = (props) => { case CometChat.CALL_STATUS.UNANSWERED: { message = 'Call unanswered'; if ( - call.type === enums.CALL_TYPE_AUDIO && - (call.receiverType === enums.TYPE_USER || call.receiverType === enums.TYPE_GROUP) + call.type === CometChat.CALL_TYPE.AUDIO && + (call.receiverType === CometChat.RECEIVER_TYPE.USER || + call.receiverType === CometChat.RECEIVER_TYPE.GROUP) ) { message = call.callInitiator.uid === loggedInUser.uid ? 'Unanswered audio call' : 'Missed audio call'; } else if ( - call.type === enums.CALL_TYPE_VIDEO && - (call.receiverType === enums.TYPE_USER || - call.receiverType === enums.TYPE_GROUP) + call.type === CometChat.CALL_TYPE.VIDEO && + (call.receiverType === CometChat.RECEIVER_TYPE.USER || + call.receiverType === CometChat.RECEIVER_TYPE.GROUP) ) { message = call.callInitiator.uid === loggedInUser.uid @@ -125,4 +128,4 @@ const CometChatActionMessageBubble = (props) => { return {getMessage()}; }; -export default CometChatActionMessageBubble; \ No newline at end of file +export default CometChatActionMessageBubble; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatActionMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatActionMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatActionMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatActionMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/index.js similarity index 81% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/index.js index fd18e5c..59189f4 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/index.js @@ -2,17 +2,21 @@ import React from 'react'; import { View, Text } from 'react-native'; import theme from '../../../resources/theme'; import style from './style'; -import * as enums from '../../../utils/enums' +import * as enums from '../../../utils/enums'; +import { CometChat } from '@cometchat-pro/react-native-chat'; import { CometChatAvatar } from '../../Shared'; -const CometChatDeleteMessageBubble = (props) => { +const CometChatDeleteMessageBubble = (props) => { const message = { ...props.message, messageFrom: props.messageOf }; let messageContainer = null; - const timestamp = new Date(props.message.sentAt * 1000).toLocaleTimeString('en-US', { - hour: 'numeric', - minute: 'numeric', - hour12: true, - }); + const timestamp = new Date(props.message.sentAt * 1000).toLocaleTimeString( + 'en-US', + { + hour: 'numeric', + minute: 'numeric', + hour12: true, + }, + ); const viewTheme = { ...theme, ...props.theme }; if (props.messageOf === enums.MESSAGE_OF_SENDER) { @@ -33,7 +37,7 @@ const CometChatDeleteMessageBubble = (props) => { } else if (message.messageFrom === enums.MESSAGE_FROM_RECEIVER) { let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { if (message.sender.avatar) { senderAvatar = { uri: message.sender.CometChatAvatar }; } @@ -42,7 +46,7 @@ const CometChatDeleteMessageBubble = (props) => { messageContainer = ( - {message.receiverType === enums.TYPE_GROUP ? ( + {message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {message.receiverType === enums.TYPE_GROUP ? ( + {message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} @@ -77,4 +81,4 @@ const CometChatDeleteMessageBubble = (props) => { } return {messageContainer}; }; -export default CometChatDeleteMessageBubble; \ No newline at end of file +export default CometChatDeleteMessageBubble; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/style.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/style.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/style.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatDeleteMessageBubble/style.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatImageViewer/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatImageViewer/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatImageViewer/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatImageViewer/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatImageViewer/resources/clear.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatImageViewer/resources/clear.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatImageViewer/resources/clear.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatImageViewer/resources/clear.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatImageViewer/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatImageViewer/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatImageViewer/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatImageViewer/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatLiveReactions/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatLiveReactions/index.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatLiveReactions/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatLiveReactions/index.js index 287725b..4f00cd6 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatLiveReactions/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatLiveReactions/index.js @@ -15,8 +15,8 @@ let startCount = 1; /** * generate random number for hearts. * @param min: number - * @param max: number -*/ + * @param max: number + */ function getRandomNumber(min, max) { return Math.random() * (max - min) + min; @@ -75,11 +75,11 @@ class AnimatedHeart extends Component { useNativeDriver: true, }).start(this.props.onComplete); } - + /** - * Animation for heart - * @param - */ + * Animation for heart + * @param + */ getHeartAnimationStyle = () => { return { @@ -146,11 +146,11 @@ export default class CometChatLiveReactions extends Component { }, ], }; - + /** * remove heart * @param v: heart id - */ + */ removeHeart = (v) => { try { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatLiveReactions/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatLiveReactions/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatLiveReactions/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatLiveReactions/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/actions.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/actions.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/actions.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/actions.js index 575a3ba..f818059 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/actions.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/actions.js @@ -11,6 +11,7 @@ import MCIIcon from 'react-native-vector-icons/MaterialCommunityIcons'; import styles from './styles'; import * as actions from '../../../utils/actions'; import * as enums from '../../../utils/enums'; +import CometChat from '@cometchat-pro/react-native-chat'; const actionIconSize = 26; @@ -28,7 +29,7 @@ export default (props) => { // if threaded messages need to be disabled if ( - props.message.category === enums.CATEGORY_CUSTOM || + props.message.category === CometChat.MESSAGE_TYPE.CUSTOM || props.message.parentMessageId ) { threadedChats = null; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageActions/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageActions/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageComposer/composerActions.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageComposer/composerActions.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageComposer/composerActions.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageComposer/composerActions.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageComposer/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageComposer/index.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageComposer/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageComposer/index.js index fb5cc8b..660bed0 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageComposer/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageComposer/index.js @@ -116,51 +116,51 @@ export default class CometChatMessageComposer extends React.PureComponent { logger(error); } } - + /** * Handler for audio when message is sent - * @param - */ + * @param + */ playAudio = () => { this.audio.setCurrentTime(0); this.audio.play(); }; - + /** * Handler for change in TextInput(messageComposer) * @param text: TextInput's value - */ + */ changeHandler = (text) => { this.startTyping(); this.setState({ messageInput: text, messageType: 'text' }); }; - + /** - * Fetches the receiver's details. - * @param - */ + * Fetches the receiver's details. + * @param + */ getReceiverDetails = () => { let receiverId; let receiverType; - if (this.props.type === enums.TYPE_USER) { + if (this.props.type === CometChat.RECEIVER_TYPE.USER) { receiverId = this.props.item.uid; receiverType = CometChat.RECEIVER_TYPE.USER; - } else if (this.props.type === enums.TYPE_GROUP) { + } else if (this.props.type === CometChat.RECEIVER_TYPE.GROUP) { receiverId = this.props.item.guid; receiverType = CometChat.RECEIVER_TYPE.GROUP; } return { receiverId, receiverType }; }; - + /** - * handler for sending and generating media message + * handler for sending and generating media message * @param messageInput: object messageInput - * @param messageType: object messageType - */ + * @param messageType: object messageType + */ sendMediaMessage = (messageInput, messageType) => { try { @@ -199,9 +199,9 @@ export default class CometChatMessageComposer extends React.PureComponent { }; /** - * handler for sending Text Message - * @param - */ + * handler for sending Text Message + * @param + */ sendTextMessage = () => { try { @@ -253,11 +253,11 @@ export default class CometChatMessageComposer extends React.PureComponent { logger(error); } }; - + /** - * Handler for edit message - * @param - */ + * Handler for edit message + * @param + */ editMessage = () => { try { @@ -293,20 +293,20 @@ export default class CometChatMessageComposer extends React.PureComponent { logger(error); } }; - + /** * handler for action -> CLEAR_EDIT_PREVIEW - * @param - */ + * @param + */ closeEditPreview = () => { this.props.actionGenerated(actions.CLEAR_EDIT_PREVIEW); }; - + /** * Handler For Generating typing Notification * @param timer: typingInterval * @param metadata: metadata object - */ + */ startTyping = (timer, metadata) => { try { @@ -332,11 +332,11 @@ export default class CometChatMessageComposer extends React.PureComponent { logger(error); } }; - + /** - * Handler to end typing Notification + * Handler to end typing Notification * @param metadata: metadata object - */ + */ endTyping = (metadata) => { try { @@ -359,9 +359,9 @@ export default class CometChatMessageComposer extends React.PureComponent { }; /** - * Handler to toggle Sticker Picker screen - * @param - */ + * Handler to toggle Sticker Picker screen + * @param + */ toggleStickerPicker = () => { const { stickerViewer } = this.state; @@ -370,36 +370,36 @@ export default class CometChatMessageComposer extends React.PureComponent { stickerViewer: !stickerViewer, }); }; - + /** * handler to toggle create poll screen - * @param - */ + * @param + */ toggleCreatePoll = () => { const { createPoll } = this.state; this.setState({ composerActionsVisible: false, createPoll: !createPoll }); }; - + /** * handler to close create poll screen - * @param - */ + * @param + */ closeCreatePoll = () => { this.toggleCreatePoll(); }; - + /** - * handler for various action + * handler for various action * @param action: action name * @param message: message object - */ + */ actionHandler = (action, message) => { switch (action) { case actions.POLL_CREATED: this.toggleCreatePoll(); // temporary check; custom data listener working for sender too - if (this.props.type === enums.TYPE_USER) { + if (this.props.type === CometChat.RECEIVER_TYPE.USER) { this.props.actionGenerated(actions.POLL_CREATED, [message]); } @@ -414,11 +414,11 @@ export default class CometChatMessageComposer extends React.PureComponent { break; } }; - + /** * handler for sending sticker message * @param stickerMessage: object stickerMessage - */ + */ sendSticker = (stickerMessage) => { this.messageSending = true; @@ -450,11 +450,11 @@ export default class CometChatMessageComposer extends React.PureComponent { logger('custom message sending failed with error', error); }); }; - + /** - * handler for sending reply message + * handler for sending reply message * @param messageInput: object messageInput - */ + */ sendReplyMessage = (messageInput) => { try { @@ -481,15 +481,15 @@ export default class CometChatMessageComposer extends React.PureComponent { logger(error); } }; - + clearReplyPreview = () => { this.setState({ replyPreview: null }); }; - + /** * handler for sending reactions - * @param - */ + * @param + */ sendReaction = (event) => { const typingInterval = 1000; @@ -709,8 +709,7 @@ export default class CometChatMessageComposer extends React.PureComponent { toggleCreatePoll={this.toggleCreatePoll} sendMediaMessage={this.sendMediaMessage} /> - + - + { callback(enums.TYPING_ENDED, typingIndicator); }, - }) + }), ); CometChat.addGroupListener( @@ -45,7 +45,12 @@ export class MessageHeaderManager { onGroupMemberBanned: (message, bannedUser, bannedBy, bannedFrom) => { callback(enums.GROUP_MEMBER_BANNED, bannedFrom, bannedUser); }, - onMemberAddedToGroup: (message, userAdded, userAddedBy, userAddedIn) => { + onMemberAddedToGroup: ( + message, + userAdded, + userAddedBy, + userAddedIn, + ) => { callback(enums.GROUP_MEMBER_ADDED, userAddedIn); }, onGroupMemberLeft: (message, leavingUser, group) => { @@ -54,7 +59,7 @@ export class MessageHeaderManager { onGroupMemberJoined: (message, joinedUser, joinedGroup) => { callback(enums.GROUP_MEMBER_JOINED, joinedGroup); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/index.js similarity index 84% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/index.js index 399bcf9..2e1b160 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/index.js @@ -11,7 +11,7 @@ import audioCallIcon from './resources/audioCall.png'; import videoCallIcon from './resources/videoCall.png'; import Icon from 'react-native-vector-icons/Ionicons'; import { logger } from '../../../utils/common'; - +import { CometChat } from '@cometchat-pro/react-native-chat'; class CometChatMessageHeader extends React.Component { constructor(props) { super(props); @@ -26,7 +26,7 @@ class CometChatMessageHeader extends React.Component { this.MessageHeaderManager = new MessageHeaderManager(); this.MessageHeaderManager.attachListeners(this.updateHeader); - if (this.props.type === enums.TYPE_USER) { + if (this.props.type === CometChat.RECEIVER_TYPE.USER) { this.setStatusForUser(); } else { this.setStatusForGroup(); @@ -40,12 +40,12 @@ class CometChatMessageHeader extends React.Component { this.MessageHeaderManager.attachListeners(this.updateHeader); if ( - this.props.type === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && prevProps.item.uid !== this.props.item.uid ) { this.setStatusForUser(); } else if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && (prevProps.item.guid !== this.props.item.guid || (prevProps.item.guid === this.props.item.guid && prevProps.item.membersCount !== this.props.item.membersCount)) @@ -61,22 +61,22 @@ class CometChatMessageHeader extends React.Component { this.MessageHeaderManager.removeListeners(); this.MessageHeaderManager = null; } - + /** - * handler for set status for user i.e online/offline - * @param - */ + * handler for set status for user i.e online/offline + * @param + */ setStatusForUser = () => { try { let { status } = this.props.item; const presence = - this.props.item.status === enums.STATUS_TYPE_ONLINE - ? enums.STATUS_TYPE_ONLINE - : enums.STATUS_TYPE_OFFLINE; + this.props.item.status === CometChat.USER_STATUS.ONLINE + ? CometChat.USER_STATUS.ONLINE + : CometChat.USER_STATUS.OFFLINE; if ( - this.props.item.status === enums.STATUS_TYPE_OFFLINE && + this.props.item.status === CometChat.USER_STATUS.OFFLINE && this.props.item.lastActiveAt ) { status = `Last active at: ${new Date( @@ -89,7 +89,7 @@ class CometChatMessageHeader extends React.Component { minute: 'numeric', hour12: true, })}`; - } else if (this.props.item.status === enums.STATUS_TYPE_OFFLINE) { + } else if (this.props.item.status === CometChat.USER_STATUS.OFFLINE) { status = 'offline'; } @@ -98,11 +98,11 @@ class CometChatMessageHeader extends React.Component { logger(error); } }; - + /** * handler for set status for group i.e memberCount - * @param - */ + * @param + */ setStatusForGroup = () => { try { const status = `${this.props.item.membersCount} Members`; @@ -111,19 +111,22 @@ class CometChatMessageHeader extends React.Component { logger(error); } }; - + /** * handler for updation of header based on key. * @param key: action name * @param item: item object * @param groupUser: groupUser object - */ + */ updateHeader = (key, item, groupUser) => { try { switch (key) { case enums.USER_ONLINE: case enums.USER_OFFLINE: { - if (this.props.type === enums.TYPE_USER && this.props.item.uid === item.uid) { + if ( + this.props.type === CometChat.RECEIVER_TYPE.USER && + this.props.item.uid === item.uid + ) { this.setState({ status: item.status, presence: item.status }); } break; @@ -132,7 +135,7 @@ class CometChatMessageHeader extends React.Component { case enums.GROUP_MEMBER_BANNED: case enums.GROUP_MEMBER_LEFT: if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && this.props.item.guid === item.guid && this.props.loggedInUser.uid !== groupUser.uid ) { @@ -143,7 +146,7 @@ class CometChatMessageHeader extends React.Component { break; case enums.GROUP_MEMBER_JOINED: if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && this.props.item.guid === item.guid ) { const membersCount = parseInt(item.membersCount); @@ -153,7 +156,7 @@ class CometChatMessageHeader extends React.Component { break; case enums.GROUP_MEMBER_ADDED: if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && this.props.item.guid === item.guid ) { const membersCount = parseInt(item.membersCount); @@ -163,14 +166,14 @@ class CometChatMessageHeader extends React.Component { break; case enums.TYPING_STARTED: { if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && this.props.type === item.receiverType && this.props.item.guid === item.receiverId ) { this.setState({ status: `${item.sender.name} is typing...` }); this.props.actionGenerated(actions.SHOW_REACTION, item); } else if ( - this.props.type === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && this.props.type === item.receiverType && this.props.item.uid === item.sender.uid ) { @@ -181,14 +184,14 @@ class CometChatMessageHeader extends React.Component { } case enums.TYPING_ENDED: { if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && this.props.type === item.receiverType && this.props.item.guid === item.receiverId ) { this.setStatusForGroup(); this.props.actionGenerated(actions.STOP_REACTION, item); } else if ( - this.props.type === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && this.props.type === item.receiverType && this.props.item.uid === item.sender.uid ) { @@ -214,7 +217,7 @@ class CometChatMessageHeader extends React.Component { let image; let userName; let presence; - if (this.props.type === enums.TYPE_USER) { + if (this.props.type === CometChat.RECEIVER_TYPE.USER) { image = this.props.item.avatar; userName = this.props.item.name; presence = ( @@ -253,11 +256,17 @@ class CometChatMessageHeader extends React.Component { ); - if (this.props.item.blockedByMe === true || this.props.audioCall === false) { + if ( + this.props.item.blockedByMe === true || + this.props.audioCall === false + ) { audioCallBtn = null; } - if (this.props.item.blockedByMe === true || this.props.videoCall === false) { + if ( + this.props.item.blockedByMe === true || + this.props.videoCall === false + ) { videoCallBtn = null; } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/audioCall.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/audioCall.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/audioCall.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/audioCall.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/sidebar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/sidebar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/sidebar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/sidebar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/userInfo.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/userInfo.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/userInfo.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/userInfo.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/videoCall.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/videoCall.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/resources/videoCall.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/resources/videoCall.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageHeader/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageHeader/styles.js diff --git a/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/MessageFilter.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/MessageFilter.js new file mode 100644 index 0000000..12de903 --- /dev/null +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/MessageFilter.js @@ -0,0 +1,37 @@ +import * as enums from '../../../utils/enums'; +import { CometChat } from '@cometchat-pro/react-native-chat'; +export default class MessageFilter { + categories = {}; + + types = null; + + constructor() { + this.categories = { + [CometChat.CATEGORY_MESSAGE]: CometChat.CATEGORY_MESSAGE, + [CometChat.CATEGORY_CUSTOM]: CometChat.CATEGORY_CUSTOM, + [CometChat.CATEGORY_ACTION]: CometChat.CATEGORY_ACTION, + [CometChat.CATEGORY_CALL]: CometChat.CATEGORY_CALL, + }; + + this.types = { + [CometChat.MESSAGE_TYPE.TEXT]: CometChat.MESSAGE_TYPE.TEXT, + [CometChat.MESSAGE_TYPE.IMAGE]: CometChat.MESSAGE_TYPE.IMAGE, + [CometChat.MESSAGE_TYPE.VIDEO]: CometChat.MESSAGE_TYPE.VIDEO, + [CometChat.MESSAGE_TYPE.AUDIO]: CometChat.MESSAGE_TYPE.AUDIO, + [CometChat.MESSAGE_TYPE.FILE]: CometChat.MESSAGE_TYPE.FILE, + [enums.CUSTOM_TYPE_POLL]: enums.CUSTOM_TYPE_POLL, + [enums.CUSTOM_TYPE_STICKER]: enums.CUSTOM_TYPE_STICKER, + [enums.ACTION_TYPE_GROUPMEMBER]: enums.ACTION_TYPE_GROUPMEMBER, + [CometChat.CALL_TYPE.AUDIO]: CometChat.CALL_TYPE.AUDIO, + [CometChat.CALL_TYPE.VIDEO]: CometChat.CALL_TYPE.VIDEO, + }; + } + + getCategories = () => { + return Object.keys(this.categories); + }; + + getTypes = () => { + return Object.keys(this.types); + }; +} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/controller.js similarity index 74% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/controller.js index 1f062d1..747ac5f 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/controller.js @@ -15,23 +15,23 @@ export class MessageListManager { limit = 30; categories = [ - enums.CATEGORY_MESSAGE, - enums.CATEGORY_CUSTOM, - enums.CATEGORY_ACTION, - enums.CATEGORY_CALL, + CometChat.CATEGORY_MESSAGE, + CometChat.CATEGORY_CUSTOM, + CometChat.CATEGORY_ACTION, + CometChat.CATEGORY_CALL, ]; types = [ - enums.MESSAGE_TYPE_TEXT, - enums.MESSAGE_TYPE_IMAGE, - enums.MESSAGE_TYPE_VIDEO, - enums.MESSAGE_TYPE_AUDIO, - enums.MESSAGE_TYPE_FILE, + CometChat.MESSAGE_TYPE.TEXT, + CometChat.MESSAGE_TYPE.IMAGE, + CometChat.MESSAGE_TYPE.VIDEO, + CometChat.MESSAGE_TYPE.AUDIO, + CometChat.MESSAGE_TYPE.FILE, enums.CUSTOM_TYPE_POLL, enums.CUSTOM_TYPE_STICKER, enums.ACTION_TYPE_GROUPMEMBER, - enums.CALL_TYPE_AUDIO, - enums.CALL_TYPE_VIDEO, + CometChat.CALL_TYPE.AUDIO, + CometChat.CALL_TYPE.VIDEO, ]; msgListenerId = `message_${new Date().getTime()}`; @@ -49,7 +49,7 @@ export class MessageListManager { const categories = messageFilterManager.getCategories(); const types = messageFilterManager.getTypes(); - if (type === enums.TYPE_USER) { + if (type === CometChat.RECEIVER_TYPE.USER) { if (this.parentMessageId) { this.messageRequest = new CometChat.MessagesRequestBuilder() .setUID(item.uid) @@ -67,7 +67,7 @@ export class MessageListManager { .setLimit(this.limit) .build(); } - } else if (type === enums.TYPE_GROUP) { + } else if (type === CometChat.RECEIVER_TYPE.GROUP) { if (this.parentMessageId) { this.messageRequest = new CometChat.MessagesRequestBuilder() .setGUID(item.guid) @@ -117,13 +117,19 @@ export class MessageListManager { onMessageEdited: (editedMessage) => { callback(enums.MESSAGE_EDITED, editedMessage); }, - }) + }), ); CometChat.addGroupListener( this.groupListenerId, new CometChat.GroupListener({ - onGroupMemberScopeChanged: (message, changedUser, newScope, oldScope, changedGroup) => { + onGroupMemberScopeChanged: ( + message, + changedUser, + newScope, + oldScope, + changedGroup, + ) => { callback(enums.GROUP_MEMBER_SCOPE_CHANGED, message, changedGroup, { user: changedUser, scope: newScope, @@ -142,24 +148,56 @@ export class MessageListManager { ); }, onGroupMemberBanned: (message, bannedUser, bannedBy, bannedFrom) => { - callback(enums.GROUP_MEMBER_BANNED, message, bannedFrom, { user: bannedUser },bannedBy); + callback( + enums.GROUP_MEMBER_BANNED, + message, + bannedFrom, + { user: bannedUser }, + bannedBy, + ); }, - onGroupMemberUnbanned: (message, unbannedUser, unbannedBy, unbannedFrom) => { - callback(enums.GROUP_MEMBER_UNBANNED, message, unbannedFrom, { user: unbannedUser },unbannedBy); + onGroupMemberUnbanned: ( + message, + unbannedUser, + unbannedBy, + unbannedFrom, + ) => { + callback( + enums.GROUP_MEMBER_UNBANNED, + message, + unbannedFrom, + { user: unbannedUser }, + unbannedBy, + ); }, - onMemberAddedToGroup: (message, userAdded, userAddedBy, userAddedIn) => { - callback(enums.GROUP_MEMBER_ADDED, message, userAddedIn, { - user: userAdded, - hasJoined: true, - },userAddedBy); + onMemberAddedToGroup: ( + message, + userAdded, + userAddedBy, + userAddedIn, + ) => { + callback( + enums.GROUP_MEMBER_ADDED, + message, + userAddedIn, + { + user: userAdded, + hasJoined: true, + }, + userAddedBy, + ); }, onGroupMemberLeft: (message, leavingUser, group) => { - callback(enums.GROUP_MEMBER_LEFT, message, group, { user: leavingUser }); + callback(enums.GROUP_MEMBER_LEFT, message, group, { + user: leavingUser, + }); }, onGroupMemberJoined: (message, joinedUser, joinedGroup) => { - callback(enums.GROUP_MEMBER_JOINED, message, joinedGroup, { user: joinedUser }); + callback(enums.GROUP_MEMBER_JOINED, message, joinedGroup, { + user: joinedUser, + }); }, - }) + }), ); CometChat.addCallListener( @@ -177,7 +215,7 @@ export class MessageListManager { onOutgoingCallRejected: (call) => { callback(enums.OUTGOING_CALL_REJECTED, call); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/index.js similarity index 92% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/index.js index 35fee2c..9d3e1bd 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/index.js @@ -77,7 +77,7 @@ class CometChatMessageList extends React.PureComponent { const currentMessageStr = JSON.stringify(this.props.messages); if ( - this.props.type === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && prevProps.item.uid !== this.props.item.uid ) { this.decoratorMessage = 'Loading...'; @@ -99,7 +99,7 @@ class CometChatMessageList extends React.PureComponent { this.getMessages(); this.MessageListManager.attachListeners(this.messageUpdated); } else if ( - this.props.type === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && prevProps.item.guid !== this.props.item.guid ) { this.decoratorMessage = 'Loading...'; @@ -140,11 +140,11 @@ class CometChatMessageList extends React.PureComponent { this.MessageListManager.removeListeners(); this.MessageListManager = null; } - + /** * handler for fetching messages for logged in user and previous conversations. * @param scrollToBottom: Event(boolean) - */ + */ getMessages = (scrollToBottom = false) => { //getMessages() here... const actionMessages = []; @@ -170,13 +170,17 @@ class CometChatMessageList extends React.PureComponent { message.getSender().getUid() !== user.getUid() && !message.getReadAt() ) { - if (message.getReceiverType() === enums.TYPE_USER) { + if ( + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER + ) { CometChat.markAsRead( message.getId().toString(), message.getSender().getUid(), message.getReceiverType(), ); - } else if (message.getReceiverType() === enums.TYPE_GROUP) { + } else if ( + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP + ) { CometChat.markAsRead( message.getId().toString(), message.getReceiverId(), @@ -263,22 +267,22 @@ class CometChatMessageList extends React.PureComponent { break; } }; - + /** - * handler for message deleted by logged in user and updations for groups/user. + * handler for message deleted by logged in user and updations for groups/user. * @param message: message object - */ + */ messageDeleted = (message) => { if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiver().guid === this.props.item.guid ) { this.props.actionGenerated(actions.MESSAGE_DELETED, [message]); } else if ( - this.props.type === enums.TYPE_USER && - message.getReceiverType() === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && message.getSender().uid === this.props.item.uid ) { this.props.actionGenerated(actions.MESSAGE_DELETED, [message]); @@ -288,7 +292,7 @@ class CometChatMessageList extends React.PureComponent { /** * handler for when the message is edited by the logged in user. * @param message: message object - */ + */ messageEdited = (message) => { try { const messageList = [...this.props.messages]; @@ -305,21 +309,21 @@ class CometChatMessageList extends React.PureComponent { }; if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiver().guid === this.props.item.guid ) { updateEditedMessage(message); } else if ( - this.props.type === enums.TYPE_USER && - message.getReceiverType() === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && this.loggedInUser.uid === message.getReceiverId() && message.getSender().uid === this.props.item.uid ) { updateEditedMessage(message); } else if ( - this.props.type === enums.TYPE_USER && - message.getReceiverType() === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && this.loggedInUser.uid === message.getSender().uid && message.getReceiverId() === this.props.item.uid ) { @@ -329,11 +333,11 @@ class CometChatMessageList extends React.PureComponent { logger(error); } }; - + /** * handler for updating messageList via newMessageObj * @param message:message object - */ + */ updateEditedMessage = (message) => { const messageList = [...this.props.messages]; @@ -347,16 +351,16 @@ class CometChatMessageList extends React.PureComponent { this.props.actionGenerated(actions.MESSAGE_UPDATED, messageList); } }; - + /** - * Handler if the message is read and delivered. + * Handler if the message is read and delivered. * @param message: message object - */ + */ messageReadAndDelivered = (message) => { // read receipts if ( - message.getReceiverType() === enums.TYPE_USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && message.getSender().getUid() === this.props.item.uid && message.getReceiver() === this.loggedInUser.uid ) { @@ -393,7 +397,7 @@ class CometChatMessageList extends React.PureComponent { } } } else if ( - message.getReceiverType() === enums.TYPE_GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiver().guid === this.props.item.guid ) { // not implemented @@ -403,13 +407,13 @@ class CometChatMessageList extends React.PureComponent { /** * handler if the message is received * @param message: message object - */ + */ messageReceived = (message) => { try { // new messages if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiverId() === this.props.item.guid ) { if (!message.getReadAt()) { @@ -422,8 +426,8 @@ class CometChatMessageList extends React.PureComponent { this.props.actionGenerated(actions.MESSAGE_RECEIVED, [message]); } else if ( - this.props.type === enums.TYPE_USER && - message.getReceiverType() === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && message.getSender().uid === this.props.item.uid ) { if (!message.getReadAt()) { @@ -444,13 +448,13 @@ class CometChatMessageList extends React.PureComponent { /** * handler for when a custom message is received. * @param message: message object - */ + */ customMessageReceived = (message) => { try { // new messages if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiverId() === this.props.item.guid ) { if (!message.getReadAt()) { @@ -478,8 +482,8 @@ class CometChatMessageList extends React.PureComponent { ]); } } else if ( - this.props.type === enums.TYPE_USER && - message.getReceiverType() === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && message.getSender().uid === this.props.item.uid ) { if (!message.getReadAt()) { @@ -510,11 +514,11 @@ class CometChatMessageList extends React.PureComponent { logger(error); } }; - + /** * Handler for adding meta data to custom data i.e polls. * @param message: message object - */ + */ addMetadataToCustomData = (message) => { const { customData } = message.data; const { options } = customData; @@ -543,16 +547,16 @@ class CometChatMessageList extends React.PureComponent { metadata: { '@injected': { extensions: { polls } } }, }; }; - + /** * call updated * @param message: message object - */ + */ callUpdated = (message) => { try { if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiverId() === this.props.item.guid ) { if (!message.getReadAt()) { @@ -565,8 +569,8 @@ class CometChatMessageList extends React.PureComponent { this.props.actionGenerated(actions.CALL_UPDATED, message); } else if ( - this.props.type === enums.TYPE_USER && - message.getReceiverType() === enums.TYPE_USER && + this.props.type === CometChat.RECEIVER_TYPE.USER && + message.getReceiverType() === CometChat.RECEIVER_TYPE.USER && message.getSender().uid === this.props.item.uid ) { if (!message.getReadAt()) { @@ -583,20 +587,20 @@ class CometChatMessageList extends React.PureComponent { logger(error); } }; - + /** - * handler when the group is updated and reciever type is group + * handler when the group is updated and reciever type is group * @param key: action name * @param message: message object * @param grup: group object - * @param options: options - */ + * @param options: options + */ groupUpdated = (key, message, group, options) => { try { if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiver().guid === this.props.item.guid ) { if (!message.getReadAt()) { @@ -619,20 +623,20 @@ class CometChatMessageList extends React.PureComponent { logger(error); } }; - + /** * On message click handler * @param message: object message - */ + */ handleClick = (message) => { this.props.onItemClick(message, 'message'); }; - + /** * handler for fetching sender message component of different types * @param message:message object * @param key - */ + */ getSenderMessageComponent = (message, key) => { let component; @@ -731,8 +735,8 @@ class CometChatMessageList extends React.PureComponent { * handler for fetching receiver message component of different types * @param message: message object * @param key: key object - */ - + */ + getReceiverMessageComponent = (message, key) => { let component; @@ -824,12 +828,12 @@ class CometChatMessageList extends React.PureComponent { } return component; }; - + /** - * handler for fetching custom message component from sender. + * handler for fetching custom message component from sender. * @param message: message object * @param key: key object - */ + */ getSenderCustomMessageComponent = (message, key) => { let component; @@ -878,11 +882,11 @@ class CometChatMessageList extends React.PureComponent { } return component; }; - + /** - * handler for fetching custom message component from receiver - * @param - */ + * handler for fetching custom message component from receiver + * @param + */ getReceiverCustomMessageComponent = (message, key) => { let component; if (Object.prototype.hasOwnProperty.call(message, 'deletedAt')) { @@ -931,12 +935,12 @@ class CometChatMessageList extends React.PureComponent { return component; }; - + /** * handler for fetching call message component (action message bubble) * @param message:message object * @param key - */ + */ getCallMessageComponent = (message, key) => { return ( @@ -948,11 +952,11 @@ class CometChatMessageList extends React.PureComponent { /> ); }; - + /** - * get action message component - * @param - */ + * get action message component + * @param + */ getActionMessageComponent = (message, key) => { let component = null; if (message.message) { @@ -978,12 +982,12 @@ class CometChatMessageList extends React.PureComponent { return component; }; - + /** - * get component for all fetching all components(parent function) - * @param message: object message + * get component for all fetching all components(parent function) + * @param message: object message * @param key - */ + */ getComponent = (message, key) => { let component; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/styles.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/styles.js index ddf6ca6..3a8e36b 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/styles.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageList/styles.js @@ -6,8 +6,8 @@ export default StyleSheet.create({ width: '100%', flex: 1, position: 'relative', - alignItems:"center", - justifyContent:"center" + alignItems: 'center', + justifyContent: 'center', }, listWrapperStyle: { flexDirection: 'column', diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/controller.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/controller.js index 192baab..067ada4 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/controller.js @@ -12,7 +12,7 @@ export class MessageThreadManager { onMessageEdited: (editedMessage) => { callback(enums.MESSAGE_EDITED, editedMessage); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/index.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/index.js index 02e5997..7272777 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/index.js @@ -104,10 +104,10 @@ class CometChatMessageThread extends React.PureComponent { } /** - * initiated if parent message is edited + * initiated if parent message is edited * @param key:enums type * @param message: message object - */ + */ listenerCallback = (key, message) => { switch (key) { case enums.MESSAGE_EDITED: @@ -117,11 +117,11 @@ class CometChatMessageThread extends React.PureComponent { break; } }; - + /** * handler implememted if the parent message of thread is edited and updates it. - * @param - */ + * @param + */ parentMessageEdited = (message) => { try { const parentMessage = { ...this.props.parentMessage }; @@ -232,20 +232,20 @@ class CometChatMessageThread extends React.PureComponent { logger(error); } }; - - /** + + /** * Updates messageToBeEdited with received message. * @param message: message object. - */ + */ editMessage = (message) => { this.setState({ messageToBeEdited: message }); }; - - /** - * Updates the messageList via newMessageObject if received message's id exists in messageList. - * Generates action -> UPDATE_THREAD_MESSAGE. + + /** + * Updates the messageList via newMessageObject if received message's id exists in messageList. + * Generates action -> UPDATE_THREAD_MESSAGE. * @param message: message object - */ + */ messageEdited = (message) => { try { @@ -268,19 +268,19 @@ class CometChatMessageThread extends React.PureComponent { } }; - /** + /** * sets messageToBeEdited to an empty string - * @param - */ + * @param + */ clearEditPreview = () => { this.setState({ messageToBeEdited: '' }); }; - + /** * handler implemented to delete message . * @param message: message object - */ + */ deleteMessage = (message) => { try { @@ -305,11 +305,11 @@ class CometChatMessageThread extends React.PureComponent { logger(error); } }; - - /** + + /** * handler for smart reply via checkMessageForExtensionsData() * @param messages: messages object - */ + */ smartReplyPreview = (messages) => { try { @@ -386,12 +386,12 @@ class CometChatMessageThread extends React.PureComponent { logger(error); } }; - + /** * handler for fetching sender message component of different types * @param message:message object * @param key - */ + */ getSenderMessageComponent = (message, key) => { let component; @@ -470,12 +470,12 @@ class CometChatMessageThread extends React.PureComponent { } return component; }; - + /** * handler for fetching receiver message component of different types * @param message: message object * @param key: key object - */ + */ getReceiverMessageComponent = (message, key) => { let component; @@ -555,11 +555,11 @@ class CometChatMessageThread extends React.PureComponent { } return component; }; - - /** + + /** * handler for fetching receiver/sender message component of different types * @param message: message object - */ + */ getMessageComponent = (message) => { let component = null; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/style.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/style.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageThread/style.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessageThread/style.js diff --git a/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessages/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessages/index.js new file mode 100644 index 0000000..29aa123 --- /dev/null +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessages/index.js @@ -0,0 +1,877 @@ +/* eslint-disable react/no-unused-state */ +/* eslint-disable react/no-did-update-set-state */ +import React from 'react'; +import { + View, + SafeAreaView, + Modal, + Dimensions, + KeyboardAvoidingView, +} from 'react-native'; +import { CometChat } from '@cometchat-pro/react-native-chat'; +import _ from 'lodash'; +import { CometChatUserDetails } from '../../Users'; +import { + CometChatLiveReactions, + CometChatMessageHeader, + CometChatMessageList, + CometChatMessageComposer, + CometChatMessageActions, + CometChatMessageThread, +} from '../index'; +import { CometChatGroupDetails } from '../../Groups'; + +import theme from '../../../resources/theme'; +import { CometChatManager } from '../../../utils/controller'; +import * as enums from '../../../utils/enums'; +import { checkMessageForExtensionsData } from '../../../utils/common'; + +import BottomSheet from 'reanimated-bottom-sheet'; +import style from './styles'; + +class CometChatMessages extends React.PureComponent { + loggedInUser = null; + constructor(props) { + super(props); + const { route } = props; + const params = route?.params || props; + this.state = { + messageList: [], + scrollToBottom: true, + messageToBeEdited: '', + replyPreview: null, + tab: 'conversations', + item: params.item, + liveReaction: false, + messageToReact: null, + threadMessageView: false, + threadMessageType: null, + threadMessageItem: {}, + threadMessageParent: {}, + userDetailVisible: false, + groupDetailVisible: false, + user: params.type === 'user' ? params.item : null, + }; + + this.composerRef = React.createRef(); + this.sheetRef = React.createRef(null); /// //ref here + + this.reactionName = props.reaction || 'heart'; + this.theme = { ...theme, ...params.theme }; + } + + componentDidMount() { + new CometChatManager() + .getLoggedInUser() + .then((user) => { + this.loggedInUser = user; + }) + .catch(() => { + // console.log('[CometChatMessages] getLoggedInUser error', error); + }); + } + + componentDidUpdate(prevProps, prevState) { + const { route: prevRoute } = prevProps; + const { route } = this.props; + const params = route?.params || this.props; + const prevParams = prevRoute?.params || prevProps; + + if (!prevState.threadMessageView && this.state.threadMessageView) { + this.sheetRef.current.snapTo(0); + } + if (params.type === 'user' && prevParams.item.uid !== params.item.uid) { + this.setState({ + messageList: [], + scrollToBottom: true, + messageToBeEdited: '', + }); + // this.setUserDetails() + } else if ( + params.type === 'group' && + prevParams.item.guid !== params.item.guid + ) { + this.setState({ + messageList: [], + scrollToBottom: true, + messageToBeEdited: '', + }); + } else if (prevParams.type !== params.type) { + this.setState({ + messageList: [], + scrollToBottom: true, + messageToBeEdited: '', + }); + } else if ( + prevState.composedThreadMessage !== this.state.composedThreadMessage + ) { + this.updateReplyCount(this.state.composedThreadMessage); + } else if (prevParams.callMessage !== params.callMessage) { + if (prevParams.callMessage.id !== params.callMessage.id) { + this.actionHandler('callUpdated', params.callMessage); + } + } + } + + deleteGroup = (group) => { + this.setState( + { + groupDetailVisible: false, + groupToDelete: group, + item: {}, + type: 'group', + viewDetailScreen: false, + }, + () => { + this.props.route?.params?.actionGenerated('groupDeleted', group) || + this.props.actionGenerated('groupDeleted', group); + this.props.navigation?.goBack(); + }, + ); + }; + + leaveGroup = (group) => { + this.setState( + { + groupDetailVisible: false, + groupToLeave: group, + item: {}, + type: 'group', + viewDetailScreen: false, + }, + () => { + this.props.navigation?.goBack(); + }, + ); + }; + + updateMembersCount = (item, count) => { + const { route } = this.props; + const params = route?.params || this.props; + + const group = { ...this.state.item, membersCount: count }; + this.setState({ item: group, groupToUpdate: group }); + params.actionGenerated('membersUpdated', item, count); + }; + + actionHandler = (action, messages, key, group, options) => { + const { route } = this.props; + const params = route?.params || this.props; + + switch (action) { + case 'customMessageReceived': + case 'messageReceived': + { + const message = messages[0]; + if (message.parentMessageId) { + this.updateReplyCount(messages); + } else { + this.smartReplyPreview(messages); + this.appendMessage(messages); + } + } + break; + case 'groupDeleted': + this.deleteGroup(messages); + break; + case 'leftGroup': + this.leaveGroup(messages); + break; + case 'membersUpdated': + this.updateMembersCount(messages, key); + break; + case 'messageRead': + params.actionGenerated(action, messages); + break; + case 'messageComposed': { + this.appendMessage(messages); + params.actionGenerated('messageComposed', messages); + break; + } + case 'viewMessageThread': + this.setState({ messageToReact: null }, () => { + this.viewMessageThread(messages); + // route.params.actionGenerated('viewMessageThread', messages); + }); + break; + case 'closeThreadClicked': + this.closeThreadMessages(); + break; + case 'messageUpdated': { + this.updateMessages(messages); + break; + } + case 'messageFetched': + this.prependMessages(messages); + break; + case 'messageFetchedAgain': + this.prependMessagesAndScrollBottom(messages); + break; + case 'messageDeleted': + this.removeMessages(messages); + break; + case 'threadMessageDeleted': + params.actionGenerated('messageDeleted', messages); + break; + case 'deleteMessage': + this.setState({ messageToReact: null }); + this.deleteMessage(messages); + break; + case 'editMessage': + this.setState({ messageToReact: null }); + this.editMessage(messages); + break; + case 'messageEdited': + this.messageEdited(messages); + break; + case 'clearEditPreview': + this.clearEditPreview(); + break; + case 'groupUpdated': + this.groupUpdated(messages, key, group, options); + break; + case 'callUpdated': + this.callUpdated(messages); + break; + case 'pollAnswered': + this.updatePollMessage(messages); + break; + case 'pollCreated': + this.appendPollMessage(messages); + break; + case 'viewActualImage': + params.actionGenerated('viewActualImage', messages); + break; + case 'audioCall': + case 'videoCall': + case 'menuClicked': + params.actionGenerated(action); + break; + case 'sendReaction': + this.toggleReaction(true); + break; + case 'showReaction': + this.showReaction(messages); + break; + case 'stopReaction': + this.toggleReaction(false); + break; + case 'reactToMessage': + this.reactToMessage(messages); + break; + case 'goBack': + this.props.navigation?.goBack(); + break; + case 'closeDetail': + this.setState({ userDetailVisible: false, groupDetailVisible: false }); + break; + case 'viewDetail': + if (params.type === 'user') { + this.setState({ userDetailVisible: true }); + } else { + this.setState({ groupDetailVisible: true }); + } + break; + case 'blockUser': + this.blockUser(); + break; + case 'unblockUser': + this.unblockUser(); + break; + case 'closeMessageActions': + this.setState({ messageToReact: null }); + break; + case 'openMessageActions': + this.setState({ messageToReact: messages }); + break; + case 'updateThreadMessage': + this.updateThreadMessage(messages[0], key); + break; + case 'threadMessageComposed': + this.onThreadMessageComposed(messages); + params.actionGenerated('threadMessageComposed', messages); + // this.updateLastMessage(item[0]); + break; + case 'memberScopeChanged': + this.memberScopeChanged(messages); + break; + case 'membersRemoved': + this.membersRemoved(messages); + break; + case 'membersAdded': + this.membersAdded(messages); + break; + case 'memberBanned': + this.memberBanned(messages); + break; + case 'memberUnbanned': + this.memberUnbanned(messages); + break; + default: + break; + } + }; + + memberUnbanned = (members) => { + const messageList = [...this.state.messageList]; + let filteredMembers = _.uniqBy(members, 'id'); + filteredMembers.forEach((eachMember) => { + const message = `${this.loggedInUser.name} unbanned ${eachMember.name}`; + const sentAt = (new Date() / 1000) | 0; + const messageObj = { + category: 'action', + message: message, + type: enums.ACTION_TYPE_GROUPMEMBER, + sentAt: sentAt, + }; + messageList.push(messageObj); + }); + + this.setState({ messageList: messageList }); + }; + + membersAdded = (members) => { + const messageList = [...this.state.messageList]; + members.forEach((eachMember) => { + const message = `${this.loggedInUser.name} added ${eachMember.name}`; + const sentAt = (new Date() / 1000) | 0; + const messageObj = { + category: 'action', + message, + type: enums.ACTION_TYPE_GROUPMEMBER, + sentAt, + }; + messageList.push(messageObj); + }); + + this.setState({ messageList: messageList }); + }; + + membersRemoved = (members) => { + const messageList = [...this.state.messageList]; + let filteredMembers = _.uniqBy(members, 'id'); + filteredMembers.forEach((eachMember) => { + const message = `${this.loggedInUser.name} kicked ${eachMember.name}`; + const sentAt = (new Date() / 1000) | 0; + const messageObj = { + category: 'action', + message: message, + type: enums.ACTION_TYPE_GROUPMEMBER, + sentAt: sentAt, + }; + messageList.push(messageObj); + }); + + this.setState({ messageList: messageList }); + }; + + memberScopeChanged = (members) => { + const messageList = [...this.state.messageList]; + let filteredMembers = _.uniqBy(members, 'id'); + filteredMembers.forEach((eachMember) => { + const message = `${this.loggedInUser.name} made ${eachMember.name} ${eachMember.scope}`; + const sentAt = (new Date() / 1000) | 0; + const messageObj = { + category: 'action', + message: message, + type: enums.ACTION_TYPE_GROUPMEMBER, + sentAt: sentAt, + }; + messageList.push(messageObj); + }); + + this.setState({ messageList: messageList }); + }; + + memberBanned = (members) => { + const messageList = [...this.state.messageList]; + members.forEach((eachMember) => { + const message = `${this.loggedInUser.name} banned ${eachMember.name}`; + const sentAt = (new Date() / 1000) | 0; + const messageObj = { + category: 'action', + message, + type: enums.ACTION_TYPE_GROUPMEMBER, + sentAt, + }; + messageList.push(messageObj); + }); + + this.setState({ messageList: messageList }); + }; + + closeThreadMessages = () => { + this.setState({ viewDetailScreen: false, threadMessageView: false }); + }; + + viewMessageThread = (parentMessage) => { + const { route } = this.props; + const params = route?.params || this.props; + const message = { ...parentMessage }; + const threadItem = { ...this.state.item }; + this.setState({ + threadMessageView: true, + threadMessageParent: message, + threadMessageItem: threadItem, + threadMessageType: params.type, + viewDetailScreen: false, + }); + }; + + onThreadMessageComposed = (composedMessage) => { + const { route } = this.props; + const params = route?.params || this.props; + + if (params.type !== this.state.threadMessageType) { + return false; + } + + if ( + (this.state.threadMessageType === 'group' && + this.state.item.guid !== this.state.threadMessageItem.guid) || + (this.state.threadMessageType === 'user' && + this.state.item.uid !== this.state.threadMessageItem.uid) + ) { + return false; + } + + const message = { ...composedMessage }; + this.setState({ composedThreadMessage: message }); + }; + + blockUser = () => { + const { route } = this.props; + const params = route?.params || this.props; + + const usersList = [this.state.item.uid]; + CometChatManager.blockUsers(usersList) + .then(() => { + this.setState({ user: { ...this.state.item, blockedByMe: true } }); + params.actionGenerated('blockUser'); + }) + .catch((error) => { + console.log('Blocking user fails with error', error); + }); + }; + + unblockUser = () => { + const { route } = this.props; + const params = route?.params || this.props; + + const usersList = [this.state.item.uid]; + CometChatManager.unblockUsers(usersList) + .then(() => { + this.setState({ user: { ...this.state.item, blockedByMe: false } }); + params.actionGenerated('unblockUser'); + }) + .catch((error) => { + console.log('unblocking user fails with error', error); + }); + }; + + toggleReaction = (flag) => { + this.setState({ liveReaction: flag }); + }; + + showReaction = (reaction) => { + if (!Object.prototype.hasOwnProperty.call(reaction, 'metadata')) { + return false; + } + + if ( + !Object.prototype.hasOwnProperty.call(reaction.metadata, 'type') || + !Object.prototype.hasOwnProperty.call(reaction.metadata, 'reaction') + ) { + return false; + } + + if ( + !Object.prototype.hasOwnProperty.call( + enums.LIVE_REACTIONS, + reaction.metadata.reaction, + ) + ) { + return false; + } + + if (reaction.metadata.type === enums.LIVE_REACTION_KEY) { + this.reactionName = reaction.metadata.reaction; + this.setState({ liveReaction: true }); + } + }; + + updateThreadMessage = (message, action) => { + if (this.state.threadMessageView === false) { + return false; + } + + if (action === 'delete') { + this.setState({ + threadMessageParent: { ...message }, + threadMessageView: false, + }); + } else { + this.setState({ threadMessageParent: { ...message } }); + } + }; + + deleteMessage = (message) => { + const { route } = this.props; + const params = route?.params || this.props; + + const messageId = message.id; + CometChat.deleteMessage(messageId) + .then((deletedMessage) => { + this.removeMessages([deletedMessage]); + + const messageList = [...this.state.messageList]; + const messageKey = messageList.findIndex((m) => m.id === message.id); + + this.actionHandler('updateThreadMessage', [deletedMessage], 'delete'); + params.actionGenerated( + 'updateThreadMessage', + [deletedMessage], + 'delete', + ); + + if (messageList.length - messageKey === 1 && !message.replyCount) { + params.actionGenerated('messageDeleted', [deletedMessage]); + } + }) + .catch(() => {}); + }; + + editMessage = (message) => { + this.setState({ messageToBeEdited: message, replyPreview: null }); + }; + + messageEdited = (message) => { + const { route } = this.props; + const params = route?.params || this.props; + + const messageList = [...this.state.messageList]; + const messageKey = messageList.findIndex((m) => m.id === message.id); + if (messageKey > -1) { + const messageObj = messageList[messageKey]; + + const newMessageObj = { ...messageObj, ...message }; + + messageList.splice(messageKey, 1, newMessageObj); + this.updateMessages(messageList); + + params.actionGenerated('updateThreadMessage', [newMessageObj], 'edit'); + + if (messageList.length - messageKey === 1 && !message.replyCount) { + params.actionGenerated('messageEdited', [newMessageObj]); + } + } + }; + + updatePollMessage = (message) => { + const messageList = [...this.state.messageList]; + const messageId = message.poll.id; + const messageKey = messageList.findIndex((m) => m.id === messageId); + if (messageKey > -1) { + const messageObj = messageList[messageKey]; + + const metadataObj = { + '@injected': { extensions: { polls: message.poll } }, + }; + + const newMessageObj = { ...messageObj, metadata: metadataObj }; + + messageList.splice(messageKey, 1, newMessageObj); + this.updateMessages(messageList); + } + }; + + appendPollMessage = (messages) => { + this.appendMessage(messages); + }; + + // messages are deleted + removeMessages = (messages) => { + const deletedMessage = messages[0]; + const messageList = [...this.state.messageList]; + + const messageKey = messageList.findIndex( + (message) => message.id === deletedMessage.id, + ); + if (messageKey > -1) { + const messageObj = { ...messageList[messageKey] }; + const newMessageObj = { ...messageObj, ...deletedMessage }; + + messageList.splice(messageKey, 1, newMessageObj); + this.setState({ messageList: messageList, scrollToBottom: false }); + } + }; + + // messages are fetched from backend + prependMessages = (messages) => { + const messageList = [...messages, ...this.state.messageList]; + this.setState({ messageList, scrollToBottom: false }); + }; + + prependMessagesAndScrollBottom = (messages) => { + const messageList = [...messages, ...this.state.messageList]; + this.setState({ messageList, scrollToBottom: true }); + }; + + // message is received or composed & sent + appendMessage = (newMessages = []) => { + if ( + this.state.messageList && + newMessages.length && + this.state.messageList.length && + this.state.messageList.length && + newMessages[newMessages.length - 1].id === + this.state.messageList[this.state.messageList.length - 1].id + ) { + return; + } + let messages = [...this.state.messageList]; + // messages = messages.reverse(); + messages = messages.concat(newMessages); + messages = _.uniqBy(messages, 'id'); + this.setState({ messageList: messages, scrollToBottom: true }); + }; + + // message status is updated + updateMessages = (messages) => { + this.setState({ messageList: messages, scrollToBottom: false }); + }; + + groupUpdated = (message, key, group, options) => { + const { route } = this.props; + const params = route?.params || this.props; + + switch (key) { + case enums.GROUP_MEMBER_BANNED: + case enums.GROUP_MEMBER_KICKED: { + if (options.user.uid === this.loggedInUser.uid) { + this.setState({ item: {}, type: 'group', viewDetailScreen: false }); + } + break; + } + case enums.GROUP_MEMBER_SCOPE_CHANGED: { + if (options.user.uid === this.loggedInUser.uid) { + const newObj = { ...this.state.item, scope: options.scope }; + this.setState({ + item: newObj, + type: 'group', + viewDetailScreen: false, + }); + } + break; + } + default: + break; + } + + params.actionGenerated('groupUpdated', message, key, group, options); + }; + + callUpdated = (message) => { + const { route } = this.props; + const params = route?.params || this.props; + + this.appendMessage([message]); + }; + + updateReplyCount = (messages) => { + const receivedMessage = messages[0]; + + const messageList = [...this.state.messageList]; + const messageKey = messageList.findIndex( + (m) => m.id === receivedMessage.parentMessageId, + ); + if (messageKey > -1) { + const messageObj = messageList[messageKey]; + let replyCount = Object.prototype.hasOwnProperty.call( + messageObj, + 'replyCount', + ) + ? messageObj.replyCount + : 0; + replyCount += 1; + const newMessageObj = { ...messageObj, replyCount }; + + messageList.splice(messageKey, 1, newMessageObj); + this.setState({ messageList, scrollToBottom: false }); + } + }; + + smartReplyPreview = (messages) => { + const { route } = this.props; + const params = route?.params || this.props; + + const message = messages[0]; + if ( + message.sender.uid === params.loggedInUser.uid || + message.category === CometChat.MESSAGE_TYPE.CUSTOM + ) { + return false; + } + + const smartReplyData = checkMessageForExtensionsData( + message, + 'smart-reply', + ); + if ( + smartReplyData && + Object.prototype.hasOwnProperty.call(smartReplyData, 'error') === false + ) { + this.setState({ replyPreview: message }); + } else { + this.setState({ replyPreview: null }); + } + }; + + clearEditPreview = () => { + this.setState({ messageToBeEdited: '' }); + }; + + reactToMessage = (message) => { + this.setState({ messageToReact: message }); + }; + + render() { + const { route } = this.props; + const params = route?.params || this.props; + + let messageComposer = ( + { + this.composerRef = el; + }} + theme={this.theme} + item={params.type === 'user' ? this.state.user : this.state.item} + type={params.type} + // widgetsettings={route.params.widgetsettings} + loggedInUser={this.loggedInUser} + messageToBeEdited={this.state.messageToBeEdited} + replyPreview={this.state.replyPreview} + reaction={this.reactionName} + messageToReact={this.state.messageToReact} + actionGenerated={this.actionHandler} + /> + ); + + let liveReactionView = null; + if (this.state.liveReaction) { + liveReactionView = ( + + + + ); + } + + const threadMessageView = ( + + + { + return ( + + + + ); + }} + onCloseEnd={() => { + this.actionHandler('closeThreadClicked'); + }} + /> + + + ); + + return ( + + + {this.state.userDetailVisible ? ( + + ) : null} + {threadMessageView} + + { + this.actionHandler('closeMessageActions'); + }} + /> + + + {liveReactionView} + {messageComposer} + + + ); + } +} + +export default CometChatMessages; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessages/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessages/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessages/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatMessages/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/index.js similarity index 97% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/index.js index 82b1b42..17dbbae 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/index.js @@ -8,7 +8,7 @@ import greyTick from './resources/grey-tick-icon.png'; import styles from './styles'; - const CometChatReadReceipt = (props) => { +const CometChatReadReceipt = (props) => { let ticks = blueDoubleTick; if ( _get(props, 'message.sentAt', null) && diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/resources/blue-double-tick-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/resources/blue-double-tick-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/resources/blue-double-tick-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/resources/blue-double-tick-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-double-tick-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-double-tick-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-double-tick-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-double-tick-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-tick-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-tick-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-tick-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/resources/grey-tick-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReadReceipt/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReadReceipt/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/audioControls.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/audioControls.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/audioControls.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/audioControls.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/index.js similarity index 84% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/index.js index c0684cc..ceaf069 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/index.js @@ -9,18 +9,22 @@ import { CometChatMessageReactions } from '../../Messages/Extensions'; import { CometChatAvatar } from '../../Shared'; import style from './styles'; import AudioControls from './audioControls'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const CometChatReceiverAudioMessageBubble = (props) => { - const message = { ...props.message, messageFrom: enums.MESSAGE_FROM_RECEIVER }; + const message = { + ...props.message, + messageFrom: enums.MESSAGE_FROM_RECEIVER, + }; const viewTheme = { ...theme, ...props.theme }; let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { senderAvatar = { uri: message.sender.avatar }; } return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} @@ -65,4 +69,4 @@ const CometChatReceiverAudioMessageBubble = (props) => { ); }; -export default CometChatReceiverAudioMessageBubble; \ No newline at end of file +export default CometChatReceiverAudioMessageBubble; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverAudioMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/index.js similarity index 76% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/index.js index b3f26a2..b10d098 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/index.js @@ -8,21 +8,25 @@ import style from './styles'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import RNFetchBlob from 'rn-fetch-blob'; import { CometChatAvatar } from '../../Shared'; -import * as enums from '../../../utils/enums' +import * as enums from '../../../utils/enums'; import * as actions from '../../../utils/actions'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const CometChatReceiverFileMessageBubble = (props) => { - const message = { ...props.message, messageFrom: enums.MESSAGE_FROM_RECEIVER }; + const message = { + ...props.message, + messageFrom: enums.MESSAGE_FROM_RECEIVER, + }; let avatarImg = ''; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { avatarImg = { uri: message.sender.avatar }; } - + /** - * Handler for downloading file attachment in local storage. - * @param - */ + * Handler for downloading file attachment in local storage. + * @param + */ const download = () => { let PictureDir = RNFetchBlob.fs.dirs.PictureDir; @@ -54,7 +58,7 @@ const CometChatReceiverFileMessageBubble = (props) => { return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} @@ -75,7 +79,9 @@ const CometChatReceiverFileMessageBubble = (props) => { props.actionGenerated(actions.OPEN_MESSAGE_ACTIONS, message)}> + onLongPress={() => + props.actionGenerated(actions.OPEN_MESSAGE_ACTIONS, message) + }> { - + - + ); }; -export default CometChatReceiverFileMessageBubble; \ No newline at end of file +export default CometChatReceiverFileMessageBubble; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/styles.js similarity index 97% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/styles.js index 5ad3e21..ee96330 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/styles.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverFileMessageBubble/styles.js @@ -73,7 +73,6 @@ export default StyleSheet.create({ mainContainerStyle: { marginBottom: 16 }, messageContainer: { flexDirection: 'row', alignItems: 'flex-start' }, messageContainerStyle: { minWidth: '65%' }, - attachmentNameStyle:{ flex: 1, marginRight: 4 }, + attachmentNameStyle: { flex: 1, marginRight: 4 }, senderNameContainer: { marginBottom: 5 }, }); - diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/index.js similarity index 93% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/index.js index 553994e..52b46dc 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/index.js @@ -9,6 +9,7 @@ import style from './styles'; import theme from '../../../resources/theme'; import * as enums from '../../../utils/enums'; import * as actions from '../../../utils/actions'; +import { CometChat } from '@cometchat-pro/react-native-chat'; function usePrevious(value) { const ref = useRef(); @@ -26,7 +27,7 @@ const CometChatReceiverImageMessageBubble = (props) => { const prevMessage = usePrevious(message); const viewTheme = { ...theme, ...props.theme }; let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { senderAvatar = { uri: message.sender.avatar }; } @@ -71,7 +72,7 @@ const CometChatReceiverImageMessageBubble = (props) => { return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverImageMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/index.js index 60855cd..3723213 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/index.js @@ -16,6 +16,7 @@ import style from './styles'; import { CometChatMessageReactions } from '../../Messages/Extensions'; import * as enums from '../../../utils/enums'; import * as actions from '../../../utils/actions'; +import { CometChat } from '@cometchat-pro/react-native-chat'; function usePrevious(value) { const ref = useRef(); @@ -32,14 +33,14 @@ const CometChatReceiverTextMessageBubble = (props) => { const prevMessage = usePrevious(message); const viewTheme = { ...theme, ...props.theme }; let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { senderAvatar = { uri: message.sender.avatar }; } /** - * Handler that parses text and wraps URLs, phone numbers, emails, social handles, hashtags, and more with Text nodes and onPress handlers. - * @param - */ + * Handler that parses text and wraps URLs, phone numbers, emails, social handles, hashtags, and more with Text nodes and onPress handlers. + * @param + */ const getMessageText = () => { return ( @@ -169,7 +170,7 @@ const CometChatReceiverTextMessageBubble = (props) => { return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverTextMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/index.js similarity index 91% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/index.js index f3261f2..dc54a2a 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/index.js @@ -9,6 +9,7 @@ import style from './styles'; import { CometChatAvatar } from '../../Shared'; import * as actions from '../../../utils/actions'; import * as enums from '../../../utils/enums'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const CometChatReceiverVideoMessageBubble = (props) => { const message = { @@ -18,13 +19,13 @@ const CometChatReceiverVideoMessageBubble = (props) => { const viewTheme = { ...theme, ...props.theme }; const player = createRef(); let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { senderAvatar = { uri: message.sender.avatar }; } return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatReceiverVideoMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/audioControls.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/audioControls.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/audioControls.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/audioControls.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/index.js index 470736e..d7cd874 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/index.js @@ -40,4 +40,4 @@ const CometChatSenderAudioMessageBubble = (props) => { ); }; -export default CometChatSenderAudioMessageBubble; \ No newline at end of file +export default CometChatSenderAudioMessageBubble; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderAudioMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/index.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/index.js index bc65255..b6880bf 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/index.js @@ -15,8 +15,8 @@ const CometChatSenderFileMessageBubble = (props) => { /** * Handler to download the file attachment in local storage - * @param - */ + * @param + */ const download = () => { try { let PictureDir = RNFetchBlob.fs.dirs.PictureDir; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderFileMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/resources/1px.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/resources/1px.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/resources/1px.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/resources/1px.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderImageMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderTextMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderTextMessageBubble/index.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderTextMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderTextMessageBubble/index.js index b1d70ab..5e9e186 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatSenderTextMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatSenderTextMessageBubble/index.js @@ -32,12 +32,11 @@ const CometChatSenderTextMessageBubble = (props) => { const prevMessage = usePrevious(message); const viewTheme = { ...theme, ...props.theme }; - /** - * Handler that parses text and wraps URLs, phone numbers, emails, social handles, hashtags, and more with Text nodes and onPress handlers. - * @param - */ - + * Handler that parses text and wraps URLs, phone numbers, emails, social handles, hashtags, and more with Text nodes and onPress handlers. + * @param + */ + const getMessageText = () => { return ( { CometChat.callExtension('stickers', 'GET', 'v1/fetch', null) .then((stickers) => { @@ -92,11 +92,11 @@ class CometChatStickerKeyboard extends React.PureComponent { this.setState({ activeStickerList: [], stickerSet: {} }); }); }; - + /** * Handler for sending stickers to users. * @param stickerItem: object stickerItem - */ + */ sendStickerMessage = (stickerItem) => { this.props.actionGenerated(actions.SEND_STICKER, stickerItem); diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatStickerKeyboard/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatStickerKeyboard/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatStickerKeyboard/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatStickerKeyboard/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/CometChatThreadedMessageReplyCount/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/index.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/index.js index 1ce7f1e..37a5428 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/index.js @@ -58,8 +58,8 @@ const CometChatCreatePoll = (props) => { /** * Handler for creating a poll based on validations. - * @param - */ + * @param + */ const createPoll = () => { const question = questionRef.trim(); const firstOption = optionOneRef.trim(); @@ -78,9 +78,9 @@ const CometChatCreatePoll = (props) => { }); let receiverId; const receiverType = props.type; - if (props.type === enums.TYPE_USER) { + if (props.type === CometChat.RECEIVER_TYPE.USER) { receiverId = props.item.uid; - } else if (props.type === enums.TYPE_GROUP) { + } else if (props.type === CometChat.RECEIVER_TYPE.GROUP) { receiverId = props.item.guid; } CometChat.callExtension('polls', 'POST', 'v2/create', { @@ -112,7 +112,8 @@ const CometChatCreatePoll = (props) => { props.actionGenerated(actions.POLL_CREATED, message); }) .catch((err) => { - setError({ error: err }); + console.log("err",err) + setError(err); }); }; const onChangeScreenSize = (contentWidth, contentHeight) => { @@ -182,7 +183,10 @@ const CometChatCreatePoll = (props) => { onPress={() => { addPollOption(); }}> - + @@ -190,8 +194,8 @@ const CometChatCreatePoll = (props) => { /** * Implemented to combine and display whole create poll view screen. - * @param - */ + * @param + */ const pollOptionView = ( { ); }; -export default CometChatCreatePoll \ No newline at end of file +export default CometChatCreatePoll; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/resources/add.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/resources/add.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/resources/add.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/resources/add.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePoll/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/add.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/add.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/add.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/add.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/remove.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/remove.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/remove.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/resources/remove.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/styles.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/styles.js index f47c6d4..3312e54 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/styles.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatCreatePollOptions/styles.js @@ -31,7 +31,7 @@ export default StyleSheet.create({ Inputbox: { width: '85%', borderColor: 'green', - fontSize: 16, + fontSize: 16, alignSelf: 'center', }, ContainerForDelete: { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/index.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/index.js index 4b7cad4..4438b47 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/index.js @@ -11,7 +11,10 @@ import { import styles from './styles'; import _ from 'lodash'; import { CometChat } from '@cometchat-pro/react-native-chat'; -import { checkMessageForExtensionsData, logger } from '../../../../utils/common'; +import { + checkMessageForExtensionsData, + logger, +} from '../../../../utils/common'; import * as enums from '../../../../utils/enums'; import { ModalPicker, Emoji } from 'emoji-mart-native'; import ReactionDetails from './reactionDetails'; @@ -31,7 +34,7 @@ class CometChatMessageReactions extends Component { this.setState({ message: this.props.message }); } } - + reactToMessages = (emoji) => { try { this.setState({ pickerVisible: false }); @@ -50,7 +53,7 @@ class CometChatMessageReactions extends Component { logger(error); } }; - + getMessageReactions = (reaction) => { try { if (reaction === null) { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/reactionDetails.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/reactionDetails.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/reactionDetails.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/reactionDetails.js index b8033c5..bd3e3ae 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/reactionDetails.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/reactionDetails.js @@ -1,12 +1,19 @@ import React from 'react'; -import { Text, View, Modal, Dimensions, TouchableOpacity, SectionList } from 'react-native'; +import { + Text, + View, + Modal, + Dimensions, + TouchableOpacity, + SectionList, +} from 'react-native'; import BottomSheet from 'reanimated-bottom-sheet'; import style from './styles'; import { checkMessageForExtensionsData } from '../../../../utils/common'; import { map, toArray } from 'lodash'; import FastImage from 'react-native-fast-image'; import { Emoji } from 'emoji-mart-native'; -import _ from 'lodash' +import _ from 'lodash'; export default class ReactionDetails extends React.Component { sheetRef = React.createRef(null); diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/add-reaction.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/add-reaction.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/add-reaction.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/add-reaction.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/styles.js similarity index 97% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/styles.js index b5feb2c..146ddae 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/styles.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatMessageReactions/styles.js @@ -22,7 +22,7 @@ export default StyleSheet.create({ justifyContent: 'center', backgroundColor: 'rgba(0,0,0,0.1)', }, - sectionItemNameText:{ fontSize: 18 }, + sectionItemNameText: { fontSize: 18 }, addReactionImage: { width: 16, height: 16, resizeMode: 'contain' }, modalPickerStyle: { borderRadius: 20, overflow: 'hidden' }, emojiContainer: { marginTop: 11 }, diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/index.js index 896542d..6ba55cd 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/index.js @@ -23,14 +23,14 @@ const CometChatReceiverPollMessageBubble = (props) => { let pollId = null; let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { senderAvatar = message.sender.avatar; } /** * Handler for implementing the selected option from poll options. * @param selectedOption: selectedOption object - */ + */ const answerPollQuestion = (selectedOption) => { CometChat.callExtension('polls', 'POST', 'v2/vote', { @@ -137,7 +137,7 @@ const CometChatReceiverPollMessageBubble = (props) => { return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/resources/avatar.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/resources/avatar.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/resources/avatar.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/resources/avatar.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverPollMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/index.js similarity index 89% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/index.js index 7fb779a..b78d3f6 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/index.js @@ -11,6 +11,7 @@ import style from './styles'; import { CometChatAvatar } from '../../../Shared'; import { CometChatMessageReactions } from '../index'; import * as enums from '../../../../utils/enums'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const CometChatReceiverStickerMessageBubble = (props) => { const message = { @@ -37,13 +38,13 @@ const CometChatReceiverStickerMessageBubble = (props) => { } let senderAvatar = null; - if (message.receiverType === enums.TYPE_GROUP) { + if (message.receiverType === CometChat.RECEIVER_TYPE.GROUP) { senderAvatar = { uri: message.sender.avatar }; } return ( - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( { ) : null} - {props.message.receiverType === enums.TYPE_GROUP ? ( + {props.message.receiverType === CometChat.RECEIVER_TYPE.GROUP ? ( {message.sender.name} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatReceiverStickerMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderPollMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/resources/clear.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/resources/clear.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/resources/clear.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/resources/clear.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/CometChatSmartReplyPreview/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/Extensions/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/Extensions/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Messages/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatAvatar/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatAvatar/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatAvatar/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatAvatar/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatAvatar/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatAvatar/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatAvatar/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatAvatar/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBackdrop/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBackdrop/index.js similarity index 71% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBackdrop/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBackdrop/index.js index 4cccc57..87ff613 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBackdrop/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBackdrop/index.js @@ -4,7 +4,9 @@ import styles from './styles'; export default (props) => { return props.show ? ( - + {props.children} ) : null; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBackdrop/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBackdrop/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBackdrop/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBackdrop/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBadgeCount/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBadgeCount/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBadgeCount/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBadgeCount/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBadgeCount/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBadgeCount/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatBadgeCount/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatBadgeCount/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/controller.js similarity index 89% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/controller.js index 0c7c9e8..35d2c06 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/controller.js @@ -8,18 +8,18 @@ export class SharedMediaManager { mediaMessageRequest = null; constructor(item, type, messageType) { - if (type === enums.TYPE_USER) { + if (type === CometChat.RECEIVER_TYPE.USER) { this.mediaMessageRequest = new CometChat.MessagesRequestBuilder() .setUID(item.uid) .setLimit(10) - .setCategory(enums.CATEGORY_MESSAGE) + .setCategory(CometChat.CATEGORY_MESSAGE) .setType(messageType) .build(); } else { this.mediaMessageRequest = new CometChat.MessagesRequestBuilder() .setGUID(item.guid) .setLimit(10) - .setCategory(enums.CATEGORY_MESSAGE) + .setCategory(CometChat.CATEGORY_MESSAGE) .setType(messageType) .build(); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/index.js similarity index 86% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/index.js index 816371d..2a62db1 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/index.js @@ -11,7 +11,7 @@ import styles from './styles'; import VideoPlayer from 'react-native-video-controls'; import Icon from 'react-native-vector-icons/FontAwesome5'; - +import { CometChat } from '@cometchat-pro/react-native-chat'; import { deviceHeight, heightRatio } from '../../../utils/consts'; import { logger } from '../../../utils/common'; @@ -20,7 +20,7 @@ export default class CometChatSharedMedia extends React.Component { super(props); this.state = { - messageType: enums.MESSAGE_TYPE_IMAGE, + messageType: CometChat.MESSAGE_TYPE.IMAGE, messageList: [], imageView: false, activeMessage: {}, @@ -82,8 +82,8 @@ export default class CometChatSharedMedia extends React.Component { messageDeleted = (deletedMessage) => { const messageType = deletedMessage.data.type; if ( - this.props.type === enums.TYPE_GROUP && - deletedMessage.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + deletedMessage.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && deletedMessage.getReceiver().guid === this.props.item.guid && messageType === this.state.messageType ) { @@ -102,8 +102,8 @@ export default class CometChatSharedMedia extends React.Component { messageReceived = (message) => { const messageType = message.data.type; if ( - this.props.type === enums.TYPE_GROUP && - message.getReceiverType() === enums.TYPE_GROUP && + this.props.type === CometChat.RECEIVER_TYPE.GROUP && + message.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP && message.getReceiver().guid === this.props.item.guid && messageType === this.state.messageType ) { @@ -179,10 +179,10 @@ export default class CometChatSharedMedia extends React.Component { * @returns activeHeaderName for shared media */ getActiveType = () => { - if (this.state.messageType === enums.MESSAGE_TYPE_IMAGE) { + if (this.state.messageType === CometChat.MESSAGE_TYPE.IMAGE) { return 'Photos'; } - if (this.state.messageType === enums.MESSAGE_TYPE_FILE) { + if (this.state.messageType === CometChat.MESSAGE_TYPE.FILE) { return 'Docs'; } return 'Videos'; @@ -206,8 +206,8 @@ export default class CometChatSharedMedia extends React.Component { /** * Return empty list component - * @param - */ + * @param + */ emptyListComponent = () => { return ( @@ -226,7 +226,7 @@ export default class CometChatSharedMedia extends React.Component { const bgColor = currentTheme.backgroundColor.lightGrey; const template = (message) => { - if (messageType === enums.MESSAGE_TYPE_IMAGE && message.data.url) { + if (messageType === CometChat.MESSAGE_TYPE.IMAGE && message.data.url) { return ( ); } - if (messageType === enums.MESSAGE_TYPE_VIDEO && message.data.url) { + if (messageType === CometChat.MESSAGE_TYPE.VIDEO && message.data.url) { return ( ); } - if (messageType === enums.MESSAGE_TYPE_FILE && message.data.attachments) { + if ( + messageType === CometChat.MESSAGE_TYPE.FILE && + message.data.attachments + ) { return ( this.mediaClickHandler(enums.MESSAGE_TYPE_IMAGE)} + onPress={() => + this.mediaClickHandler(CometChat.MESSAGE_TYPE.IMAGE) + } style={[ - messageType === enums.MESSAGE_TYPE_IMAGE + messageType === CometChat.MESSAGE_TYPE.IMAGE ? styles.activeButtonStyle : styles.buttonStyle, ]}> Photos - {messageType === enums.MESSAGE_TYPE_FILE ? ( + {messageType === CometChat.MESSAGE_TYPE.FILE ? ( ) : null} this.mediaClickHandler(enums.MESSAGE_TYPE_VIDEO)} + onPress={() => + this.mediaClickHandler(CometChat.MESSAGE_TYPE.VIDEO) + } style={ - messageType === enums.MESSAGE_TYPE_VIDEO + messageType === CometChat.MESSAGE_TYPE.VIDEO ? styles.activeButtonStyle : styles.buttonStyle }> Videos - {messageType === enums.MESSAGE_TYPE_IMAGE ? ( + {messageType === CometChat.MESSAGE_TYPE.IMAGE ? ( ) : null} this.mediaClickHandler(enums.MESSAGE_TYPE_FILE)} + onPress={() => + this.mediaClickHandler(CometChat.MESSAGE_TYPE.FILE) + } style={[ - messageType === enums.MESSAGE_TYPE_FILE + messageType === CometChat.MESSAGE_TYPE.FILE ? styles.activeButtonStyle : styles.buttonStyle, ]}> diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatSharedMedia/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatSharedMedia/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatUserPresence/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatUserPresence/index.js similarity index 87% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatUserPresence/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatUserPresence/index.js index 18dc3bc..f452e5a 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatUserPresence/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatUserPresence/index.js @@ -2,6 +2,7 @@ import React from 'react'; import { View } from 'react-native'; import styles from './styles'; import * as enums from '../../../utils/enums'; +import { CometChat } from '@cometchat-pro/react-native-chat'; const CometChatUserPresence = (props) => { let presenceStatus = { @@ -12,7 +13,7 @@ const CometChatUserPresence = (props) => { const cornerRadius = props.cornerRadius || 4.5; if ( - props.status === enums.STATUS_TYPE_ONLINE || + props.status === CometChat.USER_STATUS.ONLINE || props.status === enums.STATUS_TYPE_AVAILABLE ) { presenceStatus = { diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatUserPresence/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatUserPresence/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/CometChatUserPresence/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/CometChatUserPresence/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Shared/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Shared/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/CometChatUserProfile/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/CometChatUserProfile/index.js similarity index 98% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/CometChatUserProfile/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/CometChatUserProfile/index.js index 528945c..f45f9bf 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/CometChatUserProfile/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/CometChatUserProfile/index.js @@ -19,9 +19,9 @@ const CometChatUserProfile = (props) => { const viewTheme = { ...theme, ...props.theme }; /** - * Retrieve logged in user details - * @param - */ + * Retrieve logged in user details + * @param + */ const getProfile = () => { new CometChatManager() .getLoggedInUser() diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/CometChatUserProfile/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/CometChatUserProfile/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/CometChatUserProfile/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/CometChatUserProfile/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/UserProfile/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/UserProfile/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserDetails/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserDetails/index.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserDetails/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserDetails/index.js index 11bd37e..06f5772 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserDetails/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserDetails/index.js @@ -18,7 +18,7 @@ export default class CometChatUserDetails extends React.Component { /** * Update bottom sheet to 0th snap point if prop received as open - */ + */ componentDidUpdate(prevProps) { if (!prevProps.open && this.props.open) { this.sheetRef.current.snapTo(0); diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserDetails/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserDetails/styles.js similarity index 91% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserDetails/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserDetails/styles.js index ec6c32e..9a8a4a7 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserDetails/styles.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserDetails/styles.js @@ -17,8 +17,8 @@ export default StyleSheet.create({ textTransform: 'uppercase', }, optionsContainer: { padding: 16, flex: 1, flexGrow: 1 }, - blockContainer:{ width: '100%' }, - blockText:{ width: '100%', marginVertical: 6 }, + blockContainer: { width: '100%' }, + blockText: { width: '100%', marginVertical: 6 }, headerStyle: { flexDirection: 'row', alignItems: 'center', diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/controller.js similarity index 99% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/controller.js index 526a687..d7953bf 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/controller.js @@ -36,7 +36,7 @@ export class UserListManager { /* when someuser/friend went offline, user will be received here */ callback(offlineUser); }, - }) + }), ); } diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/index.js similarity index 96% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/index.js index f6c3938..4f9bb92 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/index.js @@ -21,7 +21,7 @@ import style from './styles'; import theme from '../../../resources/theme'; import { logger } from '../../../utils/common'; import * as enums from '../../../utils/enums'; - +import { CometChat } from '@cometchat-pro/react-native-chat'; class CometChatUserList extends React.PureComponent { timeout; @@ -133,7 +133,7 @@ class CometChatUserList extends React.PureComponent { /** * Handle user updated from listener * @param user: user object - */ + */ userUpdated = (user) => { try { const userList = [...this.state.userList]; @@ -156,25 +156,25 @@ class CometChatUserList extends React.PureComponent { /** * Handle on end reached of the list - * @param - */ + * @param + */ endReached = () => { this.getUsers(); }; /** * Handle click on the list item - * @param - */ + * @param + */ handleClick = (user) => { if (!this.props.onItemClick) return; - this.props.onItemClick(user, enums.TYPE_USER); + this.props.onItemClick(user, CometChat.RECEIVER_TYPE.USER); }; /** * Retrieve user from user list while searching - * @param - */ + * @param + */ searchUsers = (val) => { this.setState( { textInputValue: val }, @@ -194,8 +194,8 @@ class CometChatUserList extends React.PureComponent { /** * Retrieve user list from sdk acc to logged in user - * @param - */ + * @param + */ getUsers = () => { new CometChatManager() .getLoggedInUser() @@ -219,13 +219,13 @@ class CometChatUserList extends React.PureComponent { }; /** - * Component for flatList item - * @param + * Component for flatList item + * @param * if item - sticky header * @returns Component with ContactAlphabet * if item - user - * @returns UserListComponent - */ + * @returns UserListComponent + */ renderUserView = ({ item, index }) => { if (item.header) { const headerLetter = item.value; @@ -249,8 +249,8 @@ class CometChatUserList extends React.PureComponent { /** * Return component for empty user list - * @param - */ + * @param + */ listEmptyContainer = () => { return ( @@ -269,8 +269,8 @@ class CometChatUserList extends React.PureComponent { /** * Return separator component - * @param - */ + * @param + */ itemSeparatorComponent = ({ leadingItem }) => { if (leadingItem.header) { return null; @@ -289,8 +289,8 @@ class CometChatUserList extends React.PureComponent { /** * Return header component with text input for search - * @param - */ + * @param + */ listHeaderComponent = () => { return ( @@ -339,8 +339,8 @@ class CometChatUserList extends React.PureComponent { /** * Check scroll value to enable small headers - * @param - */ + * @param + */ handleScroll = ({ nativeEvent }) => { if (nativeEvent.contentOffset.y > 35 && !this.state.showSmallHeader) { this.setState({ diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/resources/close.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/resources/close.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/resources/close.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/resources/close.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/resources/search-grey-icon.png b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/resources/search-grey-icon.png similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/resources/search-grey-icon.png rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/resources/search-grey-icon.png diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserList/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserList/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListItem/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListItem/index.js similarity index 93% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListItem/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListItem/index.js index 283cc39..eebea09 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListItem/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListItem/index.js @@ -29,9 +29,7 @@ const CometChatUserListItem = (props) => { /> - + {props.user.name} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListItem/styles.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListItem/styles.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListItem/styles.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListItem/styles.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListWithMessages/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListWithMessages/index.js similarity index 92% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListWithMessages/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListWithMessages/index.js index 1441d84..0bda363 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/CometChatUserListWithMessages/index.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/CometChatUserListWithMessages/index.js @@ -8,8 +8,8 @@ import { CometChatUserList } from '../index'; import { CometChatManager } from '../../../utils/controller'; import { CometChatImageViewer } from '../../Messages'; import theme from '../../../resources/theme'; -import * as actions from '../../../utils/actions' -import * as enums from '../../../utils/enums' +import * as actions from '../../../utils/actions'; +import * as enums from '../../../utils/enums'; import { logger } from '../../../utils/common'; class CometChatUserListWithMessages extends React.Component { @@ -20,7 +20,7 @@ class CometChatUserListWithMessages extends React.Component { this.state = { item: {}, - type: enums.TYPE_USER, + type: CometChat.RECEIVER_TYPE.USER, callMessage: {}, incomingCall: null, outgoingCall: null, @@ -199,10 +199,10 @@ class CometChatUserListWithMessages extends React.Component { try { let receiverId; let receiverType; - if (this.state.type === enums.TYPE_USER) { + if (this.state.type === CometChat.RECEIVER_TYPE.USER) { receiverId = this.state.item.uid; receiverType = CometChat.RECEIVER_TYPE.USER; - } else if (this.state.type === enums.TYPE_GROUP) { + } else if (this.state.type === CometChat.RECEIVER_TYPE.GROUP) { receiverId = this.state.item.guid; receiverType = CometChat.RECEIVER_TYPE.GROUP; } @@ -226,10 +226,10 @@ class CometChatUserListWithMessages extends React.Component { try { let receiverId; let receiverType; - if (this.state.type === enums.TYPE_USER) { + if (this.state.type === CometChat.RECEIVER_TYPE.USER) { receiverId = this.state.item.uid; receiverType = CometChat.RECEIVER_TYPE.USER; - } else if (this.state.type === enums.TYPE_GROUP) { + } else if (this.state.type === CometChat.RECEIVER_TYPE.GROUP) { receiverId = this.state.item.guid; receiverType = CometChat.RECEIVER_TYPE.GROUP; } @@ -256,7 +256,10 @@ class CometChatUserListWithMessages extends React.Component { this.setState({ incomingCall: call }); const type = call.receiverType; - const id = type === enums.TYPE_USER ? call.sender.uid : call.receiverId; + const id = + type === CometChat.RECEIVER_TYPE.USER + ? call.sender.uid + : call.receiverId; CometChat.getConversation(id, type) .then((conversation) => { @@ -279,7 +282,7 @@ class CometChatUserListWithMessages extends React.Component { try { let { receiverType } = incomingCallMessage; let receiverId = - receiverType === enums.TYPE_USER + receiverType === CometChat.RECEIVER_TYPE.USER ? incomingCallMessage.sender.uid : incomingCallMessage.receiverId; @@ -296,11 +299,11 @@ class CometChatUserListWithMessages extends React.Component { receiverId = rejectedCallMessage.receiverId; if ( - (type === enums.TYPE_GROUP && - receiverType === enums.TYPE_GROUP && + (type === CometChat.RECEIVER_TYPE.GROUP && + receiverType === CometChat.RECEIVER_TYPE.GROUP && receiverId === item.guid) || - (type === enums.TYPE_USER && - receiverType === enums.TYPE_USER && + (type === CometChat.RECEIVER_TYPE.USER && + receiverType === CometChat.RECEIVER_TYPE.USER && receiverId === item.uid) ) { this.appendCallMessage(rejectedCallMessage); @@ -313,7 +316,7 @@ class CometChatUserListWithMessages extends React.Component { /** * Handle appending call messages and navigating to message screen * @param call: call message object - */ + */ appendCallMessage = (call) => { const { item, type } = this.state; // TODO update params in better way @@ -324,8 +327,8 @@ class CometChatUserListWithMessages extends React.Component { /** * Handle toggling sidebar - * @param - */ + * @param + */ toggleSideBar = () => { const { sideBarView } = this.state; this.setState({ sideBarView: !sideBarView }); @@ -333,8 +336,8 @@ class CometChatUserListWithMessages extends React.Component { /** * Handle toggling detail view on header clicked - * @param - */ + * @param + */ toggleDetailView = () => { const viewDetail = !this.state.viewDetailScreen; this.setState({ viewDetailScreen: viewDetail, threadMessageView: false }); @@ -342,8 +345,8 @@ class CometChatUserListWithMessages extends React.Component { /** * Handle closing thread message component - * @param - */ + * @param + */ closeThreadMessages = () => { this.setState({ viewDetailScreen: false, threadMessageView: false }); }; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Users/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Users/index.js diff --git a/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/index.js new file mode 100644 index 0000000..955a8da --- /dev/null +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/index.js @@ -0,0 +1,19 @@ +export { + CometChatAvatar, + CometChatBadgeCount, + CometChatUserPresence, +} from './components/Shared'; +export { + CometChatUserList, + CometChatUserListWithMessages, +} from './components/Users'; +export { default as CometChatUI } from './components/CometChatUI'; +export { CometChatMessages } from './components/Messages'; +export { + CometChatGroupList, + CometChatGroupListWithMessages, +} from './components/Groups'; +export { + CometChatConversationList, + CometChatConversationListWithMessages, +} from './components/Chats'; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/incomingcall.wav b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/incomingcall.wav similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/incomingcall.wav rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/incomingcall.wav diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/incomingmessage.wav b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/incomingmessage.wav similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/incomingmessage.wav rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/incomingmessage.wav diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/incomingothermessage.wav b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/incomingothermessage.wav similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/incomingothermessage.wav rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/incomingothermessage.wav diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/index.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/index.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/index.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/index.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/outgoingcall.wav b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/outgoingcall.wav similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/outgoingcall.wav rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/outgoingcall.wav diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/outgoingmessage.wav b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/outgoingmessage.wav similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/audio/outgoingmessage.wav rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/audio/outgoingmessage.wav diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/theme.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/theme.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/resources/theme.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/resources/theme.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/actions.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/actions.js similarity index 95% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/actions.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/actions.js index 4731d10..d24108b 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/actions.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/actions.js @@ -1,4 +1,4 @@ -export const ACCEPT_INCOMING_CALL = 'acceptIncomingCall'; +export const ACCEPT_INCOMING_CALL = 'acceptIncomingCall'; export const ACCEPTED_INCOMING_CALL = 'acceptedIncomingCall'; export const REJECT_INCOMING_CALL = 'rejectIncomingCall'; export const REJECTED_INCOMING_CALL = 'rejectedIncomingCall'; @@ -76,8 +76,8 @@ export const CUSTOM_MESSAGE_RECEIVED = 'customMessageReceived'; export const CALL_UPDATED = 'callUpdated'; export const POLL_CREATED = 'pollCreated'; -export const POLL_ANSWERED = 'pollAnswered';; +export const POLL_ANSWERED = 'pollAnswered'; export const BAN = 'ban'; export const KICK = 'kick'; -export const CHANGE_SCOPE = 'changescope'; \ No newline at end of file +export const CHANGE_SCOPE = 'changescope'; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/common.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/common.js similarity index 81% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/common.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/common.js index bd0b9a9..c02fea2 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/common.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/common.js @@ -1,28 +1,31 @@ -const emailPattern = new RegExp('[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}', 'gi'); /// ([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi; +const emailPattern = new RegExp( + '[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}', + 'gi', +); /// ([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi; const urlPattern = new RegExp( '(^|[\\s.:;?\\-\\]<\\(])' + "((https?://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?)" + "(?=$|[\\s',\\|\\(\\).:;?\\-\\[\\]>\\)])", - 'gi' + 'gi', ); const phoneNumPattern = new RegExp( '\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*', - 'g' + 'g', ); export const linkify = (message) => { let outputStr = message.replace( phoneNumPattern, - "$&" + "$&", ); outputStr = outputStr.replace( emailPattern, - "$&" + "$&", ); outputStr = outputStr.replace( urlPattern, - "$&" + "$&", ); return outputStr; @@ -33,7 +36,10 @@ export const checkMessageForExtensionsData = (message, extensionKey) => { if (Object.prototype.hasOwnProperty.call(message, 'metadata')) { const { metadata } = message; const injectedObject = metadata['@injected']; - if (injectedObject && Object.prototype.hasOwnProperty.call(injectedObject, 'extensions')) { + if ( + injectedObject && + Object.prototype.hasOwnProperty.call(injectedObject, 'extensions') + ) { const extensionsObject = injectedObject.extensions; if ( extensionsObject && @@ -53,4 +59,4 @@ export const logger = (...data) => { } catch (error) { logger(error); } -}; \ No newline at end of file +}; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/consts.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/consts.js similarity index 100% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/consts.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/consts.js diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/controller.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/controller.js similarity index 91% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/controller.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/controller.js index ce3aad6..4fab02f 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/controller.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/controller.js @@ -25,7 +25,7 @@ export class CometChatManager { }, (error) => { reject(error); - } + }, ); timer += 100; @@ -37,7 +37,7 @@ export class CometChatManager { const promise = new Promise((resolve, reject) => { CometChat.blockUsers(userList).then( (list) => resolve(list), - (error) => reject(error) + (error) => reject(error), ); }); @@ -48,7 +48,7 @@ export class CometChatManager { const promise = new Promise((resolve, reject) => { CometChat.unblockUsers(userList).then( (list) => resolve(list), - (error) => reject(error) + (error) => reject(error), ); }); @@ -60,7 +60,7 @@ export class CometChatManager { const call = new CometChat.Call(receiverID, callType, receiverType); CometChat.initiateCall(call).then( (initiatedCall) => resolve(initiatedCall), - (error) => reject(error) + (error) => reject(error), ); }); @@ -71,7 +71,7 @@ export class CometChatManager { const promise = new Promise((resolve, reject) => { CometChat.acceptCall(sessionId).then( (call) => resolve(call), - (error) => reject(error) + (error) => reject(error), ); }); @@ -82,7 +82,7 @@ export class CometChatManager { const promise = new Promise((resolve, reject) => { CometChat.rejectCall(sessionId, rejectStatus).then( (call) => resolve(call), - (error) => reject(error) + (error) => reject(error), ); }); diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/enums.js b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/enums.js similarity index 72% rename from CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/enums.js rename to CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/enums.js index 10b040c..2be1191 100644 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/utils/enums.js +++ b/CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/utils/enums.js @@ -30,33 +30,15 @@ export const USER_OFFLINE = 'onUserOffline'; export const TYPING_STARTED = 'onTypingStarted'; export const TYPING_ENDED = 'onTypingEnded'; -export const CATEGORY_MESSAGE = 'message'; -export const MESSAGE_TYPE_TEXT = 'text'; -export const MESSAGE_TYPE_IMAGE = 'image'; -export const MESSAGE_TYPE_VIDEO = 'video'; -export const MESSAGE_TYPE_AUDIO = 'audio'; -export const MESSAGE_TYPE_FILE = 'file'; - -export const CATEGORY_CUSTOM = 'custom'; export const CUSTOM_TYPE_POLL = 'extension_poll'; export const CUSTOM_TYPE_STICKER = 'extension_sticker'; export const CUSTOM_TYPE_DOCUMENT = 'extension_document'; export const CUSTOM_TYPE_WHITEBOARD = 'extension_whiteboard'; -export const CATEGORY_ACTION = 'action'; export const ACTION_TYPE_GROUPMEMBER = 'groupMember'; export const ACTION_TYPE_MESSAGE = 'message'; -export const CATEGORY_CALL = 'call'; -export const CALL_TYPE_AUDIO = 'audio'; -export const CALL_TYPE_VIDEO = 'video'; - -export const STATUS_TYPE_ONLINE = 'online'; export const STATUS_TYPE_AVAILABLE = 'available'; -export const STATUS_TYPE_OFFLINE = 'offline'; - -export const TYPE_USER = 'user'; -export const TYPE_GROUP = 'group'; export const MESSAGE_FROM_RECEIVER = 'receiver'; export const MESSAGE_FROM_SENDER = 'sender'; @@ -65,13 +47,6 @@ export const MESSAGE_OF_RECEIVER = 'receiver'; export const LIVE_REACTION_KEY = 'live_reaction'; -export const GROUP_TYPE_PUBLIC = 'public' -export const GROUP_TYPE_PRIVATE = 'private'; -export const GROUP_TYPE_PROTECTED = 'protected'; - -export const MEMBER_SCOPE_ADMIN = 'admin'; -export const MEMBER_SCOPE_MODERATOR = 'moderator'; - export const LIVE_REACTIONS = { heart: './resources/heart.png', thumbsup: '👍', diff --git a/CometChatWorkspace/cometchat-app/defaultPages/HomePage/index.js b/CometChatWorkspace/cometchat-app/defaultPages/HomePage/index.js index 4dc8dca..c313d9e 100644 --- a/CometChatWorkspace/cometchat-app/defaultPages/HomePage/index.js +++ b/CometChatWorkspace/cometchat-app/defaultPages/HomePage/index.js @@ -1,7 +1,6 @@ import React from 'react'; import {connect} from 'react-redux'; - import styles from './styles'; import * as actions from '../../store/action'; import {Text, View, ScrollView, TouchableOpacity} from 'react-native'; @@ -17,8 +16,8 @@ const HomePage = (props) => { - The UI Kit has different ways to make fully customizable UI - required to build a chat application. + The UI Kit has different ways to make fully customizable UI required + to build a chat application. The UI Kit has been developed to help developers of different levels @@ -30,17 +29,11 @@ const HomePage = (props) => { - - - CometChatUI - + CometChatUI - The{' '} - - CometChatUI - {' '} + The CometChatUI{' '} component launches a fully working chat application. @@ -61,7 +54,6 @@ const HomePage = (props) => { - Conversations @@ -90,7 +82,6 @@ const HomePage = (props) => { - Groups @@ -119,7 +110,6 @@ const HomePage = (props) => { - Users @@ -148,7 +138,6 @@ const HomePage = (props) => { - Conversation List @@ -178,7 +167,6 @@ const HomePage = (props) => { - Group List @@ -204,7 +192,6 @@ const HomePage = (props) => { - User List diff --git a/CometChatWorkspace/cometchat-app/defaultPages/LoginPage/index.js b/CometChatWorkspace/cometchat-app/defaultPages/LoginPage/index.js index 9fcaffb..0457138 100644 --- a/CometChatWorkspace/cometchat-app/defaultPages/LoginPage/index.js +++ b/CometChatWorkspace/cometchat-app/defaultPages/LoginPage/index.js @@ -1,16 +1,11 @@ import React from 'react'; import {connect} from 'react-redux'; -import {CometChatAvatar} from '../../react-native-chat-ui-kit'; +import {CometChatAvatar} from '../../cometchat-pro-react-native-ui-kit'; import {COMETCHAT_CONSTANTS} from '../../CONSTS'; import style from './style'; import * as actions from '../../store/action'; import {SafeAreaView} from 'react-native-safe-area-context'; -import { - View, - Text, - TextInput, - TouchableOpacity, -} from 'react-native'; +import {View, Text, TextInput, TouchableOpacity} from 'react-native'; import {ActivityIndicator} from 'react-native'; class LoginPage extends React.PureComponent { diff --git a/CometChatWorkspace/cometchat-app/package.json b/CometChatWorkspace/cometchat-app/package.json index 722fc26..e2d6de9 100644 --- a/CometChatWorkspace/cometchat-app/package.json +++ b/CometChatWorkspace/cometchat-app/package.json @@ -1,6 +1,6 @@ { "name": "example", - "version": "2.2.0", + "version": "2.2.1-1", "private": true, "scripts": { "android": "react-native run-android", @@ -10,8 +10,8 @@ "lint": "eslint ." }, "dependencies": { - "@cometchat-pro/react-native-calls": "1.0.7", - "@cometchat-pro/react-native-chat": "2.2.0", + "@cometchat-pro/react-native-calls": "1.0.8", + "@cometchat-pro/react-native-chat": "2.2.1", "@react-native-async-storage/async-storage": "^1.13.4", "@react-native-community/masked-view": "^0.1.10", "@react-native-picker/picker": "^1.9.4", diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/MessageFilter.js b/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/MessageFilter.js deleted file mode 100644 index 0f98b4f..0000000 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessageList/MessageFilter.js +++ /dev/null @@ -1,36 +0,0 @@ -import * as enums from '../../../utils/enums'; -export default class MessageFilter { - categories = {}; - - types = null; - - constructor() { - this.categories = { - [enums.CATEGORY_MESSAGE]: enums.CATEGORY_MESSAGE, - [enums.CATEGORY_CUSTOM]: enums.CATEGORY_CUSTOM, - [enums.CATEGORY_ACTION]: enums.CATEGORY_ACTION, - [enums.CATEGORY_CALL]: enums.CATEGORY_CALL, - }; - - this.types = { - [enums.MESSAGE_TYPE_TEXT]: enums.MESSAGE_TYPE_TEXT, - [enums.MESSAGE_TYPE_IMAGE]: enums.MESSAGE_TYPE_IMAGE, - [enums.MESSAGE_TYPE_VIDEO]: enums.MESSAGE_TYPE_VIDEO, - [enums.MESSAGE_TYPE_AUDIO]: enums.MESSAGE_TYPE_AUDIO, - [enums.MESSAGE_TYPE_FILE]: enums.MESSAGE_TYPE_FILE, - [enums.CUSTOM_TYPE_POLL]: enums.CUSTOM_TYPE_POLL, - [enums.CUSTOM_TYPE_STICKER]: enums.CUSTOM_TYPE_STICKER, - [enums.ACTION_TYPE_GROUPMEMBER]: enums.ACTION_TYPE_GROUPMEMBER, - [enums.CALL_TYPE_AUDIO]: enums.CALL_TYPE_AUDIO, - [enums.CALL_TYPE_VIDEO]: enums.CALL_TYPE_VIDEO, - }; - } - - getCategories = () => { - return Object.keys(this.categories); - }; - - getTypes = () => { - return Object.keys(this.types); - }; -} diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessages/index.js b/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessages/index.js deleted file mode 100644 index e87948f..0000000 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/components/Messages/CometChatMessages/index.js +++ /dev/null @@ -1,1083 +0,0 @@ -/* eslint-disable react/no-unused-state */ -/* eslint-disable react/no-did-update-set-state */ -import React from 'react'; -import { - View, - SafeAreaView, - Modal, - Dimensions, - KeyboardAvoidingView, -} from 'react-native'; -import { CometChat } from '@cometchat-pro/react-native-chat'; -import _ from 'lodash'; -import { CometChatUserDetails } from '../../Users'; -import { - CometChatLiveReactions, - CometChatMessageHeader, - CometChatMessageList, - CometChatMessageComposer, - CometChatMessageActions, - CometChatMessageThread, -} from '../index'; -import { CometChatGroupDetails } from '../../Groups'; - -import theme from '../../../resources/theme'; -import { CometChatManager } from '../../../utils/controller'; -import * as enums from '../../../utils/enums'; -import * as actions from '../../../utils/actions'; -import { checkMessageForExtensionsData, logger } from '../../../utils/common'; - -import BottomSheet from 'reanimated-bottom-sheet'; -import style from './styles'; - -class CometChatMessages extends React.PureComponent { - loggedInUser = null; - - constructor(props) { - super(props); - const { route } = props; - - this.state = { - messageList: [], - scrollToBottom: true, - messageToBeEdited: '', - replyPreview: null, - tab: 'conversations', - item: route.params.item, - liveReaction: false, - messageToReact: null, - threadMessageView: false, - threadMessageType: null, - threadMessageItem: {}, - threadMessageParent: {}, - userDetailVisible: false, - groupDetailVisible: false, - user: route.params.type === enums.TYPE_USER ? route.params.item : null, - }; - - this.composerRef = React.createRef(); - this.sheetRef = React.createRef(null); //ref here - - this.reactionName = props.reaction || 'heart'; - this.theme = { ...theme, ...route.params.theme }; - } - - componentDidMount() { - new CometChatManager() - .getLoggedInUser() - .then((user) => { - this.loggedInUser = user; - }) - .catch((error) => { - logger('[CometChatMessages] getLoggedInUser error', error); - }); - } - - componentDidUpdate(prevProps, prevState) { - try { - const { route: prevRoute } = prevProps; - const { route } = this.props; - if (!prevState.threadMessageView && this.state.threadMessageView) { - this.sheetRef.current.snapTo(0); - } - if ( - route.params.type === enums.TYPE_USER && - prevRoute.params.item.uid !== route.params.item.uid - ) { - this.setState({ - messageList: [], - scrollToBottom: true, - messageToBeEdited: '', - }); - } else if ( - route.params.type === enums.TYPE_GROUP && - prevRoute.params.item.guid !== route.params.item.guid - ) { - this.setState({ - messageList: [], - scrollToBottom: true, - messageToBeEdited: '', - }); - } else if (prevRoute.params.type !== route.params.type) { - this.setState({ - messageList: [], - scrollToBottom: true, - messageToBeEdited: '', - }); - } else if ( - prevState.composedThreadMessage !== this.state.composedThreadMessage - ) { - this.updateReplyCount(this.state.composedThreadMessage); - } else if (prevRoute.params.callMessage !== route.params.callMessage) { - if (prevRoute.params.callMessage.id !== route.params.callMessage.id) { - this.actionHandler(actions.CALL_UPDATED, route.params.callMessage); - } - } else if (prevRoute.params.groupMessage !== route.params.groupMessage) { - this.appendMessage(route.params.groupMessage); - } - } catch (error) { - logger(error); - } - } - - /** - * When logged in user deletes a group, the user navigates to the back screen and groupList is updated. - * @param group: group object - */ - deleteGroup = (group) => { - try { - this.setState( - { - groupDetailVisible: false, - groupToDelete: group, - item: {}, - type: enums.TYPE_GROUP, - viewDetailScreen: false, - }, - () => { - this.props.route.params.actionGenerated(actions.GROUP_DELETED, group); - this.props.navigation.goBack(); - }, - ); - } catch (error) { - logger(error); - } - }; - - /** - * handler implemeted when user leaves the group. - * @param - */ - leaveGroup = (group) => { - try { - this.setState( - { - groupDetailVisible: false, - groupToLeave: group, - item: {}, - type: enums.TYPE_GROUP, - viewDetailScreen: false, - }, - () => { - this.props.navigation.goBack(); - }, - ); - } catch (error) { - logger(error); - } - }; - - updateMembersCount = (item, count) => { - try { - const { route } = this.props; - const group = { ...this.state.item, membersCount: count }; - this.setState({ item: group, groupToUpdate: group }); - route.params.actionGenerated(actions.MEMBERS_UPDATED, item, count); - } catch (error) { - logger(error); - } - }; - - /** - * handler for various actions and updations - * @param action: action name - * @param messages: messages object - * @param key: key object - * @param group: group object - * @param options: options object - */ - - actionHandler = (action, messages, key, group, options) => { - try { - const { route } = this.props; - - switch (action) { - case actions.CUSTOM_MESSAGE_RECEIVED: - case actions.MESSAGE_RECEIVED: - { - const message = messages[0]; - if (message.parentMessageId) { - this.updateReplyCount(messages); - } else { - this.smartReplyPreview(messages); - this.appendMessage(messages); - } - } - break; - case actions.GROUP_DELETED: - this.deleteGroup(messages); - break; - case actions.LEFT_GROUP: - this.leaveGroup(messages); - break; - case actions.MEMBERS_UPDATED: - this.updateMembersCount(messages, key); - break; - case actions.MESSAGE_READ: - route.params.actionGenerated(action, messages); - break; - case actions.MESSAGE_COMPOSED: { - this.appendMessage(messages); - route.params.actionGenerated(actions.MESSAGE_COMPOSED, messages); - break; - } - case actions.VIEW_MESSAGE_THREAD: - this.setState({ messageToReact: null }, () => { - this.viewMessageThread(messages); - }); - break; - case actions.CLOSE_THREAD_CLICKED: - this.closeThreadMessages(); - break; - case actions.MESSAGE_UPDATED: { - this.updateMessages(messages); - break; - } - case actions.MESSAGE_FETCHED: - this.prependMessages(messages); - break; - case actions.MESSAGE_FETCHED_AGAIN: - this.prependMessagesAndScrollBottom(messages); - break; - case actions.MESSAGE_DELETED: - this.removeMessages(messages); - break; - case actions.THREAD_MESSAGE_DELETED: - route.params.actionGenerated(actions.MESSAGE_DELETED, messages); - break; - case actions.DELETE_MESSAGE: - this.setState({ messageToReact: null }); - this.deleteMessage(messages); - break; - case actions.EDIT_MESSAGE: - this.setState({ messageToReact: null }); - this.editMessage(messages); - break; - case actions.MESSAGE_EDITED: - this.messageEdited(messages); - break; - case actions.CLEAR_EDIT_PREVIEW: - this.clearEditPreview(); - break; - case actions.GROUP_UPDATED: - this.groupUpdated(messages, key, group, options); - break; - case actions.CALL_UPDATED: - this.callUpdated(messages); - break; - case actions.POLL_ANSWERED: - this.updatePollMessage(messages); - break; - case actions.POLL_CREATED: - this.appendPollMessage(messages); - break; - case actions.VIEW_ACTUAL_IMAGE: - route.params.actionGenerated(actions.VIEW_ACTUAL_IMAGE, messages); - break; - case actions.AUDIO_CALL: - case actions.VIDEO_CALL: - case actions.MENU_CLICKED: - route.params.actionGenerated(action); - break; - case actions.SEND_REACTION: - this.toggleReaction(true); - break; - case actions.SHOW_REACTION: - this.showReaction(messages); - break; - case actions.STOP_REACTION: - this.toggleReaction(false); - break; - case actions.REACT_TO_MESSAGE: - this.reactToMessage(messages); - break; - case actions.GO_BACK: - this.props.navigation.goBack(); - break; - case actions.CLOSE_DETAIL: - this.setState({ - userDetailVisible: false, - groupDetailVisible: false, - }); - break; - case actions.VIEW_DETAIL: - if (route.params.type === enums.TYPE_USER) { - this.setState({ userDetailVisible: true }); - } else { - this.setState({ groupDetailVisible: true }); - } - break; - case actions.BLOCK_USER: - this.blockUser(); - break; - case actions.UNBLOCK_USER: - this.unblockUser(); - break; - case actions.CLOSE_MESSAGE_ACTIONS: - this.setState({ messageToReact: null }); - break; - case actions.OPEN_MESSAGE_ACTIONS: - this.setState({ messageToReact: messages }); - break; - case actions.UPDATE_THREAD_MESSAGE: - this.updateThreadMessage(messages[0], key); - break; - case actions.THREAD_MESSAGE_COMPOSED: - this.onThreadMessageComposed(messages); - route.params.actionGenerated(actions.THREAD_MESSAGE_COMPOSED, messages); - break; - case actions.MEMBER_SCOPE_CHANGED: - this.memberScopeChanged(messages); - break; - case actions.MEMBERS_REMOVED: - this.membersRemoved(messages); - break; - case actions.MEMBERS_ADDED: - this.membersAdded(messages); - break; - case actions.MEMBER_BANNED: - this.memberBanned(messages); - break; - case actions.MEMBER_UNBANNED: - this.memberUnbanned(messages); - break; - default: - break; - } - } catch (error) { - logger(error); - } - }; - - /** - * handler implemented when members are unbanned - * @param memebers: object members - */ - - memberUnbanned = (members) => { - try { - const messageList = [...this.state.messageList]; - let filteredMembers = _.uniqBy(members, 'id'); - filteredMembers.forEach((eachMember) => { - const message = `${this.loggedInUser.name} unbanned ${eachMember.name}`; - const sentAt = (new Date() / 1000) | 0; - const messageObj = { - category: 'action', - message: message, - type: enums.ACTION_TYPE_GROUPMEMBER, - sentAt: sentAt, - }; - messageList.push(messageObj); - }); - - this.setState({ messageList: messageList }); - } catch (error) { - logger(error); - } - }; - - /** - * hander implemented when members are added by a user - * @param members: object members - */ - membersAdded = (members) => { - try { - const messageList = [...this.state.messageList]; - members.forEach((eachMember) => { - const message = `${this.loggedInUser.name} added ${eachMember.name}`; - const sentAt = (new Date() / 1000) | 0; - const messageObj = { - category: 'action', - message, - type: enums.ACTION_TYPE_GROUPMEMBER, - sentAt, - }; - messageList.push(messageObj); - }); - - this.setState({ messageList: messageList }); - } catch (error) { - logger(error); - } - }; - - /** - * handlers implemented when members are removed by the user. - * @param members: object members - */ - membersRemoved = (members) => { - try { - const messageList = [...this.state.messageList]; - let filteredMembers = _.uniqBy(members, 'id'); - filteredMembers.forEach((eachMember) => { - const message = `${this.loggedInUser.name} kicked ${eachMember.name}`; - const sentAt = (new Date() / 1000) | 0; - const messageObj = { - category: 'action', - message: message, - type: enums.ACTION_TYPE_GROUPMEMBER, - sentAt: sentAt, - }; - messageList.push(messageObj); - }); - - this.setState({ messageList: messageList }); - } catch (error) { - logger(error); - } - }; - - /** - * handler when the scope is changed by the user - * @param members:object members - */ - memberScopeChanged = (members) => { - try { - const messageList = [...this.state.messageList]; - let filteredMembers = _.uniqBy(members, 'id'); - filteredMembers.forEach((eachMember) => { - const message = `${this.loggedInUser.name} made ${eachMember.name} ${eachMember.scope}`; - const sentAt = (new Date() / 1000) | 0; - const messageObj = { - category: 'action', - message: message, - type: enums.ACTION_TYPE_GROUPMEMBER, - sentAt: sentAt, - }; - messageList.push(messageObj); - }); - - this.setState({ messageList: messageList }); - } catch (error) { - logger(error); - } - }; - - /** - * handler when members are banned - * @param members: members object - */ - memberBanned = (members) => { - try { - const messageList = [...this.state.messageList]; - members.forEach((eachMember) => { - const message = `${this.loggedInUser.name} banned ${eachMember.name}`; - const sentAt = (new Date() / 1000) | 0; - const messageObj = { - category: 'action', - message, - type: enums.ACTION_TYPE_GROUPMEMBER, - sentAt, - }; - messageList.push(messageObj); - }); - - this.setState({ messageList: messageList }); - } catch (error) { - logger(error); - } - }; - - /** - * handler to close thread messages - * @param - */ - closeThreadMessages = () => { - this.setState({ viewDetailScreen: false, threadMessageView: false }); - }; - - /** - * handler to view thread messages. - * @param parentMessage: message object - */ - viewMessageThread = (parentMessage) => { - try { - const { route } = this.props; - const message = { ...parentMessage }; - const threadItem = { ...this.state.item }; - this.setState({ - threadMessageView: true, - threadMessageParent: message, - threadMessageItem: threadItem, - threadMessageType: route.params.type, - viewDetailScreen: false, - }); - } catch (error) { - logger(error); - } - }; - - /** - * on thread message composed - * @param composedMessage: object composedMessage - */ - - onThreadMessageComposed = (composedMessage) => { - try { - const { route } = this.props; - if (route.params.type !== this.state.threadMessageType) { - return false; - } - - if ( - (this.state.threadMessageType === enums.TYPE_GROUP && - this.state.item.guid !== this.state.threadMessageItem.guid) || - (this.state.threadMessageType === enums.TYPE_USER && - this.state.item.uid !== this.state.threadMessageItem.uid) - ) { - return false; - } - - const message = { ...composedMessage }; - this.setState({ composedThreadMessage: message }); - } catch (error) { - logger(error); - } - }; - - /** - * handler when a user is blocked. - * @param - */ - - blockUser = () => { - try { - const { route } = this.props; - const usersList = [this.state.item.uid]; - CometChatManager.blockUsers(usersList) - .then(() => { - this.setState({ user: { ...this.state.item, blockedByMe: true } }); - route.params.actionGenerated(actions.BLOCK_USER); - }) - .catch((error) => { - logger('Blocking user fails with error', error); - }); - } catch (error) { - logger(error); - } - }; - - /** - * handler for unlocking a user. - * @param - */ - unblockUser = () => { - try { - const { route } = this.props; - const usersList = [this.state.item.uid]; - CometChatManager.unblockUsers(usersList) - .then(() => { - this.setState({ user: { ...this.state.item, blockedByMe: false } }); - route.params.actionGenerated(actions.UNBLOCK_USER); - }) - .catch((error) => { - logger('unblocking user fails with error', error); - }); - } catch (error) { - logger(error); - } - }; - - /** - * live reaction toggler - * @param flag: boolean - */ - toggleReaction = (flag) => { - this.setState({ liveReaction: flag }); - }; - - /** - * show reaction handler - * @param - */ - showReaction = (reaction) => { - if (!Object.prototype.hasOwnProperty.call(reaction, 'metadata')) { - return false; - } - - if ( - !Object.prototype.hasOwnProperty.call(reaction.metadata, 'type') || - !Object.prototype.hasOwnProperty.call(reaction.metadata, 'reaction') - ) { - return false; - } - - if ( - !Object.prototype.hasOwnProperty.call( - enums.LIVE_REACTIONS, - reaction.metadata.reaction, - ) - ) { - return false; - } - - if (reaction.metadata.type === enums.LIVE_REACTION_KEY) { - this.reactionName = reaction.metadata.reaction; - this.setState({ liveReaction: true }); - } - }; - - /** - * if action is delete -> Updates threadMessageParent - * @param message:message object - * @param actions: action name - */ - - updateThreadMessage = (message, action) => { - if (this.state.threadMessageView === false) { - return false; - } - - if (action === 'delete') { - this.setState({ - threadMessageParent: { ...message }, - threadMessageView: false, - }); - } else { - this.setState({ threadMessageParent: { ...message } }); - } - }; - - /** - * handler implemented to delete message . - * @param message: message object - */ - - deleteMessage = (message) => { - try { - const { route } = this.props; - const messageId = message.id; - CometChat.deleteMessage(messageId) - .then((deletedMessage) => { - this.removeMessages([deletedMessage]); - - const messageList = [...this.state.messageList]; - const messageKey = messageList.findIndex((m) => m.id === message.id); - - this.actionHandler(actions.UPDATE_THREAD_MESSAGE, [deletedMessage], 'delete'); - route.params.actionGenerated( - actions.UPDATE_THREAD_MESSAGE, - [deletedMessage], - 'delete', - ); - - if (messageList.length - messageKey === 1 && !message.replyCount) { - route.params.actionGenerated(actions.MESSAGE_DELETED, [deletedMessage]); - } - }) - .catch(() => {}); - } catch (error) { - logger(error); - } - }; - - /** - * Updates messageToBeEdited with received message. - * @param message: message object. - */ - - editMessage = (message) => { - this.setState({ messageToBeEdited: message, replyPreview: null }); - }; - - /** - * Updates the messageList via newMessageObject if received message's id exists in messageList. - * Generates action -> UPDATE_THREAD_MESSAGE. - * @param message: message object - */ - - messageEdited = (message) => { - try { - const { route } = this.props; - const messageList = [...this.state.messageList]; - const messageKey = messageList.findIndex((m) => m.id === message.id); - if (messageKey > -1) { - const messageObj = messageList[messageKey]; - - const newMessageObj = { ...messageObj, ...message }; - - messageList.splice(messageKey, 1, newMessageObj); - this.updateMessages(messageList); - - route.params.actionGenerated( - actions.UPDATE_THREAD_MESSAGE, - [newMessageObj], - 'edit', - ); - - if (messageList.length - messageKey === 1 && !message.replyCount) { - route.params.actionGenerated(actions.MESSAGE_EDITED, [newMessageObj]); - } - } - } catch (error) { - logger(error); - } - }; - - /** - * handler to update poll message - * @param message:message object - */ - updatePollMessage = (message) => { - try { - const messageList = [...this.state.messageList]; - const messageId = message.poll.id; - const messageKey = messageList.findIndex((m) => m.id === messageId); - if (messageKey > -1) { - const messageObj = messageList[messageKey]; - - const metadataObj = { - '@injected': { extensions: { polls: message.poll } }, - }; - - const newMessageObj = { ...messageObj, metadata: metadataObj }; - - messageList.splice(messageKey, 1, newMessageObj); - this.updateMessages(messageList); - } - } catch (error) { - logger(error); - } - }; - - /** - * append poll message handler - * @param messages: object messages - */ - appendPollMessage = (messages) => { - this.appendMessage(messages); - }; - - // messages are deleted - removeMessages = (messages) => { - try { - const deletedMessage = messages[0]; - const messageList = [...this.state.messageList]; - - const messageKey = messageList.findIndex( - (message) => message.id === deletedMessage.id, - ); - if (messageKey > -1) { - const messageObj = { ...messageList[messageKey] }; - const newMessageObj = { ...messageObj, ...deletedMessage }; - - messageList.splice(messageKey, 1, newMessageObj); - this.setState({ messageList: messageList, scrollToBottom: false }); - } - } catch (error) { - logger(error); - } - }; - - // messages are fetched from backend - prependMessages = (messages) => { - const messageList = [...messages, ...this.state.messageList]; - this.setState({ messageList, scrollToBottom: false }); - }; - - prependMessagesAndScrollBottom = (messages) => { - const messageList = [...messages, ...this.state.messageList]; - this.setState({ messageList, scrollToBottom: true }); - }; - - // message is received or composed & sent - appendMessage = (newMessages = []) => { - try { - if ( - this.state.messageList && - newMessages.length && - this.state.messageList.length && - this.state.messageList.length && - newMessages[newMessages.length - 1].id === - this.state.messageList[this.state.messageList.length - 1].id - ) { - return; - } - let messages = [...this.state.messageList]; - messages = messages.concat(newMessages); - messages = _.uniqBy(messages, 'id'); - this.setState({ messageList: messages, scrollToBottom: true }); - } catch (error) { - logger(error); - } - }; - - // message status is updated - updateMessages = (messages) => { - this.setState({ messageList: messages, scrollToBottom: false }); - }; - - /** - * Update group based on key - * @param message: message object - * @param key:enums type - * @param group:group object - * @param options:options - */ - groupUpdated = (message, key, group, options) => { - try { - const { route } = this.props; - this.appendMessage([message]); - - switch (key) { - case enums.GROUP_MEMBER_BANNED: - case enums.GROUP_MEMBER_KICKED: { - if (options.user.uid === this.loggedInUser.uid) { - this.setState({ - item: {}, - type: enums.TYPE_GROUP, - viewDetailScreen: false, - }); - } - break; - } - case enums.GROUP_MEMBER_SCOPE_CHANGED: { - if (options.user.uid === this.loggedInUser.uid) { - const newObj = { ...this.state.item, scope: options.scope }; - this.setState({ - item: newObj, - type: enums.TYPE_GROUP, - viewDetailScreen: false, - }); - } - break; - } - default: - break; - } - - route.params.actionGenerated( - actions.GROUP_UPDATED, - message, - key, - group, - options, - ); - } catch (error) { - logger(error); - } - }; - - callUpdated = (message) => { - this.appendMessage([message]); - }; - - updateReplyCount = (messages) => { - try { - const receivedMessage = messages[0]; - - const messageList = [...this.state.messageList]; - const messageKey = messageList.findIndex( - (m) => m.id === receivedMessage.parentMessageId, - ); - if (messageKey > -1) { - const messageObj = messageList[messageKey]; - let replyCount = Object.prototype.hasOwnProperty.call( - messageObj, - 'replyCount', - ) - ? messageObj.replyCount - : 0; - replyCount += 1; - const newMessageObj = { ...messageObj, replyCount }; - - messageList.splice(messageKey, 1, newMessageObj); - this.setState({ messageList, scrollToBottom: false }); - } - } catch (error) { - logger(error); - } - }; - - /** - * handler for smart reply via checkMessageForExtensionsData() - * @param messages: messages object - */ - smartReplyPreview = (messages) => { - try { - const { route } = this.props; - - const message = messages[0]; - if ( - message.sender.uid === route.params.loggedInUser.uid || - message.category === enums.CATEGORY_CUSTOM - ) { - return false; - } - - const smartReplyData = checkMessageForExtensionsData( - message, - 'smart-reply', - ); - if ( - smartReplyData && - Object.prototype.hasOwnProperty.call(smartReplyData, 'error') === false - ) { - this.setState({ replyPreview: message }); - } else { - this.setState({ replyPreview: null }); - } - } catch (error) { - logger(error); - } - }; - - /** - * sets messageToBeEdited to an empty string - * @param - */ - - clearEditPreview = () => { - this.setState({ messageToBeEdited: '' }); - }; - - reactToMessage = (message) => { - this.setState({ messageToReact: message }); - }; - - render() { - const { route } = this.props; - let messageComposer = ( - { - this.composerRef = el; - }} - theme={this.theme} - item={ - route.params.type === enums.TYPE_USER - ? this.state.user - : this.state.item - } - type={route.params.type} - loggedInUser={route.params.loggedInUser} - messageToBeEdited={this.state.messageToBeEdited} - replyPreview={this.state.replyPreview} - reaction={this.reactionName} - messageToReact={this.state.messageToReact} - actionGenerated={this.actionHandler} - /> - ); - - let liveReactionView = null; - if (this.state.liveReaction) { - liveReactionView = ( - - - - ); - } - - const threadMessageView = ( - - - { - return ( - - - - ); - }} - onCloseEnd={() => { - this.actionHandler(actions.CLOSE_THREAD_CLICKED); - }} - /> - - - ); - - return ( - - - {this.state.userDetailVisible ? ( - - ) : null} - {threadMessageView} - - { - this.actionHandler(actions.CLOSE_MESSAGE_ACTIONS); - }} - /> - - - {liveReactionView} - {messageComposer} - - - ); - } -} - -export default CometChatMessages; diff --git a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/index.js b/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/index.js deleted file mode 100644 index f863e16..0000000 --- a/CometChatWorkspace/cometchat-app/react-native-chat-ui-kit/src/index.js +++ /dev/null @@ -1,9 +0,0 @@ -export { CometChatAvatar, CometChatBadgeCount } from './components/Shared'; -export { CometChatUserList, CometChatUserListWithMessages } from './components/Users'; -export { default as CometChatUI } from './components/CometChatUI'; -export { CometChatMessages } from './components/Messages'; -export { CometChatGroupList, CometChatGroupListWithMessages } from './components/Groups'; -export { - CometChatConversationList, - CometChatConversationListWithMessages, -} from './components/Chats'; diff --git a/CometChatWorkspace/cometchat-app/yarn.lock b/CometChatWorkspace/cometchat-app/yarn.lock index bf6a382..fe79da0 100644 --- a/CometChatWorkspace/cometchat-app/yarn.lock +++ b/CometChatWorkspace/cometchat-app/yarn.lock @@ -663,15 +663,15 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@cometchat-pro/react-native-calls@1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@cometchat-pro/react-native-calls/-/react-native-calls-1.0.7.tgz#fce146fed2dc79222449bf358178105e6a800fef" - integrity sha512-/Ydgedck3F+hnZMTy7sNrLlIJZrR7VKkXlngtmHeMq3+r4ClHdQJap0Cw7lyfG1kIj6qRJLC9Ge6Ohk0NMtXIg== +"@cometchat-pro/react-native-calls@1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@cometchat-pro/react-native-calls/-/react-native-calls-1.0.8.tgz#ec24f09901fe4f36d47d022cce48e4d0ee88f521" + integrity sha512-rJTIIQHaFP/HptwsezLwu6OK/YpSaGVP0ibmlwEY0MgakD/RjAJ6DNO3bSkZ1GXGioMtF8h9xbG1EZwaniDvjQ== -"@cometchat-pro/react-native-chat@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@cometchat-pro/react-native-chat/-/react-native-chat-2.2.0.tgz#4478691f884cb4c76c8ce208c33c396ed3e1dc55" - integrity sha512-zvHGX0JhiDbiWPVBPBXHDkh2ywRqB7/L1zfAnDUV5RTQGOU4nWDW5psO+dCQ2CEPWIfi3fzwDhaQMp82Q/BOfQ== +"@cometchat-pro/react-native-chat@2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@cometchat-pro/react-native-chat/-/react-native-chat-2.2.1.tgz#41d8c2dc1b08a0f13f798d93573a9d5f50d5335c" + integrity sha512-ymLYqgCDNrED7zCqZ7kg3r0r8iUgju+PKpANdWpBCOV2n9N4wmrrnX72O47oKjTwB9nmzI0+0+wkaefgeXtgpg== "@egjs/hammerjs@^2.0.17": version "2.0.17" diff --git a/README.md b/README.md index 56b55ef..e71104f 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,10 @@ CometChat Kitchen Sink Sample App (built using **CometChat UIKit**) is a fully f Build and run the Sample App. +|
**Note:** generating release APK.
| +|-----------------------------------------| +|Setting the below line in android/build.gradle `true` or `false` will determine whether to generate multiple APKs for different CPU architectures or a single APK bundle that works on all devices despite the CPU you're running it on but at the cost of APK bundle size. Default value is `true`
`def enableSeparateBuildPerCPUArchitecture = true` | + # Learn more about UI-Kit Learn more about how to integrate [UI Kit](https://github.com/cometchat-pro/react-native-chat-ui-kit) inside your app.