Skip to content

Commit

Permalink
Added 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rimdoo committed Nov 10, 2022
1 parent 2f28341 commit c920e28
Show file tree
Hide file tree
Showing 187 changed files with 9,399 additions and 4,393 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

### v3.3.0 (Nov 10, 2022) with Core SDK `v4.1.1`
* Support thread type in GroupChannel
* Added `THREAD` in `ReplyType`
* Added `enum ThreadReplySelectType { PARENT, THREAD }`
* Added `setThreadReplySelectType(threadReplySelectType)` in `SendBirdUIKit`
* Added `getThreadReplySelectType()` in `SendBirdUIKit`
* Added `MessageThreadActivity`, `MessageThreadFragment`, `MessageThreadModule`, `MessageThreadViewModel`, `MessageThreadHeaderComponent`, `ThreadListComponent`, `MessageThreadInputComponent`, and `ThreadListAdapter`
* Added `newRedirectToMessageThreadIntent(Context, String, long)` in `ChannelActivity`
* Added `VIEW_TYPE_PARENT_MESSAGE_INFO` in `MessageType`
* Added `ThreadInfo`, `ParentMessageMenu` in `ClickableViewIdentifier`
* Added `onThreadInfoClicked(View, int, BaseMessage)` in `ChannelFragment`
* Added `setOnThreadInfoClickListener(OnItemClickListener<BaseMessage>)` in `ChannelFragment.Builder`
* Added `MessageListUIParams` class
* Added `bind(BaseChannel, BaseMessage, MessageListUIParams)` in `MessageViewHolder`
* Added `createViewHolder(LayoutInflater, ViewGroup, MessageType, MessageListUIParams)` in `MessageViewHolderFactory`
* Added `createOpenChannelViewHolder(LayoutInflater, ViewGroup, MessageType, MessageListUIParams)` in `MessageViewHolderFactory`
* Deprecated `bind(BaseChannel, BaseMessage, MessageGroupType)` in `MessageViewHolder`
* Deprecated `createViewHolder(LayoutInflater, ViewGroup, MessageType, boolean)` in `MessageViewHolderFactory`
* Deprecated `createOpenChannelViewHolder(LayoutInflater, ViewGroup, MessageType, boolean)` in `MessageViewHolderFactory`
* Added `setUseMessageListBanner(boolean)` in `ChannelFragment.Builder`
* Added `setUseBanner(boolean)` in `MessageListComponent.Params`
* Added `setUseUserIdForNickname(boolean)` and `isUsingUserIdForNickname()` in `SendbirdUIKit`

### v3.2.2 (Oct 27, 2022) with Core SDK `v4.1.1`
* Added `setOnScrollFirstButtonClickListener(OnConsumableClickListener)` in `ChannelFragment.Builder` and `OpenChannelFragment.Builder`
* Added `scrollToFirst()`, `setOnScrollFirstButtonClickListener(OnConsumableClickListener)`, and `onScrollFirstButtonClicked(View)` in `MessageListComponent` and `OpemChannelMessageListComponent`
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ org.gradle.jvmargs=-Xmx1536m
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

