Skip to content

Commit cc7bd47

Browse files
Android UIKit v3.0.0-beta4-1
1 parent c831d82 commit cc7bd47

File tree

132 files changed

+4858
-2259
lines changed

Some content is hidden

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

132 files changed

+4858
-2259
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<img src="https://img.shields.io/badge/Repo%20Size-18.6%20MB-blue" />
1414
![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/android-java-chat-app)
1515
![GitHub stars](https://img.shields.io/github/stars/cometchat-pro/android-java-chat-app?style=social)
16-
![Version](https://shields.io/badge/version-v3.0.0--beta1--2-orange)
16+
![Version](https://shields.io/badge/version-v3.0.0--beta4--2-orange)
1717
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)
1818

1919
<img src="https://files.readme.io/952af91-UI_Kit__1.png"/>

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ dependencies {
7676
implementation 'com.facebook.shimmer:shimmer:0.4.0'
7777

7878
//
79-
implementation 'com.cometchat:pro-android-chat-sdk:3.0.0-beta1'
79+
implementation 'com.cometchat:pro-android-chat-sdk:3.0.0-beta4'
8080
}

uikit/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ dependencies {
9090
implementation 'com.google.android.gms:play-services-location:17.0.0'
9191
implementation 'com.google.android.gms:play-services-maps:17.0.0'
9292
//cometchat
93-
compileOnly 'com.cometchat:pro-android-chat-sdk:3.0.0-beta1'
93+
compileOnly 'com.cometchat:pro-android-chat-sdk:3.0.0-beta4'
9494

9595
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0'
9696
}

uikit/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
android:usesCleartextTraffic="true"
2121
tools:node="merge"
2222
tools:targetApi="m">
23-
<activity android:name=".ui_components.messages.extensions.Collaborative.CometChatCollaborativeActivity"/>
23+
<activity android:name=".ui_components.messages.extensions.Collaborative.CometChatWebViewActivity"/>
2424
<activity
2525
android:name=".ui_components.messages.extensions.Reactions.CometChatReactionInfoActivity"/>
2626
<activity android:name=".ui_components.messages.media_view.CometChatMediaViewActivity" />

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/AllCall.java

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import androidx.recyclerview.widget.LinearLayoutManager;
1717
import androidx.recyclerview.widget.RecyclerView;
1818

19+
import com.cometchat.pro.constants.CometChatConstants;
1920
import com.cometchat.pro.core.Call;
2021
import com.cometchat.pro.core.CometChat;
2122
import com.cometchat.pro.core.MessagesRequest;
@@ -28,6 +29,7 @@
2829
import com.cometchat.pro.uikit.R;
2930
import com.cometchat.pro.uikit.ui_resources.utils.CometChatError;
3031
import com.cometchat.pro.uikit.ui_resources.utils.Utils;
32+
import com.cometchat.pro.uikit.ui_settings.FeatureRestriction;
3133
import com.google.android.material.snackbar.Snackbar;
3234

3335
import java.util.Arrays;
@@ -57,9 +59,15 @@ public class AllCall extends Fragment {
5759
private MessagesRequest messagesRequest;
5860

5961
private LinearLayoutManager linearLayoutManager;
62+
63+
private boolean videoCallEnabled;
64+
private boolean audioCallEnabled;
65+
6066
@Override
6167
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
6268
View view = inflater.inflate(R.layout.fragment_cometchat_all_call, container, false);
69+
fetchSettings();
70+
CometChatError.init(getContext());
6371
rvCallList = view.findViewById(R.id.callList_rv);
6472
linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false
6573
);
@@ -68,7 +76,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
6876
rvCallList.setItemClickListener(new OnItemClickListener<Call>() {
6977
@Override
7078
public void OnItemClick(Call var, int position) {
71-
if (var.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) {
79+
if (var.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) {
7280
User user;
7381
if (((User)var.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) {
7482
user = ((User)var.getCallReceiver());
@@ -81,6 +89,7 @@ public void OnItemClick(Call var, int position) {
8189
intent.putExtra(UIKitConstants.IntentStrings.NAME, user.getName());
8290
intent.putExtra(UIKitConstants.IntentStrings.AVATAR, user.getAvatar());
8391
intent.putExtra(UIKitConstants.IntentStrings.STATUS, user.getStatus());
92+
intent.putExtra(UIKitConstants.IntentStrings.LINK,user.getLink());
8493
intent.putExtra(UIKitConstants.IntentStrings.IS_BLOCKED_BY_ME, user.isBlockedByMe());
8594
intent.putExtra(UIKitConstants.IntentStrings.FROM_CALL_LIST,true);
8695
startActivity(intent);
@@ -121,7 +130,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat
121130
}
122131

123132
private void checkOnGoingCall(Call var) {
124-
if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(com.cometchat.pro.constants.CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null)
133+
if(CometChat.getActiveCall()!=null && CometChat.getActiveCall().getCallStatus().equals(CometChatConstants.CALL_STATUS_ONGOING) && CometChat.getActiveCall().getSessionId()!=null)
125134
{
126135
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
127136
alert.setTitle(getContext().getResources().getString(R.string.ongoing_call))
@@ -139,22 +148,28 @@ public void onClick(DialogInterface dialog, int which) {
139148
}).create().show();
140149
}
141150
else {
142-
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
143-
alertDialog.setMessage(getString(R.string.initiate_a_call));
144-
alertDialog.setPositiveButton(getString(R.string.audio_call), new DialogInterface.OnClickListener() {
145-
@Override
146-
public void onClick(DialogInterface dialogInterface, int i) {
147-
initiateCall(var, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_AUDIO);
151+
if (audioCallEnabled || videoCallEnabled) {
152+
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
153+
alertDialog.setMessage(getString(R.string.initiate_a_call));
154+
if (audioCallEnabled) {
155+
alertDialog.setPositiveButton(getString(R.string.audio_call), new DialogInterface.OnClickListener() {
156+
@Override
157+
public void onClick(DialogInterface dialogInterface, int i) {
158+
initiateCall(var, CometChatConstants.CALL_TYPE_AUDIO);
159+
}
160+
});
148161
}
149-
});
150-
alertDialog.setNegativeButton(getString(R.string.video_call), new DialogInterface.OnClickListener() {
151-
@Override
152-
public void onClick(DialogInterface dialogInterface, int i) {
153-
initiateCall(var, com.cometchat.pro.constants.CometChatConstants.CALL_TYPE_VIDEO);
162+
if (videoCallEnabled) {
163+
alertDialog.setNegativeButton(getString(R.string.video_call), new DialogInterface.OnClickListener() {
164+
@Override
165+
public void onClick(DialogInterface dialogInterface, int i) {
166+
initiateCall(var, CometChatConstants.CALL_TYPE_VIDEO);
167+
}
168+
});
154169
}
155-
});
156-
alertDialog.create();
157-
alertDialog.show();
170+
alertDialog.create();
171+
alertDialog.show();
172+
}
158173
}
159174

160175
}
@@ -164,7 +179,7 @@ private void initiateCall(Call var,String callType) {
164179
@Override
165180
public void onSuccess(Call call) {
166181
Log.e("onSuccess: ", call.toString());
167-
if (call.getReceiverType().equals(com.cometchat.pro.constants.CometChatConstants.RECEIVER_TYPE_USER)) {
182+
if (call.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) {
168183
User user;
169184
if (((User) call.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) {
170185
user = ((User) call.getCallReceiver());
@@ -192,7 +207,7 @@ private void getCallList() {
192207
if (messagesRequest == null)
193208
{
194209
messagesRequest = new MessagesRequest.MessagesRequestBuilder().
195-
setCategories(Arrays.asList(com.cometchat.pro.constants.CometChatConstants.CATEGORY_CALL)).setLimit(30).build();
210+
setCategories(Arrays.asList(CometChatConstants.CATEGORY_CALL)).setLimit(30).build();
196211
}
197212

198213
messagesRequest.fetchPrevious(new CometChat.CallbackListener<List<BaseMessage>>() {
@@ -229,4 +244,19 @@ public void setMenuVisibility(boolean menuVisible) {
229244
public void onResume() {
230245
super.onResume();
231246
}
247+
248+
private void fetchSettings() {
249+
FeatureRestriction.isOneOnOneVideoCallEnabled(new FeatureRestriction.OnSuccessListener() {
250+
@Override
251+
public void onSuccess(Boolean booleanVal) {
252+
videoCallEnabled = booleanVal;
253+
}
254+
});
255+
FeatureRestriction.isOneOnOneAudioCallEnabled(new FeatureRestriction.OnSuccessListener() {
256+
@Override
257+
public void onSuccess(Boolean booleanVal) {
258+
audioCallEnabled = booleanVal;
259+
}
260+
});
261+
}
232262
}

uikit/src/main/java/com/cometchat/pro/uikit/ui_components/calls/call_list/CometChatCallList.java

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.cometchat.pro.core.MessagesRequest;
2121
import com.cometchat.pro.uikit.R;
2222
import com.cometchat.pro.uikit.ui_components.shared.cometchatCalls.CometChatCalls;
23+
import com.cometchat.pro.uikit.ui_resources.utils.CometChatError;
2324
import com.facebook.shimmer.ShimmerFrameLayout;
2425
import com.google.android.material.tabs.TabLayout;
2526

@@ -28,7 +29,7 @@
2829

2930
import com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener;
3031

31-
import com.cometchat.pro.uikit.ui_settings.UISettings;
32+
import com.cometchat.pro.uikit.ui_settings.FeatureRestriction;
3233

3334
import com.cometchat.pro.uikit.ui_resources.utils.Utils;
3435

@@ -68,6 +69,10 @@ public class CometChatCallList extends Fragment {
6869

6970
private ImageView phoneAddIv;
7071

72+
private boolean oneOnoneCallEnabled;
73+
74+
private boolean oneOnoneVideoCallEnabled;
75+
7176
public CometChatCallList() {
7277
// Required empty public constructor
7378
}
@@ -78,7 +83,14 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
7883
// Inflate the layout for this fragment
7984
view = inflater.inflate(R.layout.fragment_cometchat_calls, container, false);
8085
tvTitle = view.findViewById(R.id.tv_title);
86+
fetchSettings();
87+
CometChatError.init(getContext());
8188
phoneAddIv = view.findViewById(R.id.add_phone_iv);
89+
if (oneOnoneCallEnabled || oneOnoneVideoCallEnabled)
90+
phoneAddIv.setVisibility(View.VISIBLE);
91+
else
92+
phoneAddIv.setVisibility(View.GONE);
93+
8294
phoneAddIv.setOnClickListener(new View.OnClickListener() {
8395
@Override
8496
public void onClick(View v) {
@@ -94,13 +106,13 @@ public void onClick(View v) {
94106
viewPager.setAdapter(tabAdapter);
95107
}
96108
tabLayout.setupWithViewPager(viewPager);
97-
if (UISettings.getColor()!=null) {
98-
phoneAddIv.setImageTintList(ColorStateList.valueOf(Color.parseColor(UISettings.getColor())));
109+
if (FeatureRestriction.getColor()!=null) {
110+
phoneAddIv.setImageTintList(ColorStateList.valueOf(Color.parseColor(FeatureRestriction.getColor())));
99111
Drawable wrappedDrawable = DrawableCompat.wrap(getResources().
100112
getDrawable(R.drawable.tab_layout_background_active));
101-
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(UISettings.getColor()));
113+
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(FeatureRestriction.getColor()));
102114
tabLayout.getTabAt(tabLayout.getSelectedTabPosition()).view.setBackground(wrappedDrawable);
103-
tabLayout.setSelectedTabIndicatorColor(Color.parseColor(UISettings.getColor()));
115+
tabLayout.setSelectedTabIndicatorColor(Color.parseColor(FeatureRestriction.getColor()));
104116
} else {
105117
tabLayout.getTabAt(tabLayout.getSelectedTabPosition()).
106118
view.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
@@ -109,10 +121,10 @@ public void onClick(View v) {
109121
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
110122
@Override
111123
public void onTabSelected(TabLayout.Tab tab) {
112-
if (UISettings.getColor()!=null) {
124+
if (FeatureRestriction.getColor()!=null) {
113125
Drawable wrappedDrawable = DrawableCompat.wrap(getResources().
114126
getDrawable(R.drawable.tab_layout_background_active));
115-
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(UISettings.getColor()));
127+
DrawableCompat.setTint(wrappedDrawable, Color.parseColor(FeatureRestriction.getColor()));
116128
tab.view.setBackground(wrappedDrawable);
117129
}
118130
else
@@ -133,6 +145,21 @@ public void onTabReselected(TabLayout.Tab tab) {
133145
return view;
134146
}
135147

148+
private void fetchSettings() {
149+
FeatureRestriction.isOneOnOneAudioCallEnabled(new FeatureRestriction.OnSuccessListener() {
150+
@Override
151+
public void onSuccess(Boolean booleanVal) {
152+
oneOnoneCallEnabled = booleanVal;
153+
}
154+
});
155+
FeatureRestriction.isOneOnOneVideoCallEnabled(new FeatureRestriction.OnSuccessListener() {
156+
@Override
157+
public void onSuccess(Boolean booleanVal) {
158+
oneOnoneVideoCallEnabled = booleanVal;
159+
}
160+
});
161+
}
162+
136163
private void checkDarkMode() {
137164
if(Utils.isDarkMode(getContext())) {
138165
tvTitle.setTextColor(getResources().getColor(R.color.textColorWhite));

0 commit comments

Comments
 (0)