Skip to content

Commit ee5b275

Browse files
authored
Merge pull request #19 from cometchat-pro/V2.3.0-1
V2.3.0-1
2 parents 1cc0d64 + 687e75f commit ee5b275

File tree

66 files changed

+1600
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1600
-289
lines changed

CometChatWorkspace/cometchat-app/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
9292
* Upload all the APKs to the Play Store and people will download
9393
* the correct one based on the CPU architecture of their device.
9494
*/
95-
def enableSeparateBuildPerCPUArchitecture = true
95+
def enableSeparateBuildPerCPUArchitecture = false
9696

9797
/**
9898
* Run Proguard to shrink the Java bytecode in release builds.

CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
</div>
88

99
<br/><br/>
10+
1011
# CometChat React Native UI Kit
1112

1213
</br></br>
@@ -21,9 +22,9 @@
2122

2223
</br></br>
2324

24-
CometChat React Native UI Kit is a collection of custom UI Components designed to build text chat and voice/video calling features in your application.
25+
CometChat React Native UI Kit is a collection of custom UI Components designed to build text chat and voice/video calling features in your application.
2526

26-
The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly.
27+
The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly.
2728

2829
---
2930

@@ -39,12 +40,10 @@ Before you begin, ensure you have met the following requirements:
3940

4041
- [React-Native](https://reactnative.dev/docs/environment-setup)
4142

43+
| <div align="left"><span>**Note:**<span style="font-weight:500"> Support for Expo CLI based apps.</span> </span></div> |
44+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45+
| 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. |
4246

43-
44-
45-
|<div align="left"><span>**Note:**<span style="font-weight:500"> Support for Expo CLI based apps.</span> </span></div> |
46-
|-----------------------------------------|
47-
|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.|
4847
---
4948

5049
## Installing CometChat React Native UI Kit
@@ -61,7 +60,7 @@ To install React-Native UI Kit, you need to first register on CometChat Dashboar
6160
### ii. Add the CometChat Dependency
6261

6362
```javascript
64-
npm install @cometchat-pro/react-native-chat@2.2.1 --save
63+
npm install @cometchat-pro/react-native-chat@2.3.0 --save
6564
```
6665

6766
### iii. Other required DEPENDENCIES
@@ -91,7 +90,6 @@ These packages help make the ui-kit smooth and functioning
9190
[emoji-mart-native](https://www.npmjs.com/package/emoji-mart-native)</br>
9291
<br/>
9392

94-
9593
## 2. Configure CometChat inside your app
9694

9795
### i. Initialize CometChat 🌟
@@ -100,7 +98,7 @@ The `init()` method initializes the settings required for CometChat.
10098
We suggest calling the `init()` method on app startup, preferably in the `created()` method of the Application class.
10199

102100
```javascript
103-
import {CometChat} from '@cometchat-pro/react-native-chat';
101+
import { CometChat } from '@cometchat-pro/react-native-chat';
104102

105103
const appID = 'APP_ID';
106104
const region = 'REGION';
@@ -129,7 +127,7 @@ CometChat.init(appID, appSetting).then(
129127
This method takes `UID` and `Auth Key` as input parameters and returns the User object containing all the information of the logged-in user..
130128

131129
```javascript
132-
import {CometChat} from '@cometchat-pro/react-native-chat';
130+
import { CometChat } from '@cometchat-pro/react-native-chat';
133131

134132
const authKey = 'AUTH_KEY';
135133
const uid = 'SUPERHERO1';
@@ -168,18 +166,16 @@ Usage of application in project
168166

169167
```javascript
170168
import React from 'react';
171-
import {View} from 'react-native';
172-
import {CometChatUI} from '../cometchat-pro-react-native-ui-kit';
169+
import { View } from 'react-native';
170+
import { CometChatUI } from '../cometchat-pro-react-native-ui-kit';
173171

174172
export default function CometChatUIView() {
175173
return (
176-
<View style={{flex: 1}}>
174+
<View style={{ flex: 1 }}>
177175
<CometChatUI />
178176
</View>
179177
);
180178
}
181-
182-
183179
```
184180

185181
---

CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cometchat-pro-react-native-ui-kit",
3-
"version": "2.2.1-1",
3+
"version": "2.3.0-1",
44
"description": "Chat UI Kit for React Native App",
55
"main": "./src/index.js",
66
"scripts": {
@@ -48,8 +48,8 @@
4848
"prettier": "^2.1.2"
4949
},
5050
"dependencies": {
51-
"@cometchat-pro/react-native-calls": "1.0.8",
52-
"@cometchat-pro/react-native-chat": "2.2.1",
51+
"@cometchat-pro/react-native-calls": "2.0.1",
52+
"@cometchat-pro/react-native-chat": "2.3.0",
5353
"@react-native-community/async-storage": "^1.12.1",
5454
"lodash": "^4.17.20",
5555
"react-native-autolink": "^3.0.0",

CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Calls/CometChatIncomingCall/index.js

Lines changed: 71 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import audioCallIcon from './resources/incomingaudiocall.png';
2424
import videoCallIcon from './resources/incomingvideocall.png';
2525
import { incomingCallAlert } from '../../../resources/audio';
2626
import { logger } from '../../../utils/common';
27+
import DropDownAlert from '../../Shared/DropDownAlert';
28+
2729
export default (props) => {
2830
let callAlertManager = null;
2931
const viewTheme = { ...theme, ...props.theme };
@@ -105,6 +107,8 @@ export default (props) => {
105107
})
106108
.catch((error) => {
107109
props.actionGenerated(actions.CALL_ERROR, error);
110+
const errorCode = error?.message || 'ERROR';
111+
this.dropDownAlertRef?.showMessage('error', errorCode);
108112
});
109113
} else if (incomingCall === null) {
110114
playIncomingAlert();
@@ -170,10 +174,14 @@ export default (props) => {
170174
setIncomingCall(null);
171175
})
172176
.catch((error) => {
177+
const errorCode = error?.message || 'ERROR';
178+
this.dropDownAlertRef?.showMessage('error', errorCode);
173179
props.actionGenerated(actions.CALL_ERROR, error);
174180
setIncomingCall(null);
175181
});
176182
} catch (error) {
183+
const errorCode = error?.message || 'ERROR';
184+
this.dropDownAlertRef?.showMessage('error', errorCode);
177185
logger(error);
178186
}
179187
};
@@ -189,6 +197,8 @@ export default (props) => {
189197
props.actionGenerated(actions.ACCEPT_INCOMING_CALL, incomingCall);
190198
setIncomingCall(null);
191199
} catch (error) {
200+
const errorCode = error?.message || 'ERROR';
201+
this.dropDownAlertRef?.showMessage('error', errorCode);
192202
logger(error);
193203
}
194204
};
@@ -209,69 +219,72 @@ export default (props) => {
209219

210220
if (incomingCall) {
211221
return (
212-
<Modal transparent animated animationType="fade">
213-
<SafeAreaView>
214-
<View style={[style.callContainerStyle]}>
215-
<View style={style.senderDetailsContainer}>
216-
<View>
217-
<Text numberOfLines={1} style={style.nameStyle}>
218-
{incomingCall.sender.name}
219-
</Text>
220-
{incomingCall.type === 'video' ? (
221-
<View style={style.callTypeStyle}>
222-
<Image source={videoCallIcon} alt="Incoming video call" />
223-
<View style={style.callMessageContainerStyle}>
224-
<Text
225-
numberOfLines={1}
226-
style={style.callMessageTextStyle}>
227-
Incoming video call
228-
</Text>
222+
<>
223+
<Modal transparent animated animationType="fade">
224+
<SafeAreaView>
225+
<View style={[style.callContainerStyle]}>
226+
<View style={style.senderDetailsContainer}>
227+
<View>
228+
<Text numberOfLines={1} style={style.nameStyle}>
229+
{incomingCall.sender.name}
230+
</Text>
231+
{incomingCall.type === 'video' ? (
232+
<View style={style.callTypeStyle}>
233+
<Image source={videoCallIcon} alt="Incoming video call" />
234+
<View style={style.callMessageContainerStyle}>
235+
<Text
236+
numberOfLines={1}
237+
style={style.callMessageTextStyle}>
238+
Incoming video call
239+
</Text>
240+
</View>
229241
</View>
230-
</View>
231-
) : (
232-
<View style={style.callTypeStyle}>
233-
<Image source={audioCallIcon} alt="Incoming video call" />
234-
<View style={style.callMessageContainerStyle}>
235-
<Text
236-
numberOfLines={1}
237-
style={style.callMessageTextStyle}>
238-
Incoming audio call
239-
</Text>
242+
) : (
243+
<View style={style.callTypeStyle}>
244+
<Image source={audioCallIcon} alt="Incoming video call" />
245+
<View style={style.callMessageContainerStyle}>
246+
<Text
247+
numberOfLines={1}
248+
style={style.callMessageTextStyle}>
249+
Incoming audio call
250+
</Text>
251+
</View>
240252
</View>
241-
</View>
242-
)}
253+
)}
254+
</View>
255+
<View style={style.avatarStyle}>
256+
<CometChatAvatar
257+
cornerRadius={1000}
258+
borderWidth={0}
259+
textColor="white"
260+
image={{ uri: incomingCall.sender.avatar }}
261+
name={incomingCall.sender.name}
262+
/>
263+
</View>
243264
</View>
244-
<View style={style.avatarStyle}>
245-
<CometChatAvatar
246-
cornerRadius={1000}
247-
borderWidth={0}
248-
textColor="white"
249-
image={{ uri: incomingCall.sender.avatar }}
250-
name={incomingCall.sender.name}
251-
/>
265+
<View style={style.headerButtonStyle}>
266+
<TouchableOpacity
267+
style={[
268+
style.buttonStyle,
269+
{ backgroundColor: viewTheme.backgroundColor.red },
270+
]}
271+
onPress={rejectCall}>
272+
<Text style={style.btnTextStyle}>Decline</Text>
273+
</TouchableOpacity>
274+
<TouchableOpacity
275+
style={[
276+
style.buttonStyle,
277+
{ backgroundColor: viewTheme.backgroundColor.blue },
278+
]}
279+
onPress={acceptCall}>
280+
<Text style={style.btnTextStyle}>Accept</Text>
281+
</TouchableOpacity>
252282
</View>
253283
</View>
254-
<View style={style.headerButtonStyle}>
255-
<TouchableOpacity
256-
style={[
257-
style.buttonStyle,
258-
{ backgroundColor: viewTheme.backgroundColor.red },
259-
]}
260-
onPress={rejectCall}>
261-
<Text style={style.btnTextStyle}>Decline</Text>
262-
</TouchableOpacity>
263-
<TouchableOpacity
264-
style={[
265-
style.buttonStyle,
266-
{ backgroundColor: viewTheme.backgroundColor.blue },
267-
]}
268-
onPress={acceptCall}>
269-
<Text style={style.btnTextStyle}>Accept</Text>
270-
</TouchableOpacity>
271-
</View>
272-
</View>
273-
</SafeAreaView>
274-
</Modal>
284+
</SafeAreaView>
285+
</Modal>
286+
<DropDownAlert ref={(ref) => (this.dropDownAlertRef = ref)} />
287+
</>
275288
);
276289
}
277290

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { CometChat } from '@cometchat-pro/react-native-chat';
2+
3+
import * as enums from '../../../utils/enums';
4+
5+
export class messageAlertManager {
6+
msgListenerId = 'incoming_message_' + new Date().getTime();
7+
8+
attachListeners(callback) {
9+
CometChat.addMessageListener(
10+
this.msgListenerId,
11+
new CometChat.MessageListener({
12+
onCustomMessageReceived: (customMessage) => {
13+
callback(enums.CUSTOM_MESSAGE_RECEIVED, customMessage);
14+
},
15+
}),
16+
);
17+
}
18+
19+
removeListeners() {
20+
CometChat.removeMessageListener(this.msgListenerId);
21+
}
22+
}

0 commit comments

Comments
 (0)