UIKIT_VERSION = 3.2.2
UIKIT_VERSION = 3.3.0
UIKIT_VERSION_CODE = 1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.sendbird.android.user.query.ApplicationUserListQuery;
import com.sendbird.uikit.SendbirdUIKit;
import com.sendbird.uikit.adapter.SendbirdUIKitAdapter;
import com.sendbird.uikit.consts.ReplyType;
import com.sendbird.uikit.consts.ThreadReplySelectType;
import com.sendbird.uikit.customsample.consts.InitState;
import com.sendbird.uikit.customsample.consts.StringSet;
import com.sendbird.uikit.customsample.fcm.MyFirebaseMessagingService;
Expand Down Expand Up @@ -112,6 +114,9 @@ public void onInitSucceed() {
SendbirdUIKit.setLogLevel(SendbirdUIKit.LogLevel.ALL);
// set whether to use user profile
SendbirdUIKit.setUseDefaultUserProfile(false);
// set reply type
SendbirdUIKit.setReplyType(ReplyType.THREAD);
SendbirdUIKit.setThreadReplySelectType(ThreadReplySelectType.THREAD);
// set custom user list query
SendbirdUIKit.setCustomUserListQueryHandler(getCustomUserListQuery());
initState.setValue(InitState.SUCCEED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ public class StringSet {
public static final String CHANNEL_ID = "CHANNEL_ID";
public static final String KEY_CHANNEL_URL = "KEY_CHANNEL_URL";
public static final String PUSH_REDIRECT_CHANNEL = "PUSH_REDIRECT_CHANNEL";
public static final String PUSH_REDIRECT_MESSAGE_ID = "PUSH_REDIRECT_MESSAGE_ID";
public static final String SETTINGS_USE_DO_NOT_DISTURB = "SETTINGS_USE_DO_NOT_DISTURB";
public static final String KEY_INPUT_TEXT = "KEY_INPUT_TEXT";

public static final String sendbird = "sendbird";
public static final String channel = "channel";
public static final String channel_url = "channel_url";
public static final String message_id = "message_id";
public static final String message = "message";
public static final String sender = "sender";
public static final String name = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public static void sendNotification(@NonNull Context context, @NonNull JSONObjec
String message = sendBird.getString(StringSet.message);
JSONObject channel = sendBird.getJSONObject(StringSet.channel);
String channelUrl = channel.getString(StringSet.channel_url);
long messageId = sendBird.getLong(StringSet.message_id);

String senderName = context.getString(R.string.app_name);
if (sendBird.has(StringSet.sender)) {
Expand All @@ -105,12 +106,12 @@ public static void sendNotification(@NonNull Context context, @NonNull JSONObjec
notificationManager.createNotificationChannel(mChannel);
}

Intent intent = GroupChannelMainActivity.newRedirectToChannelIntent(context, channelUrl);
Intent intent = GroupChannelMainActivity.newRedirectToChannelIntent(context, channelUrl, messageId);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
@SuppressLint("UnspecifiedImmutableFlag")
PendingIntent pendingIntent = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M ?
PendingIntent.getActivity(context, channelUrl.hashCode() /* Request code */, intent, PendingIntent.FLAG_IMMUTABLE) :
PendingIntent.getActivity(context, channelUrl.hashCode() /* Request code */, intent, 0);
PendingIntent.getActivity(context, (int) messageId /* Request code */, intent, PendingIntent.FLAG_IMMUTABLE) :
PendingIntent.getActivity(context, (int) messageId /* Request code */, intent, 0);

Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, CHANNEL_ID)
Expand All @@ -127,4 +128,4 @@ public static void sendNotification(@NonNull Context context, @NonNull JSONObjec

notificationManager.notify(String.valueOf(System.currentTimeMillis()), 0, notificationBuilder.build());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sendbird.uikit.customsample.groupchannel;

import static com.sendbird.uikit.customsample.consts.StringSet.PUSH_REDIRECT_CHANNEL;
import static com.sendbird.uikit.customsample.consts.StringSet.PUSH_REDIRECT_MESSAGE_ID;

import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -117,21 +118,32 @@ protected void onNewIntent(@Nullable Intent intent) {
}

@NonNull
public static Intent newRedirectToChannelIntent(@NonNull Context context, @NonNull String channelUrl) {
public static Intent newRedirectToChannelIntent(@NonNull Context context,
@NonNull String channelUrl,
long messageId) {
Intent intent = new Intent(context, GroupChannelMainActivity.class);
intent.putExtra(PUSH_REDIRECT_CHANNEL, channelUrl);
intent.putExtra(PUSH_REDIRECT_MESSAGE_ID, messageId);
return intent;
}

private void redirectChannelIfNeeded(Intent intent) {
if (intent == null) return;

if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) {
getIntent().removeExtra(PUSH_REDIRECT_CHANNEL);
intent.removeExtra(PUSH_REDIRECT_CHANNEL);
intent.removeExtra(PUSH_REDIRECT_MESSAGE_ID);
}
if (intent.hasExtra(PUSH_REDIRECT_CHANNEL)) {
String channelUrl = intent.getStringExtra(PUSH_REDIRECT_CHANNEL);
if (channelUrl != null) {

if (intent.hasExtra(PUSH_REDIRECT_MESSAGE_ID)) {
long messageId = intent.getLongExtra(PUSH_REDIRECT_MESSAGE_ID, 0L);
if (messageId > 0L) {
startActivity(ChannelActivity.newRedirectToMessageThreadIntent(this, channelUrl, messageId));
intent.removeExtra(PUSH_REDIRECT_MESSAGE_ID);
}
} else {
startActivity(ChannelActivity.newIntent(this, channelUrl));
}
intent.removeExtra(PUSH_REDIRECT_CHANNEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
import com.sendbird.android.message.SendingStatus;
import com.sendbird.uikit.activities.viewholder.GroupChannelMessageViewHolder;
import com.sendbird.uikit.consts.ClickableViewIdentifier;
import com.sendbird.uikit.consts.MessageGroupType;
import com.sendbird.uikit.customsample.databinding.ViewEmojiMessageMeHolderBinding;
import com.sendbird.uikit.customsample.utils.DrawableUtils;
import com.sendbird.uikit.interfaces.OnItemClickListener;
import com.sendbird.uikit.interfaces.OnItemLongClickListener;
import com.sendbird.uikit.model.MessageListUIParams;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* ViewHolder to draw the emoji message sent from current user in the <code>GroupChannel</code>.
Expand All @@ -33,11 +34,10 @@ public class EmojiMessageMeViewHolder extends GroupChannelMessageViewHolder {
public EmojiMessageMeViewHolder(@NonNull ViewEmojiMessageMeHolderBinding binding) {
super(binding.getRoot());
this.binding = binding;
clickableViewMap.put(ClickableViewIdentifier.Chat.name(), binding.ivEmoji);
}

@Override
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageGroupType messageGroupType) {
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageListUIParams params) {
Context context = binding.getRoot().getContext();
boolean sendingState = message.getSendingStatus() == SendingStatus.SUCCEEDED;

Expand All @@ -56,12 +56,15 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
binding.root.setPadding(binding.root.getPaddingLeft(), paddingTop, binding.root.getPaddingRight(), paddingBottom);
}

@NonNull
@Override
public Map<String, View> getClickableViewMap() {
return clickableViewMap;
public void setEmojiReaction(@NonNull List<Reaction> reactionList, @Nullable OnItemClickListener<String> emojiReactionClickListener, @Nullable OnItemLongClickListener<String> emojiReactionLongClickListener, @Nullable View.OnClickListener moreButtonClickListener) {
}

@NonNull
@Override
public void setEmojiReaction(@NonNull List<Reaction> reactionList, @Nullable OnItemClickListener<String> emojiReactionClickListener, @Nullable OnItemLongClickListener<String> emojiReactionLongClickListener, @Nullable View.OnClickListener moreButtonClickListener) {}
public Map<String, View> getClickableViewMap() {
return new ConcurrentHashMap<String, View>() {{
put(ClickableViewIdentifier.Chat.name(), binding.ivEmoji);
}};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
import com.sendbird.android.user.Sender;
import com.sendbird.uikit.activities.viewholder.GroupChannelMessageViewHolder;
import com.sendbird.uikit.consts.ClickableViewIdentifier;
import com.sendbird.uikit.consts.MessageGroupType;
import com.sendbird.uikit.customsample.R;
import com.sendbird.uikit.customsample.databinding.ViewEmojiMessageOtherHolderBinding;
import com.sendbird.uikit.customsample.utils.DrawableUtils;
import com.sendbird.uikit.interfaces.OnItemClickListener;
import com.sendbird.uikit.interfaces.OnItemLongClickListener;
import com.sendbird.uikit.model.MessageListUIParams;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* ViewHolder to draw the emoji message sent from other users in the <code>GroupChannel</code>.
Expand All @@ -39,12 +40,10 @@ public class EmojiMessageOtherViewHolder extends GroupChannelMessageViewHolder {
public EmojiMessageOtherViewHolder(@NonNull ViewEmojiMessageOtherHolderBinding binding) {
super(binding.getRoot());
this.binding = binding;
clickableViewMap.put(ClickableViewIdentifier.Chat.name(),binding.ivEmoji);
clickableViewMap.put(ClickableViewIdentifier.Profile.name(), binding.ivProfileView);
}

@Override
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageGroupType messageGroupType) {
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageListUIParams params) {
Context context = binding.getRoot().getContext();
boolean sendingState = message.getSendingStatus() == SendingStatus.SUCCEEDED;
binding.tvSentAt.setVisibility(sendingState ? View.VISIBLE : View.GONE);
Expand Down Expand Up @@ -82,10 +81,12 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
@NonNull
@Override
public Map<String, View> getClickableViewMap() {
return clickableViewMap;
return new ConcurrentHashMap<String, View>() {{
put(ClickableViewIdentifier.Chat.name(),binding.ivEmoji);
put(ClickableViewIdentifier.Profile.name(), binding.ivProfileView);
}};
}


@Override
public void setEmojiReaction(@NonNull List<Reaction> reactionList, @Nullable OnItemClickListener<String> emojiReactionClickListener, @Nullable OnItemLongClickListener<String> emojiReactionLongClickListener, @Nullable View.OnClickListener moreButtonClickListener) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
import com.sendbird.android.message.SendingStatus;
import com.sendbird.uikit.activities.viewholder.GroupChannelMessageViewHolder;
import com.sendbird.uikit.consts.ClickableViewIdentifier;
import com.sendbird.uikit.consts.MessageGroupType;
import com.sendbird.uikit.customsample.databinding.ViewHighlightMessageMeHolderBinding;
import com.sendbird.uikit.customsample.utils.DrawableUtils;
import com.sendbird.uikit.interfaces.OnItemClickListener;
import com.sendbird.uikit.interfaces.OnItemLongClickListener;
import com.sendbird.uikit.model.MessageListUIParams;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* ViewHolder to draw the highlight message sent from current user in the <code>GroupChannel</code>.
Expand All @@ -31,11 +32,10 @@ public class HighlightMessageMeViewHolder extends GroupChannelMessageViewHolder
public HighlightMessageMeViewHolder(@NonNull ViewHighlightMessageMeHolderBinding binding) {
super(binding.getRoot());
this.binding = binding;
clickableViewMap.put(ClickableViewIdentifier.Chat.name(), binding.tvMessage);
}

@Override
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageGroupType messageGroupType) {
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageListUIParams params) {
Context context = binding.getRoot().getContext();
boolean sendingState = message.getSendingStatus() == SendingStatus.SUCCEEDED;

Expand All @@ -53,7 +53,9 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
@NonNull
@Override
public Map<String, View> getClickableViewMap() {
return clickableViewMap;
return new ConcurrentHashMap<String, View>() {{
put(ClickableViewIdentifier.Chat.name(), binding.tvMessage);
}};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
import com.sendbird.android.user.Sender;
import com.sendbird.uikit.activities.viewholder.GroupChannelMessageViewHolder;
import com.sendbird.uikit.consts.ClickableViewIdentifier;
import com.sendbird.uikit.consts.MessageGroupType;
import com.sendbird.uikit.customsample.R;
import com.sendbird.uikit.customsample.databinding.ViewHighlightMessageOtherHolderBinding;
import com.sendbird.uikit.customsample.utils.DrawableUtils;
import com.sendbird.uikit.interfaces.OnItemClickListener;
import com.sendbird.uikit.interfaces.OnItemLongClickListener;
import com.sendbird.uikit.model.MessageListUIParams;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* ViewHolder to draw the highlight message sent from other users in the <code>GroupChannel</code>.
Expand All @@ -39,12 +40,10 @@ public class HighlightMessageOtherViewHolder extends GroupChannelMessageViewHold
public HighlightMessageOtherViewHolder(@NonNull ViewHighlightMessageOtherHolderBinding binding) {
super(binding.getRoot());
this.binding = binding;
clickableViewMap.put(ClickableViewIdentifier.Chat.name(),binding.tvMessage);
clickableViewMap.put(ClickableViewIdentifier.Profile.name(), binding.ivProfileView);
}

@Override
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageGroupType messageGroupType) {
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageListUIParams params) {
Context context = binding.getRoot().getContext();
boolean sendingState = message.getSendingStatus() == SendingStatus.SUCCEEDED;
binding.tvSentAt.setVisibility(sendingState ? View.VISIBLE : View.GONE);
Expand Down Expand Up @@ -78,10 +77,12 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
@NonNull
@Override
public Map<String, View> getClickableViewMap() {
return clickableViewMap;
return new ConcurrentHashMap<String, View>() {{
put(ClickableViewIdentifier.Chat.name(),binding.tvMessage);
put(ClickableViewIdentifier.Profile.name(), binding.ivProfileView);
}};
}


@Override
public void setEmojiReaction(@NonNull List<Reaction> reactionList, @Nullable OnItemClickListener<String> emojiReactionClickListener, @Nullable OnItemLongClickListener<String> emojiReactionLongClickListener, @Nullable View.OnClickListener moreButtonClickListener) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
import com.sendbird.android.user.Sender;
import com.sendbird.uikit.activities.viewholder.MessageViewHolder;
import com.sendbird.uikit.consts.ClickableViewIdentifier;
import com.sendbird.uikit.consts.MessageGroupType;
import com.sendbird.uikit.customsample.R;
import com.sendbird.uikit.customsample.databinding.ViewOpenChannelHighlightMessageHolderBinding;
import com.sendbird.uikit.customsample.utils.DrawableUtils;
import com.sendbird.uikit.model.MessageListUIParams;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* ViewHolder to draw the highlight message for <code>OpenChannel</code>.
Expand All @@ -44,12 +45,10 @@ public HighlightOpenChannelMessageViewHolder(@NonNull ViewOpenChannelHighlightMe
} finally {
a.recycle();
}
clickableViewMap.put(ClickableViewIdentifier.Chat.name(), binding.contentPanel);
clickableViewMap.put(ClickableViewIdentifier.Profile.name(), binding.ivProfileView);
}

@Override
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageGroupType messageGroupType) {
public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @NonNull MessageListUIParams params) {
OpenChannel openChannel;
if (channel instanceof OpenChannel) {
openChannel = (OpenChannel) channel;
Expand Down Expand Up @@ -99,6 +98,9 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
@NonNull
@Override
public Map<String, View> getClickableViewMap() {
return clickableViewMap;
return new ConcurrentHashMap<String, View>() {{
put(ClickableViewIdentifier.Chat.name(), binding.contentPanel);
put(ClickableViewIdentifier.Profile.name(), binding.ivProfileView);
}};
}
}
Loading

0 comments on commit c920e28

Please sign in to comment.