Skip to content

Commit

Permalink
UI with SDK v2
Browse files Browse the repository at this point in the history
  • Loading branch information
yadavmangesh committed Sep 18, 2019
1 parent 7f61fb8 commit 88fcb37
Show file tree
Hide file tree
Showing 26 changed files with 582 additions and 175 deletions.
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title: "[SDK-Version] Issue Title "
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Actual behavior**
A clear and concise description of what you exactly is happening.

**Screenshots** (optional)
If applicable, add screenshots to help explain your problem.

**Enviorment/Platfrom (please complete the following information):**
- Android API Version[ e.g 21 ]
- CometChat SDK Version[ e.g. 1.8.3]

**Files (Optional)**
- `build.gradle` (App Level)
- `build.gradle` (Project Level)

**Logs (Error Logs)**
- Error Log
- Debug Log

**Additional context**
Add any other context about the problem here.
7 changes: 2 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-emoji-appcompat:28.0.0'
Expand All @@ -61,17 +61,14 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

//cometchat sdk
implementation 'com.cometchat:pro-android-chat-sdk:1.8.5'
implementation 'com.cometchat:pro-android-chat-sdk:2.0.0-beta2'

implementation 'com.android.support:recyclerview-selection:28.0.0'

implementation 'com.facebook.shimmer:shimmer:0.4.0'

}

