Skip to content

Commit 4608c2b

Browse files
authored
Merge pull request #36 from cometchat-pro/v3.0.0-beta5
v3
2 parents 6e1eac3 + aad8f18 commit 4608c2b

File tree

67 files changed

+10687
-739
lines changed

Some content is hidden

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

67 files changed

+10687
-739
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ To install React-Native UI Kit, you need to first register on CometChat Dashboar
6060
### ii. Add the CometChat Dependency
6161

6262
```javascript
63-
npm install @cometchat-pro/react-native-chat@3.0.0-beta4 --save
63+
64+
npm install @cometchat-pro/react-native-chat@3.0.0-beta5 --save
65+
6466
```
6567

6668
### iii. Other required DEPENDENCIES
@@ -90,6 +92,7 @@ These packages help make the ui-kit smooth and functioning
9092
[emoji-mart-native](https://www.npmjs.com/package/emoji-mart-native)</br>
9193
[react-native-keep-awake](https://www.npmjs.com/package/react-native-keep-awake)</br>
9294
[react-native-webview](https://www.npmjs.com/package/react-native-webview)</br>
95+
[react-native-swipe-list-view](https://www.npmjs.com/package/react-native-swipe-list-view)</br>
9396

9497
<br/>
9598

@@ -191,7 +194,7 @@ Visit our [React-Native sample app](https://github.com/cometchat-pro/react-nativ
191194

192195
# Troubleshooting
193196

194-
- To read the full documentation on UI Kit integration visit our [Documentation](https://prodocs.cometchat.com/docs/react-native-ui-kit).
197+
- To read the full documentation on UI Kit integration visit our [Documentation](https://prodocs.cometchat.com/v3.0-beta/docs/react-native-ui-kit).
195198

196199
- Facing any issues while integrating or installing the UI Kit please <a href="https://app.cometchat.com/" target="_blank"> connect with us via real time support present in CometChat Dashboard.</a>
197200

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "cometchat-pro-react-native-ui-kit",
3-
"version": "3.0.0-beta4-1",
3+
4+
"version": "3.0.0-beta5-1",
5+
46
"description": "Chat UI Kit for React Native App",
57
"main": "./src/index.js",
68
"scripts": {
@@ -9,7 +11,7 @@
911
},
1012
"repository": {
1113
"type": "git",
12-
"url": "git@git.geekyants.com:cometchat/react-native.git"
14+
"url": "git@github.com:cometchat-pro/react-native-chat-sdk.git"
1315
},
1416
"peerDependencies": {
1517
"react-native-keep-awake": "^4.0.0",
@@ -29,7 +31,8 @@
2931
"@react-navigation/bottom-tabs": "^5.11.2",
3032
"@react-navigation/native": "^5.8.10",
3133
"@react-navigation/stack": "^5.12.8",
32-
"react-native-video-controls": "^2.7.1"
34+
"react-native-video-controls": "^2.7.1",
35+
"react-native-swipe-list-view": "^3.2.8"
3336
},
3437
"author": "Inscripts",
3538
"license": "ISC",
@@ -49,9 +52,11 @@
4952
"prettier": "^2.1.2"
5053
},
5154
"dependencies": {
55+
5256
"@cometchat-pro/react-native-calls": "2.0.3-beta1",
53-
"@cometchat-pro/react-native-chat": "3.0.0-beta4",
57+
"@cometchat-pro/react-native-chat": "3.0.0-beta5",
5458
"@react-native-async-storage/async-storage": "^1.13.4",
59+
5560
"lodash": "^4.17.20",
5661
"react-native-autolink": "^3.0.0",
5762
"redux": "^4.0.5",

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect, useContext } from 'react';
22
import {
33
View,
44
TouchableOpacity,
@@ -14,7 +14,7 @@ import { CometChatManager } from '../../../utils/controller';
1414
import * as enums from '../../../utils/enums';
1515
import * as actions from '../../../utils/actions';
1616
import theme from '../../../resources/theme';
17-
import { CometChatAvatar } from '../../Shared';
17+
import CometChatAvatar from '../../Shared/CometChatAvatar';
1818

1919
import { CallAlertManager } from './controller';
2020

@@ -25,19 +25,31 @@ import videoCallIcon from './resources/incomingvideocall.png';
2525
import { incomingCallAlert } from '../../../resources/audio';
2626
import { logger } from '../../../utils/common';
2727
import DropDownAlert from '../../Shared/DropDownAlert';
28+
import { CometChatContext } from '../../../utils/CometChatContext';
2829

2930
export default (props) => {
3031
let callAlertManager = null;
3132
const viewTheme = { ...theme, ...props.theme };
3233
const incomingAlert = new Sound(incomingCallAlert);
3334

3435
const [incomingCall, setIncomingCall] = useState(null);
35-
36+
const [isMessagesSoundEnabled, setIsMessagesSoundEnabled] = useState(null);
37+
const context = useContext(CometChatContext);
38+
useEffect(() => {
39+
checkRestrictions();
40+
}, []);
41+
const checkRestrictions = async () => {
42+
let isEnabled = await context.FeatureRestriction.isCallsSoundEnabled();
43+
setIsMessagesSoundEnabled(isEnabled);
44+
};
3645
/**
3746
* Play call alerts
3847
* @param
3948
*/
4049
const playIncomingAlert = () => {
50+
if (!isMessagesSoundEnabled) {
51+
return false;
52+
}
4153
try {
4254
incomingAlert.setCurrentTime(0);
4355
incomingAlert.setNumberOfLoops(-1);

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

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect, useContext } from 'react';
22
import {
33
View,
44
TouchableOpacity,
@@ -14,7 +14,7 @@ import { CometChatManager } from '../../../utils/controller';
1414
import * as enums from '../../../utils/enums';
1515
import * as actions from '../../../utils/actions';
1616
import theme from '../../../resources/theme';
17-
import { CometChatAvatar } from '../../Shared';
17+
import CometChatAvatar from '../../Shared/CometChatAvatar';
1818

1919
import { messageAlertManager } from './controller';
2020

@@ -24,18 +24,30 @@ 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 { CometChatContext } from '../../../utils/CometChatContext';
2728
export default (props) => {
2829
let callAlertManager = null;
2930
const viewTheme = { ...theme, ...props.theme };
3031
const incomingAlert = new Sound(incomingCallAlert);
3132

33+
const [isMessagesSoundEnabled, setIsMessagesSoundEnabled] = useState(null);
3234
const [incomingCall, setIncomingCall] = useState(null);
33-
35+
const context = useContext(CometChatContext);
36+
useEffect(() => {
37+
checkRestrictions();
38+
}, []);
39+
const checkRestrictions = async () => {
40+
let isEnabled = await context.FeatureRestriction.isCallsSoundEnabled();
41+
setIsMessagesSoundEnabled(isEnabled);
42+
};
3443
/**
3544
* Play call alerts
3645
* @param
3746
*/
3847
const playIncomingAlert = () => {
48+
if (!isMessagesSoundEnabled) {
49+
return false;
50+
}
3951
try {
4052
incomingAlert.setCurrentTime(0);
4153
incomingAlert.setNumberOfLoops(-1);
@@ -217,29 +229,15 @@ export default (props) => {
217229
<Text numberOfLines={1} style={style.nameStyle}>
218230
{incomingCall.sender.name}
219231
</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>
229-
</View>
230-
</View>
231-
) : (
232-
<View style={style.callTypeStyle}>
233-
<Image source={audioCallIcon} alt="Incoming audio call" />
234-
<View style={style.callMessageContainerStyle}>
235-
<Text
236-
numberOfLines={1}
237-
style={style.callMessageTextStyle}>
238-
Incoming audio call
239-
</Text>
240-
</View>
232+
233+
<View style={style.callTypeStyle}>
234+
<Image source={videoCallIcon} alt="Incoming video call" />
235+
<View style={style.callMessageContainerStyle}>
236+
<Text numberOfLines={1} style={style.callMessageTextStyle}>
237+
Incoming video call
238+
</Text>
241239
</View>
242-
)}
240+
</View>
243241
</View>
244242
<View style={style.avatarStyle}>
245243
<CometChatAvatar

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { outgoingCallAlert } from '../../../resources/audio';
99
import { CometChatManager } from '../../../utils/controller';
1010
import { CallScreenManager } from './controller';
1111

12-
import { CometChatAvatar } from '../../Shared';
12+
import CometChatAvatar from '../../Shared/CometChatAvatar';
1313

1414
import * as enums from '../../../utils/enums';
1515
import * as actions from '../../../utils/actions';
@@ -257,7 +257,6 @@ class CometChatOutgoingCall extends React.PureComponent {
257257
callInProgress: null,
258258
callSettings: null,
259259
});
260-
261260
this.markMessageAsRead(endedCall);
262261
this.props.actionGenerated(actions.CALL_ENDED, endedCall);
263262
},

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class CometChatOutgoingDirectCall extends React.Component {
7676

7777
const newMessageObj = { ...customMessage, error: error };
7878
this.props.actionGenerated(
79-
enums.ACTIONS['ERROR_IN_SENDING_MESSAGE'],
79+
actions['ERROR_IN_SENDING_MESSAGE'],
8080
newMessageObj,
8181
);
8282
});
@@ -88,12 +88,7 @@ class CometChatOutgoingDirectCall extends React.Component {
8888
let defaultLayout = true;
8989
let callListener = new CometChat.OngoingCallListener({
9090
onCallEnded: (call) => {
91-
this.props.actionGenerated(actions.DIRECT_CALL_ENDED, call);
92-
this.setState({
93-
outgoingCallScreen: false,
94-
callInProgress: null,
95-
callSettings: null,
96-
});
91+
this.props.close();
9792
},
9893
onError: (error) => {
9994
console.log('Call Error: ', error);

CometChatWorkspace/cometchat-app/cometchat-pro-react-native-ui-kit/src/components/Chats/CometChatConversationList/controller.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CometChat } from '@cometchat-pro/react-native-chat';
22

33
import * as enums from '../../../utils/enums';
4-
4+
import { UIKitSettings } from '../../../utils/UIKitSettings';
55
export class ConversationListManager {
66
conversationRequest = null;
77

@@ -14,9 +14,28 @@ export class ConversationListManager {
1414
callListenerId = `chatlist_call_${new Date().getTime()}`;
1515

1616
constructor() {
17-
this.conversationRequest = new CometChat.ConversationsRequestBuilder()
18-
.setLimit(30)
19-
.build();
17+
let UIKitSettingsBuilder = new UIKitSettings();
18+
const chatListMode = UIKitSettingsBuilder.chatListMode;
19+
const chatListFilterOptions = UIKitSettings.chatListFilterOptions;
20+
switch (chatListMode) {
21+
case chatListFilterOptions['USERS']:
22+
this.conversationRequest = new CometChat.ConversationsRequestBuilder()
23+
.setConversationType(CometChat.ACTION_TYPE.TYPE_USER)
24+
.setLimit(30)
25+
.build();
26+
break;
27+
case chatListFilterOptions['GROUPS']:
28+
this.conversationRequest = new CometChat.ConversationsRequestBuilder()
29+
.setConversationType(CometChat.ACTION_TYPE.TYPE_GROUP)
30+
.setLimit(30)
31+
.build();
32+
break;
33+
default:
34+
this.conversationRequest = new CometChat.ConversationsRequestBuilder()
35+
.setLimit(30)
36+
.build();
37+
break;
38+
}
2039
}
2140

2241
fetchNextConversation() {

0 commit comments

Comments
 (0)