Skip to content

Commit

Permalink
v2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mayur-bhandari committed Jan 18, 2021
1 parent c94e430 commit 9e698f0
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CometChat.js

Large diffs are not rendered by default.

169 changes: 152 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,181 @@
<div style="width:100%">
<div style="width:50%; display:inline-block">
<p align="center">
<img style="text-align:center" width="180" height="180" alt="" src="https://raw.githubusercontent.com/cometchat-pro/ios-swift-chat-app/master/Screenshots/CometChat%20Logo.png">
<img style="text-align:center" width="180" height="180" alt="" src="https://avatars2.githubusercontent.com/u/45484907?s=200&v=4">
</p>
</div>
</div>
</br>
</br>
</div>

# CometChat React Native SDK

CometChat Pro enables you to add voice, video & text chat for your website & app.
This guide demonstrates how to add chat to a React Native App using CometChat Pro.

## Features

<ul>
<li> 1-1 & Group Conversations </li>
<li> Voice & video calling & conferencing </li>
<li> Rich Media Attachments </li>
<li> Typing Indicators </li>
<li> Custom Messages </li>
<li> Read receipts </li>
<li> Online Presence Indicators </li>
<li> Message History </li>
<li> Single Sign-on </li>
<li> Webhooks </li>
<li> Bots </li>
<li> Users & Friends List </li>
<li> Groups List </li>
<li> Conversations List </li>
<li> Threaded Conversations </li>
</ul>

## Extensions

