Skip to content

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Tirath.CometChat committed Mar 5, 2021
1 parent 8e2c9c8 commit 76d9a60
Show file tree
Hide file tree
Showing 224 changed files with 1,956 additions and 2,020 deletions.
48 changes: 24 additions & 24 deletions CometChatWorkspace/cometchat-app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -50,7 +50,7 @@ const App = () => {
.build();

useEffect(() => {
console.log("init***")
console.log('init***');
CometChat.init(COMETCHAT_CONSTANTS.APP_ID, appSetting).catch(() => {
return null;
});
Expand Down
6 changes: 3 additions & 3 deletions CometChatWorkspace/cometchat-app/CONSTS.js
Original file line number Diff line number Diff line change
@@ -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',
};
2 changes: 1 addition & 1 deletion CometChatWorkspace/cometchat-app/StackNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Before you begin, ensure you have met the following requirements:




|<div align="left"><span>**Note:**<span style="font-weight:500"> Support for Expo CLI based apps.</span> </span></div> |
|-----------------------------------------|
|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
Expand All @@ -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
Expand All @@ -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)</br>
[react-native-async-storage/async-storage](https://github.com/react-native-async-storage/async-storage)</br>
[@cometchat-pro/react-native-calls](https://www.npmjs.com/package/@cometchat-pro/react-native-calls)</br>
[rn-fetch-blob](https://www.npmjs.com/package/rn-fetch-blob)</br>
[react-native-autolink](https://www.npmjs.com/package/react-native-autolink)</br>
[react-native-screens](https://www.npmjs.com/package/react-native-screens)</br>
[emoji-mart-native](https://www.npmjs.com/package/emoji-mart-native)</br>
<br/>


## 2. Configure CometChat inside your app

### i. Initialize CometChat 🌟
Expand Down Expand Up @@ -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 (
<NavigationContainer>
<Stack.Navigator
headerMode="none"
initialRouteName={props.isLoggedIn ? 'HomePage' : null}>
<Stack.Screen name="LoginPage" component={LoginPage} />
<Stack.Screen name="HomePage" component={HomePage} />
<Stack.Screen
name="CometChatUI"
component={CometChatUI}
/>
</Stack.Navigator>
</NavigationContainer>
<View style={{flex: 1}}>
<CometChatUI />
</View>
);
}


```

---
Expand Down
Original file line number Diff line number Diff line change
@@ -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": "[email protected]: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",
Expand All @@ -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",
Expand All @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class CallAlertManager {
onIncomingCallCancelled: (call) => {
callback(enums.INCOMING_CALL_CANCELLED, call);
},
})
}),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default (props) => {
const incomingCallCancelled = () => {
try {
pauseIncomingAlert();
setIncomingCall(null);
setIncomingCall(null);
} catch (error) {
logger(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class CallScreenManager {
onIncomingCallCancelled: (call) => {
callback(enums.INCOMING_CALL_CANCELLED, call);
},
})
}),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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(
Expand All @@ -95,7 +121,7 @@ export class ConversationListManager {
onMessageEdited: (editedMessage) => {
callback(enums.MESSAGE_EDITED, null, editedMessage);
},
})
}),
);

CometChat.addCallListener(
Expand All @@ -107,7 +133,7 @@ export class ConversationListManager {
onIncomingCallCancelled: (call) => {
callback(enums.INCOMING_CALL_CANCELLED, null, call);
},
})
}),
);
}

Expand Down
Loading

0 comments on commit 76d9a60

Please sign in to comment.