Skip to content

Commit

Permalink
v5.0.0-beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
jitvarpatil committed Jan 17, 2025
1 parent 110a107 commit f60e736
Show file tree
Hide file tree
Showing 247 changed files with 9,708 additions and 7,191 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ experience into an existing or a new app.
<img src="screenshots/overview_cometchat_screens.png">
</div>

## 🚀 Explore the Sample Apps!

Dive straight into our Sample Apps to see CometChat UI Kit in action! Whether you're building a messaging app or enhancing your existing project, this sample app showcases the full potential of our React UI components.
- [Sample App for Java](sample-app-java#readme)
- [Sample App for Java with Push Notifications](sample-app-java%2Bpush-notification#readme)
- [Sample App for Kotlin](sample-app-kotlin#readme)
- [Sample App for Kotlin with Push Notifications](sample-app-kotlin%2Bpush-notification#readme)

## Prerequisites

- Android Studio
Expand All @@ -38,12 +30,12 @@ To set up CometChat Android UI Kit and utilize CometChat for your chat functiona
2. After registering, log into your CometChat account and create a new app. Once created, CometChat will generate an Auth Key and App ID for you. Keep
these credentials secure as you'll need them later.

3. Check the [Key Concepts](https://www.cometchat.com/docs/fundamentals/key-concepts) to understand the basic components of CometChat.
3. Check the [Key Concepts](https://www.cometchat.com/docs/android-uikit/key-concepts) to understand the basic components of CometChat.

4. Refer to the [Integration Steps](https://www.cometchat.com/docs/ui-kit/android/5.0/getting-started) in our documentation to integrate the UI Kit into your
4. Refer to the [Integration Steps](https://www.cometchat.com/docs/android-uikit/integration) in our documentation to integrate the UI Kit into your
Android app.

## Help and Support

For issues running the project or integrating with our UI Kits, consult our [documentation](https://www.cometchat.com/docs/ui-kit/android/5.0/getting-started)
For issues running the project or integrating with our UI Kits, consult our [documentation](https://www.cometchat.com/docs/android-uikit/integration)
or create a [support ticket](https://help.cometchat.com/hc/en-us) or seek real-time support via the [CometChat Dashboard](https://app.cometchat.com/).
15 changes: 3 additions & 12 deletions chatuikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdk 24
versionCode 26
versionName "5.0.0-beta1"
versionName "5.0.0-beta2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"

Expand Down Expand Up @@ -97,20 +97,11 @@ android {

publishing {
repositories {

// maven {
// url = "$projectDir/distribution"
// }

maven {
name = "cloudsmith"
url = "https://api-g.cloudsmith.io/maven/cometchat/call-team"
credentials {
username = "jitvar-patil"
password = "d412ed679432a059fa33c31e324e223c7b1ed200"
}
url = "$projectDir/distribution"
}
}

publications {
maven(MavenPublication) {
groupId 'com.cometchat'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import com.cometchat.chatuikit.shared.models.CometChatMessageTemplate;
import com.cometchat.chatuikit.shared.resources.utils.Utils;
import com.cometchat.chatuikit.shared.viewholders.MessagesViewHolderListener;
import com.cometchat.chatuikit.shared.views.cometchatmessagebubble.CometChatMessageBubble;
import com.cometchat.chatuikit.shared.views.deletebubble.CometChatDeleteBubble;
import com.cometchat.chatuikit.shared.views.messagebubble.CometChatMessageBubble;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.cometchat.chatuikit.shared.interfaces.CallLogsClickListener;
import com.cometchat.chatuikit.shared.interfaces.Function2;
import com.cometchat.chatuikit.shared.resources.utils.Utils;
import com.cometchat.chatuikit.shared.views.cometchatdate.CometChatDate;
import com.cometchat.chatuikit.shared.views.date.CometChatDate;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import com.cometchat.chatuikit.R;
import com.cometchat.chatuikit.shared.interfaces.OnClick;
import com.cometchat.chatuikit.shared.views.cometchatdate.CometChatDate;
import com.cometchat.chatuikit.shared.views.date.CometChatDate;
import com.google.android.material.card.MaterialCardView;

public class CallTailView extends MaterialCardView {
Expand All @@ -25,16 +25,6 @@ public CallTailView(Context context) {
init(context);
}

public CallTailView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}

public CallTailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}

private void init(Context context) {
setStrokeWidth(0);
View view = View.inflate(context, R.layout.cometchat_call_tail_view, null);
Expand All @@ -50,6 +40,16 @@ public void onClick(View view) {
addView(view);
}

public CallTailView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}

public CallTailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}

public CometChatDate getChatDate() {
return chatDate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.cometchat.chatuikit.shared.utils.ConversationsUtils;
import com.cometchat.chatuikit.shared.utils.SubtitleView;
import com.cometchat.chatuikit.shared.viewholders.ConversationsViewHolderListener;
import com.cometchat.chatuikit.shared.views.cometchatstatusindicator.StatusIndicator;
import com.cometchat.chatuikit.shared.views.statusindicator.StatusIndicator;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.cometchat.chatuikit.shared.models.CometChatMessageTemplate;
import com.cometchat.chatuikit.shared.resources.utils.Utils;
import com.cometchat.chatuikit.shared.viewholders.MessagesViewHolderListener;
import com.cometchat.chatuikit.shared.views.cometchatmessagebubble.CometChatMessageBubble;
import com.cometchat.chatuikit.shared.views.messagebubble.CometChatMessageBubble;

import java.util.HashMap;
import java.util.List;
Expand All @@ -50,23 +50,6 @@ public CollaborativeDocumentExtensionDecorator(DataSource dataSource, Collaborat
this.configuration = configuration;
}

@Override
public List<String> getDefaultMessageTypes() {
List<String> types = super.getDefaultMessageTypes();
if (!types.contains(collaborativeDocumentExtensionTypeConstant)) {
types.add(collaborativeDocumentExtensionTypeConstant);
}
return types;
}

@Override
public List<String> getDefaultMessageCategories() {
List<String> categories = super.getDefaultMessageCategories();
if (!categories.contains(UIKitConstants.MessageCategory.CUSTOM))
categories.add(UIKitConstants.MessageCategory.CUSTOM);
return categories;
}

@Override
public List<CometChatMessageTemplate> getMessageTemplates(AdditionParameter additionParameter) {
List<CometChatMessageTemplate> templates = super.getMessageTemplates(additionParameter);
Expand All @@ -75,61 +58,62 @@ public List<CometChatMessageTemplate> getMessageTemplates(AdditionParameter addi
}

@Override
public List<CometChatMessageComposerAction> getAttachmentOptions(Context context, @Nullable User user, Group group, HashMap<String, String> idMap) {
public List<CometChatMessageComposerAction> getAttachmentOptions(Context context,
@Nullable User user,
Group group,
HashMap<String, String> idMap) {
if (!idMap.containsKey(UIKitConstants.MapId.PARENT_MESSAGE_ID)) {
List<CometChatMessageComposerAction> messageComposerActions = super.getAttachmentOptions(context, user, group, idMap);
messageComposerActions.add(new CometChatMessageComposerAction().setId(ExtensionConstants.ExtensionType.DOCUMENT).setTitle(context.getString(R.string.cometchat_collaborative_doc)).setIcon(R.drawable.cometchat_ic_collaborative_document).setTitleColor(CometChatTheme.getTextColorPrimary(context)).setTitleAppearance(CometChatTheme.getTextAppearanceBodyRegular(context)).setIconTintColor(CometChatTheme.getIconTintHighlight(context)).setBackground(CometChatTheme.getBackgroundColor1(context)).setOnClick(() -> {
String id, type;
id = user != null ? user.getUid() : group.getGuid();
type = user != null ? UIKitConstants.ReceiverType.USER : UIKitConstants.ReceiverType.GROUP;
Extensions.callWriteBoardExtension(id, type, new ExtensionResponseListener() {
@Override
public void OnResponseSuccess(Object var) {
}

@Override
public void OnResponseFailed(CometChatException e) {
showError(context);
}
});
}));
messageComposerActions.add(new CometChatMessageComposerAction()
.setId(ExtensionConstants.ExtensionType.DOCUMENT)
.setTitle(context.getString(R.string.cometchat_collaborative_doc))
.setIcon(R.drawable.cometchat_ic_collaborative_document)
.setTitleColor(CometChatTheme.getTextColorPrimary(context))
.setTitleAppearance(CometChatTheme.getTextAppearanceBodyRegular(context))
.setIconTintColor(CometChatTheme.getIconTintHighlight(context))
.setBackground(CometChatTheme.getBackgroundColor1(context))
.setOnClick(() -> {
String id, type;
id = user != null ? user.getUid() : group.getGuid();
type = user != null ? UIKitConstants.ReceiverType.USER : UIKitConstants.ReceiverType.GROUP;
Extensions.callWriteBoardExtension(id, type, new ExtensionResponseListener() {
@Override
public void OnResponseSuccess(Object var) {
}

@Override
public void OnResponseFailed(CometChatException e) {
showError(context);
}
});
}));
return messageComposerActions;
} else return super.getAttachmentOptions(context, user, group, idMap);
}

private void showError(Context context) {
String errorMessage = context.getString(R.string.cometchat_something_went_wrong);
Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT).show();
@Override
public List<String> getDefaultMessageTypes() {
List<String> types = super.getDefaultMessageTypes();
if (!types.contains(collaborativeDocumentExtensionTypeConstant)) {
types.add(collaborativeDocumentExtensionTypeConstant);
}
return types;
}

public CometChatMessageTemplate getWhiteBoardTemplate(AdditionParameter additionParameter) {
return new CometChatMessageTemplate().setCategory(UIKitConstants.MessageCategory.CUSTOM).setType(collaborativeDocumentExtensionTypeConstant).setOptions((context, baseMessage, isLeftAlign) -> ChatConfigurator.getDataSource().getCommonOptions(context, baseMessage, isLeftAlign)).setContentView(new MessagesViewHolderListener() {
@NonNull
@Override
public View createView(Context context, CometChatMessageBubble messageBubble, UIKitConstants.MessageBubbleAlignment alignment) {
return CollaborativeUtils.getCollaborativeBubbleView(context, configuration, "Collaborative Document", "Open document to edit content together.", "Open Document");
}

@Override
public void bindView(Context context, View createdView, @NonNull BaseMessage message, UIKitConstants.MessageBubbleAlignment alignment, RecyclerView.ViewHolder holder, List<BaseMessage> messageList, int position) {
CollaborativeUtils.bindWriteBordCollaborativeBubble(context, createdView, CometChatUIKit.getLoggedInUser().getUid().equals(message.getSender().getUid()) ? additionParameter.getOutgoingCollaborativeBubbleStyle() : additionParameter.getIncomingCollaborativeBubbleStyle(), message, additionParameter);
}
}).setBottomView(new MessagesViewHolderListener() {
@Override
public View createView(Context context, CometChatMessageBubble messageBubble, UIKitConstants.MessageBubbleAlignment alignment) {
return CometChatUIKit.getDataSource().getBottomView(context, messageBubble, alignment);
}

@Override
public void bindView(Context context, View createdView, BaseMessage message, UIKitConstants.MessageBubbleAlignment alignment, RecyclerView.ViewHolder holder, List<BaseMessage> messageList, int position) {
CometChatUIKit.getDataSource().bindBottomView(context, createdView, message, alignment, holder, messageList, position, additionParameter);
}
});
@Override
public List<String> getDefaultMessageCategories() {
List<String> categories = super.getDefaultMessageCategories();
if (!categories.contains(UIKitConstants.MessageCategory.CUSTOM))
categories.add(UIKitConstants.MessageCategory.CUSTOM);
return categories;
}

@Override
public SpannableString getLastConversationMessage(Context context, Conversation conversation, AdditionParameter additionParameter) {
if (conversation != null && conversation.getLastMessage() != null && (UIKitConstants.MessageCategory.CUSTOM.equals(conversation.getLastMessage().getCategory()) && ExtensionConstants.ExtensionType.DOCUMENT.equalsIgnoreCase(conversation.getLastMessage().getType())))
if (conversation != null && conversation.getLastMessage() != null && (UIKitConstants.MessageCategory.CUSTOM.equals(conversation
.getLastMessage()
.getCategory()) && ExtensionConstants.ExtensionType.DOCUMENT.equalsIgnoreCase(
conversation.getLastMessage().getType())))
return SpannableString.valueOf(getLastConversationMessage_(context, conversation, additionParameter));
else return super.getLastConversationMessage(context, conversation, additionParameter);
}
Expand Down Expand Up @@ -157,6 +141,68 @@ public String getLastMessage(Context context, BaseMessage lastMessage) {
return Utils.getMessagePrefix(lastMessage, context) + context.getString(R.string.cometchat_document);
}

private void showError(Context context) {
String errorMessage = context.getString(R.string.cometchat_something_went_wrong);
Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT).show();
}

public CometChatMessageTemplate getWhiteBoardTemplate(AdditionParameter additionParameter) {
return new CometChatMessageTemplate()
.setCategory(UIKitConstants.MessageCategory.CUSTOM)
.setType(collaborativeDocumentExtensionTypeConstant)
.setOptions((context, baseMessage, isLeftAlign) -> ChatConfigurator.getDataSource().getCommonOptions(context, baseMessage, isLeftAlign))
.setContentView(new MessagesViewHolderListener() {
@NonNull
@Override
public View createView(Context context, CometChatMessageBubble messageBubble, UIKitConstants.MessageBubbleAlignment alignment) {
return CollaborativeUtils.getCollaborativeBubbleView(context,
configuration,
"Collaborative Document",
"Open document to edit content together.",
"Open Document");
}

@Override
public void bindView(Context context,
View createdView,
@NonNull BaseMessage message,
UIKitConstants.MessageBubbleAlignment alignment,
RecyclerView.ViewHolder holder,
List<BaseMessage> messageList,
int position) {
CollaborativeUtils.bindWriteBordCollaborativeBubble(context,
createdView,
CometChatUIKit
.getLoggedInUser()
.getUid()
.equals(message
.getSender()
.getUid()) ? additionParameter.getOutgoingCollaborativeBubbleStyle() : additionParameter.getIncomingCollaborativeBubbleStyle(),
message,
additionParameter);
}
})
.setBottomView(new MessagesViewHolderListener() {
@Override
public View createView(Context context, CometChatMessageBubble messageBubble, UIKitConstants.MessageBubbleAlignment alignment) {
return CometChatUIKit.getDataSource().getBottomView(context, messageBubble, alignment);
}

@Override
public void bindView(Context context,
View createdView,
BaseMessage message,
UIKitConstants.MessageBubbleAlignment alignment,
RecyclerView.ViewHolder holder,
List<BaseMessage> messageList,
int position) {
CometChatUIKit
.getDataSource()
.bindBottomView(context, createdView, message, alignment, holder, messageList, position, additionParameter);
}
});
}

@Override
public String getId() {
return CollaborativeDocumentExtensionDecorator.class.getSimpleName();
Expand Down
Loading

0 comments on commit f60e736

Please sign in to comment.