[Push Notification](https://prodocs.cometchat.com/docs/extensions-enhanced-push-notification) | [Email Notification](https://prodocs.cometchat.com/docs/extensions-email-notification) | [SMS Notification](https://prodocs.cometchat.com/docs/extensions-sms-notification) | [Thumbnail Generation](https://prodocs.cometchat.com/docs/extensions-thumbnail-generation) | [Link Preview](https://prodocs.cometchat.com/docs/extensions-link-preview) | [Rich Media Preview](https://prodocs.cometchat.com/docs/extensions-rich-media-preview) | [Voice Transcription](https://prodocs.cometchat.com/docs/extensions-voice-transcription) | [Smart Reply](https://prodocs.cometchat.com/docs/extensions-smart-reply) | [Message Translation](https://prodocs.cometchat.com/docs/extensions-message-translation) | [Emojis](https://prodocs.cometchat.com/docs/extensions-emojis) | [Polls](https://prodocs.cometchat.com/docs/extensions-polls) | [Reactions](https://prodocs.cometchat.com/docs/extensions-reactions) | [Stickers](https://prodocs.cometchat.com/docs/extensions-stickers) | [Video Broadcasting](https://prodocs.cometchat.com/docs/extensions-broadcast) | [Collaborative Documents](https://prodocs.cometchat.com/docs/extensions-collaborative-document) | [Collaborative Whiteboards](https://prodocs.cometchat.com/docs/extensions-collaborative-whiteboard) | [Data Masking Filter](https://prodocs.cometchat.com/docs/extensions-data-masking-filter) | [Profanity Filter](https://prodocs.cometchat.com/docs/extensions-profanity-filter) | [Image Moderation](https://prodocs.cometchat.com/docs/extensions-image-moderation)| [Sentiment Analysis](https://prodocs.cometchat.com/docs/extensions-sentiment-analysis) | [In-flight Message Moderation](https://prodocs.cometchat.com/docs/extensions-in-flight-message-moderation) | [Virus & Malware Scanner](https://prodocs.cometchat.com/docs/extensions-virus-malware-scanner) | [XSS Filter](https://prodocs.cometchat.com/docs/extensions-xss-filter)

[![Platform](https://img.shields.io/badge/Platform-Javascript-brightgreen)](#)
<a href=" "> <img src="https://img.shields.io/badge/Version-2.1.6-important" /></a>
![GitHub repo size](https://img.shields.io/github/repo-size/cometchat-pro/react-native-chat-sdk)
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/react-native-chat-sdk)
![GitHub stars](https://img.shields.io/github/stars/cometchat-pro/react-native-chat-sdk?style=social)
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)
<hr/>

<a href="https://www.npmjs.com">[![Platform](https://img.shields.io/badge/Platform-Javascript-blue.svg)](#)</a>
<a href="https://www.npmjs.com">[![Platform](https://img.shields.io/badge/Platform-NPM-orange.svg)](#)</a>

# Quick Start
## Prerequisites :star:
Before you begin, ensure you have met the following requirements:<br/>
&nbsp; You have [`Visual Studio Code`](https://code.visualstudio.com/) or any other code editor installed in your machine.<br/>
&nbsp; To run native projects you will need to have [`Android Studio`](https://reactnative.dev/docs/environment-setup) & [`Xcode`](https://reactnative.dev/docs/environment-setup) installed in your machine.<br/>
&nbsp; You have [`npm`](https://www.npmjs.com/get-npm) installed in your machine.<br/>
&nbsp; You have read [CometChat Key Concepts](https://prodocs.cometchat.com/docs/concepts).<br/>

This guide demonstrates how to add chat to a Javascript application using CometChat. Before you begin, we strongly recommend you read the <a href="https://prodocs.cometchat.com/docs/concepts" target="_blank">Key Concepts</a> guide.
<hr/>

## Get your Application Keys
## Installing CometChat React Native SDK
## Setup :wrench:

To setup React Native SDK, you need to first register on CometChat Dashboard. [Click here to sign up](https://app.cometchat.com/login).

### i. Get your Application Keys :key:

<a href="https://app.cometchat.io" target="_blank">Signup for CometChat</a> and then:

1. Create a new app: Enter a name & hit the **+** button
2. Head over to the **API Keys** section and click on the **Create API Key** button
3. Enter a name and select the scope as **Auth Only**
4. Now note the **API Key** and **App ID**
1. Create a new app: Click **Add App** option available → Enter App Name & other information → Create App
2. At the Top in **QuickStart** section you will find **Auth Key** & **App ID** or else you can head over to the **API & Auth Keys** section and note the **Auth Key** and **App ID**
<img align="center" src="https://files.readme.io/4b771c5-qs_copy.jpg"/>

## Add the CometChat Dependency
<hr/>

### NPM
First, install via npm
### ii. Add the CometChat Dependency
<ul>
<li>
<b>Install via NPM</b><br/>
1. Run the following command to install the CometChat Pro React Native SDK<br/>

```javascript
npm install @cometchat-pro/react-native-chat@2.1.6 --save
```
npm install @cometchat-pro/[email protected] --save

You can refer to the below link for instructions on how to do so:<br/>
[📝 Add CometChat Dependency](https://prodocs.cometchat.com/docs/react-native-quick-start#add-the-cometchat-dependency)
</li>
</ul>
<hr/>

## Configure CometChat React Native SDK

### i. Initialize CometChat 🌟
We suggest you call the init() method on app startup, preferably in the index.js file.

```javascript
var appID = "APP_ID";
var region = "REGION";
var appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
CometChat.init(appID, appSetting).then(
() => {
console.log("Initialization completed successfully");
},
error => {
console.log("Initialization failed with error:", error);
}
);
```

Then, import the `CometChat` object wherever you want to use CometChat
| :information_source: &nbsp; <b> Note: Make sure to replace `region` and `appID` with your credentials.</b> |
|------------------------------------------------------------------------------------------------------------|

### ii. Create User 👤
Once initialisation is successful, you will need to create a user. You need to use createUser() method to create user on the fly.
```javascript
let authKey = "AUTH_KEY";
var uid = "user1";
var name = "Kevin";

var user = new CometChat.User(uid);

user.setName(name);

CometChat.createUser(user, authKey).then(
user => {
console.log("user created", user);
},error => {
console.log("error", error);
}
);
```
import { CometChat } from "@cometchat-pro/react-native-chat"
>:information_source: <b>Note: Make sure that UID and name are specified as these are mandatory fields to create a user.</b>
<hr/>
### iii. Login User 👤
Once you have created the user successfully, you will need to log the user into CometChat using the login() method.
```javascript
var UID = "SUPERHERO1";
var authKey = "AUTH_KEY";

CometChat.getLoggedinUser().then(
user => {
if(!user){
CometChat.login(UID, authKey).then(
user => {
console.log("Login Successful:", { user });
},
error => {
console.log("Login failed with exception:", { error });
}
);
}else{
// User already logged in
}
}, error => {
console.log("getLoggedinUser failed with exception:", { error });
}
);
```

| :information_source: &nbsp; <b>Note - The login() method needs to be called only once. Also replace AUTH_KEY with your App Auth Key.</b> |
|------------------------------------------------------------------------------------------------------------|

<hr/>

📝 Please refer to our [Developer Documentation](https://prodocs.cometchat.com/docs/react-native-quick-start) for more information on how to configure the CometChat Pro SDK and implement various features using the same.

<hr/>

## Learn more about UI-Kit
[React Native UI Kit](https://github.com/cometchat-pro/react-native-chat-ui-kit)

## Contributors :clap:
Thanks to the following people who have contributed to this project:
[👨‍💻 @mayur-bhandari](https://github.com/mayur-bhandari)
[👨‍💻 @jitvarpatil](https://github.com/jitvarpatil)

<hr/>

To learn more, please refer to our Documentation: <a href="https://prodocs.cometchat.com/docs/react-native-quick-start">Documentation</a>
## Contact :mailbox:
Contact us via real time support present in [CometChat Dashboard.](https://app.cometchat.io/)
<hr/>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cometchat-pro/react-native-chat",
"version": "2.1.6",
"version": "2.1.7",
"description": "A complete chat solution.",
"main": "CometChat.js",
"scripts": {
Expand Down

0 comments on commit 9e698f0

Please sign in to comment.