repositories {
mavenCentral()

}


Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.support.test.runner.AndroidJUnitRunner;
import android.util.Log;
import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.core.AppSettings;
import com.cometchat.pro.core.BannedGroupMembersRequest;
import com.cometchat.pro.core.BlockedUsersRequest;
import com.cometchat.pro.core.CometChat;
Expand Down Expand Up @@ -64,8 +65,8 @@ public class ExampleInstrumentedTest {
@Test
public void init() {
CountDownLatch countDownLatch = new CountDownLatch(1);

CometChat.init(appContext, StringContract.AppDetails.API_KEY, new CometChat.CallbackListener<String>() {
AppSettings appSettings=new AppSettings.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion("us").build();
CometChat.init(appContext, StringContract.AppDetails.API_KEY,appSettings, new CometChat.CallbackListener<String>() {
@Override
public void onSuccess(String s) {
Log.d(TAG, "init onSuccess: " + s);
Expand Down Expand Up @@ -188,7 +189,7 @@ public void sendTextMessage() {

CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage("superhero1", "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage textMessage = new TextMessage("superhero1", "Hello", CometChatConstants.RECEIVER_TYPE_USER);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -222,7 +223,7 @@ public void sendMessageWithInvalidUID() {

CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage("", "hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage textMessage = new TextMessage("", "hello", CometChatConstants.RECEIVER_TYPE_USER);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -253,7 +254,7 @@ public void onError(CometChatException e) {
public void sendTextMessageWithImageType() {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.RECEIVER_TYPE_USER);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -284,7 +285,7 @@ public void sendTextMessageWithNullText() {
CountDownLatch countDownLatch = new CountDownLatch(1);


TextMessage textMessage = new TextMessage(UID, null, CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage textMessage = new TextMessage(UID, null, CometChatConstants.RECEIVER_TYPE_USER);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -316,7 +317,7 @@ public void sendTextMessageWithInvalidPara() {
CountDownLatch countDownLatch = new CountDownLatch(1);


TextMessage textMessage = new TextMessage(UID, null,CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.CATEGORY_MESSAGE);
TextMessage textMessage = new TextMessage(UID, null,CometChatConstants.CATEGORY_MESSAGE);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -348,7 +349,7 @@ public void onError(CometChatException e) {
public void sendTextMessageWithGroupType() {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_GROUP);
TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.RECEIVER_TYPE_GROUP);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -378,7 +379,7 @@ public void sendTextMessageInvalidTypeAndEmptyMessage() {

CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(UID, "",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_GROUP);
TextMessage textMessage = new TextMessage(UID, "", CometChatConstants.RECEIVER_TYPE_GROUP);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -612,7 +613,7 @@ public void sendTextMessageWithNullPara() {
// customData.put("lattitue","19.0760");
// customData.put("longitude","72.8777");

TextMessage textMessage = new TextMessage(null, null, CometChatConstants.MESSAGE_TYPE_TEXT,null);
TextMessage textMessage = new TextMessage(null, null, null);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -685,7 +686,7 @@ public void sendTextMessageWithNullMessageAndReceiverType() {

CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.MESSAGE_TYPE_TEXT,null);
TextMessage textMessage = new TextMessage(UID, "Hello", null);

CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
Expand Down Expand Up @@ -719,7 +720,7 @@ public void sendTextMessageWithMetaData() {
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.RECEIVER_TYPE_USER);

JSONObject customData = new JSONObject();
customData.put("lattitue", "19.0760");
Expand Down Expand Up @@ -759,7 +760,7 @@ public void sendTextMessageWithNullMetaData() {
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.RECEIVER_TYPE_USER);

textMessage.setMetadata(null);

Expand Down Expand Up @@ -795,7 +796,7 @@ public void sendTextMessageWithMetaGroupType() {
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(GUID, "Hello", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_GROUP);
TextMessage textMessage = new TextMessage(GUID, "Hello",CometChatConstants.RECEIVER_TYPE_GROUP);

JSONObject customData = new JSONObject();

Expand Down Expand Up @@ -837,7 +838,7 @@ public void sendTextMessageWithMetaAndMUID() {
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage textMessage = new TextMessage(GUID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_GROUP);
TextMessage textMessage = new TextMessage(GUID, "Hello", CometChatConstants.RECEIVER_TYPE_GROUP);

JSONObject customData = new JSONObject();

Expand Down Expand Up @@ -1176,7 +1177,7 @@ public void sendEditMessage(){
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage message = new TextMessage(UID, "text",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage message = new TextMessage(UID, "text", CometChatConstants.RECEIVER_TYPE_USER);
message.setId(MESSAGE_ID);

CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() {
Expand Down Expand Up @@ -1210,7 +1211,7 @@ public void sendEditTextMessageWithImageType(){
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage message = new TextMessage(UID, "Hey", CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage message = new TextMessage(UID, "Hey", CometChatConstants.RECEIVER_TYPE_USER);
message.setId(398);

CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() {
Expand Down Expand Up @@ -1245,7 +1246,7 @@ public void sendEditMessageWithTypeGroup(){
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage message = new TextMessage(UID, "Edit text Message ", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_GROUP);
TextMessage message = new TextMessage(UID, "Edit text Message ", CometChatConstants.RECEIVER_TYPE_GROUP);
message.setId(489);

CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() {
Expand Down Expand Up @@ -1280,7 +1281,7 @@ public void sendEditMessageWithNull(){
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage message = new TextMessage(UID, null,CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER);
TextMessage message = new TextMessage(UID, null, CometChatConstants.RECEIVER_TYPE_USER);
message.setId(489);

CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() {
Expand Down Expand Up @@ -1315,7 +1316,7 @@ public void sendEditMessageWithWrongId(){
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage message = new TextMessage(UID, "h",CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_USER);
TextMessage message = new TextMessage(UID, "h",CometChatConstants.RECEIVER_TYPE_USER);
message.setId(48);

CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() {
Expand Down Expand Up @@ -1352,7 +1353,7 @@ public void sendEditMessageWithEmpty(){
try {
CountDownLatch countDownLatch = new CountDownLatch(1);

TextMessage message = new TextMessage(UID, "", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_USER);
TextMessage message = new TextMessage(UID, "",CometChatConstants.RECEIVER_TYPE_USER);
message.setId(489);

CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() {
Expand Down Expand Up @@ -3535,7 +3536,7 @@ public void test_GroupMemberRequestWithZeroLimit(){
@Override
public void onSuccess(List<GroupMember> groupMembers) {
Log.d(TAG, "test_GroupMemberRequestWithZeroLimit onSuccess: "+groupMembers.size());
assertEquals(3,groupMembers.size());
assertEquals(5,groupMembers.size());
countDownLatch.countDown();
}

Expand Down
52 changes: 23 additions & 29 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,33 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.inscripts.cometchatpulse.demo">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />

<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />

<application
android:name=".CometApplication"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@mipmap/cc_small"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/cc_small"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:largeHeap="true"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup">


<!--<provider-->
<!--android:name="com.google.firebase.provider.FirebaseInitProvider"-->
<!--android:authorities="${applicationId}.firebaseinitprovider"-->
<!--tools:node="remove"-->
<!--/>-->


<activity android:name=".Activity.BlockedUserListActivity"></activity>

<activity android:name=".Activity.MessageInfoActivity"></activity>
<!-- <provider -->
<!-- android:name="com.google.firebase.provider.FirebaseInitProvider" -->
<!-- android:authorities="${applicationId}.firebaseinitprovider" -->
<!-- tools:node="remove" -->
<!-- /> -->
<activity android:name=".Activity.BlockedUserListActivity" />
<activity
android:name=".Activity.CometChatActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait" >

android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SEARCH"/>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>

</activity>
<activity
android:name=".Activity.OneToOneChatActivity"
Expand Down Expand Up @@ -85,5 +66,18 @@
<activity android:name=".Activity.CallActivity" />
<activity android:name=".Activity.SelectUserActivity" />
</application>
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-permission android:name="android.permission.VIBRATE" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,6 @@ public void onPageScrollStateChanged(int i) {
@Override
protected void onStart() {
super.onStart();

CometChat.addGroupListener(TAG, new CometChat.GroupListener() {
@Override
public void onMemberAddedToGroup(Action action, User addedby, User userAdded, Group addedTo) {
super.onMemberAddedToGroup(action, addedby, userAdded, addedTo);
Log.d(TAG, "onMemberAddedToGroup: "+"action \n"+action+" \n addedby "+addedby+ " \n userAdded "+userAdded + " \n addedTo "+addedTo);
}

@Override
public void onAddedToGroup(Action action, User addedby, User userAdded, Group addedTo) {
super.onAddedToGroup(action, addedby, userAdded, addedTo);
Log.d(TAG, "onAddedToGroup: "+"action \n"+action+" \n addedby "+addedby+ " \n userAdded "+userAdded + " \n addedTo "+addedTo);
}
});
}

@Override
Expand Down
Loading

0 comments on commit 88fcb37

Please sign in to comment.