Skip to content

Commit

Permalink
Added 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rimdoo committed Feb 23, 2023
1 parent 7c6ae1c commit 4af87e4
Show file tree
Hide file tree
Showing 101 changed files with 3,377 additions and 156 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

### v3.4.0 (Feb 23, 2023) with Chat SDK `v4.4.0`
* Support voice message in GroupChannel
* Added `setUseVoiceMessage(boolean)` in `SendbirdUIKit`
* Added `isUsingVoiceMessage()` in `SendbirdUIKit`
* Added `VIEW_TYPE_VOICE_MESSAGE_ME`, `VIEW_TYPE_VOICE_MESSAGE_OTHER` in `MessageType`
* Added `takeVoiceRecorder(View, int, BaseMessage)` in `ChannelFragment`, `MessageThreadFragment`
* Added `sendVoiceFileMessage(VoiceMessageInfo)` in `ChannelFragment`, `MessageThreadFragment`
* Added `setOnVoiceRecorderButtonClickListener(OnClickListener)` in `ChannelFragment.Builder`, `MessageThreadFragment.Builder`

### v3.3.3 (Jan 19, 2023) with Chat SDK `v4.2.1`
* Improved stability

Expand All @@ -18,8 +27,8 @@
* Support thread type in GroupChannel
* Added `THREAD` in `ReplyType`
* Added `enum ThreadReplySelectType { PARENT, THREAD }`
* Added `setThreadReplySelectType(threadReplySelectType)` in `SendBirdUIKit`
* Added `getThreadReplySelectType()` in `SendBirdUIKit`
* 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`
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.3.3
UIKIT_VERSION = 3.4.0
UIKIT_VERSION_CODE = 1
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ public void onBeforeCreateOpenChannel(@NonNull OpenChannelCreateParams params) {
SendbirdUIKit.setUIKitFragmentFactory(new CustomFragmentFactory());
// set whether to use user mention
SendbirdUIKit.setUseUserMention(true);
// set the voice message
SendbirdUIKit.setUseVoiceMessage(true);
// set the mention configuration
SendbirdUIKit.setMentionConfig(new UserMentionConfig.Builder()
.setMaxMentionCount(5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ public class CustomMessageInputComponent extends MessageInputComponent {

private ViewCustomChannelInputBinding binding;
@Nullable
private CompoundButton.OnCheckedChangeListener highlightCheckedListener;
private CompoundButton.OnCheckedChangeListener onHighlightCheckedListener;
@Nullable
private View.OnClickListener menuCameraClickListener;
private View.OnClickListener onMenuCameraClickListener;
@Nullable
private View.OnClickListener menuPhotoClickListener;
private View.OnClickListener onMenuPhotoClickListener;
@Nullable
private View.OnClickListener menuFileClickListener;
private View.OnClickListener onMenuFileClickListener;
@Nullable
private OnItemClickListener<String> emojiClickListener;
private View.OnClickListener onVoiceMessageClickListener;
@Nullable
private OnItemClickListener<String> onEmojiClickListener;
@NonNull
private MessageInputView.Mode mode = MessageInputView.Mode.DEFAULT;
@NonNull
Expand Down Expand Up @@ -109,16 +111,19 @@ public View onCreateView(@NonNull Context context, @NonNull LayoutInflater infla
}
});
binding.highlightSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (highlightCheckedListener != null) highlightCheckedListener.onCheckedChanged(buttonView, isChecked);
if (onHighlightCheckedListener != null) onHighlightCheckedListener.onCheckedChanged(buttonView, isChecked);
});
binding.camera.setOnClickListener(v -> {
if (menuCameraClickListener != null) menuCameraClickListener.onClick(v);
if (onMenuCameraClickListener != null) onMenuCameraClickListener.onClick(v);
});
binding.photo.setOnClickListener(v -> {
if (menuPhotoClickListener != null) menuPhotoClickListener.onClick(v);
if (onMenuPhotoClickListener != null) onMenuPhotoClickListener.onClick(v);
});
binding.file.setOnClickListener(v -> {
if (menuFileClickListener != null) menuFileClickListener.onClick(v);
if (onMenuFileClickListener != null) onMenuFileClickListener.onClick(v);
});
binding.voiceMessageButton.setOnClickListener(v -> {
if (onVoiceMessageClickListener != null) onVoiceMessageClickListener.onClick(v);
});
binding.input.addTextChangedListener(new TextWatcher() {
@Override
Expand All @@ -133,7 +138,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
public void afterTextChanged(Editable s) {}
});

adapter.emojiClickListener = emojiClickListener;
adapter.emojiClickListener = onEmojiClickListener;
return binding.getRoot();
}

Expand Down Expand Up @@ -204,25 +209,29 @@ public void requestInputMode(@NonNull String mode) {
setLeftButton(true);
}

public void setHighlightCheckedListener(@Nullable CompoundButton.OnCheckedChangeListener highlightCheckedListener) {
this.highlightCheckedListener = highlightCheckedListener;
public void setOnHighlightCheckedListener(@Nullable CompoundButton.OnCheckedChangeListener onHighlightCheckedListener) {
this.onHighlightCheckedListener = onHighlightCheckedListener;
}

public void setOnMenuCameraClickListener(@Nullable View.OnClickListener onMenuCameraClickListener) {
this.onMenuCameraClickListener = onMenuCameraClickListener;
}

public void setMenuCameraClickListener(@Nullable View.OnClickListener menuCameraClickListener) {
this.menuCameraClickListener = menuCameraClickListener;
public void setOnMenuPhotoClickListener(@Nullable View.OnClickListener onMenuPhotoClickListener) {
this.onMenuPhotoClickListener = onMenuPhotoClickListener;
}

public void setMenuPhotoClickListener(@Nullable View.OnClickListener menuPhotoClickListener) {
this.menuPhotoClickListener = menuPhotoClickListener;
public void setOnMenuFileClickListener(@Nullable View.OnClickListener onMenuFileClickListener) {
this.onMenuFileClickListener = onMenuFileClickListener;
}

public void setMenuFileClickListener(@Nullable View.OnClickListener menuFileClickListener) {
this.menuFileClickListener = menuFileClickListener;
public void setOnVoiceMessageClickListener(@Nullable View.OnClickListener onVoiceMessageClickListener) {
this.onVoiceMessageClickListener = onVoiceMessageClickListener;
}

public void setEmojiClickListener(@Nullable OnItemClickListener<String> emojiClickListener) {
this.emojiClickListener = emojiClickListener;
adapter.emojiClickListener = emojiClickListener;
public void setOnEmojiClickListener(@Nullable OnItemClickListener<String> onEmojiClickListener) {
this.onEmojiClickListener = onEmojiClickListener;
adapter.emojiClickListener = onEmojiClickListener;
}

private void setLeftButton(final boolean isLeftClosed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ protected void onBindMessageInputComponent(@NonNull MessageInputComponent inputC

if (inputComponent instanceof CustomMessageInputComponent) {
CustomMessageInputComponent customInput = (CustomMessageInputComponent) getModule().getMessageInputComponent();
customInput.setMenuCameraClickListener(v -> takeCamera());
customInput.setMenuPhotoClickListener(v -> takePhoto());
customInput.setMenuFileClickListener(v -> takeFile());
customInput.setHighlightCheckedListener((buttonView, isChecked) ->
customInput.setOnMenuCameraClickListener(v -> takeCamera());
customInput.setOnMenuPhotoClickListener(v -> takePhoto());
customInput.setOnMenuFileClickListener(v -> takeFile());
customInput.setOnVoiceMessageClickListener(v -> takeVoiceRecorder());
customInput.setOnHighlightCheckedListener((buttonView, isChecked) ->
customMessageType = isChecked ? CustomMessageType.HIGHLIGHT : CustomMessageType.NONE);
customInput.setEmojiClickListener((view, position, url) -> {
customInput.setOnEmojiClickListener((view, position, url) -> {
final UserMessageCreateParams params = new UserMessageCreateParams();
params.setMessage(url);
customMessageType = CustomMessageType.EMOJI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
android:src="@drawable/icon_emoji_more"
android:padding="@dimen/sb_size_8"
app:layout_constraintLeft_toRightOf="@id/input"
app:layout_constraintRight_toLeftOf="@id/voiceMessageButton"
app:layout_constraintTop_toBottomOf="@id/topLine"
app:layout_constraintBottom_toTopOf="@id/menuPanel"/>

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/voiceMessageButton"
android:layout_width="@dimen/sb_size_56"
android:layout_height="@dimen/sb_size_56"
android:src="@drawable/icon_voice_message_on"
android:padding="@dimen/sb_size_8"
app:layout_constraintLeft_toRightOf="@id/emojiButton"
app:layout_constraintRight_toLeftOf="@id/sendButton"
app:layout_constraintTop_toBottomOf="@id/topLine"
app:layout_constraintBottom_toTopOf="@id/menuPanel"/>
Expand All @@ -47,7 +58,7 @@
android:layout_height="@dimen/sb_size_56"
android:src="@drawable/icon_send"
android:padding="@dimen/sb_size_8"
app:layout_constraintLeft_toRightOf="@id/emojiButton"
app:layout_constraintLeft_toRightOf="@id/voiceMessageButton"
app:layout_constraintRight_toLeftOf="@id/highlightSwitch"
app:layout_constraintTop_toBottomOf="@id/topLine"
app:layout_constraintBottom_toTopOf="@id/menuPanel"/>
Expand Down Expand Up @@ -129,4 +140,4 @@

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.sendbird.android.params.OpenChannelCreateParams;
import com.sendbird.uikit.SendbirdUIKit;
import com.sendbird.uikit.adapter.SendbirdUIKitAdapter;
import com.sendbird.uikit.consts.ThreadReplySelectType;
import com.sendbird.uikit.consts.ReplyType;
import com.sendbird.uikit.consts.ThreadReplySelectType;
import com.sendbird.uikit.interfaces.CustomParamsHandler;
import com.sendbird.uikit.interfaces.UserInfo;
import com.sendbird.uikit_messaging_android.consts.InitState;
Expand Down Expand Up @@ -112,6 +112,8 @@ public void onInitSucceed() {
// set reply type
SendbirdUIKit.setReplyType(ReplyType.THREAD);
SendbirdUIKit.setThreadReplySelectType(ThreadReplySelectType.THREAD);
// set whether to use voice message
SendbirdUIKit.setUseVoiceMessage(true);

// set custom params
SendbirdUIKit.setCustomParamsHandler(new CustomParamsHandler() {
Expand Down
3 changes: 2 additions & 1 deletion uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// Sendbird
api 'com.sendbird.sdk:sendbird-chat:4.2.1'
api 'com.sendbird.sdk:sendbird-chat:4.4.0'

implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
Expand All @@ -81,5 +81,6 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"



}

1 change: 1 addition & 0 deletions uikit/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<queries>
<!-- Browser -->
Expand Down
23 changes: 23 additions & 0 deletions uikit/src/main/java/com/sendbird/uikit/SendbirdUIKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public ColorStateList getErrorTintColorStateList(@NonNull Context context) {
private static volatile boolean useMention = false;
private static volatile boolean useUserIdForNickname = true;
private static UserMentionConfig userMentionConfig = new UserMentionConfig.Builder().build();
private static volatile boolean useVoiceMessage = false;

static void clearAll() {
SendbirdUIKit.customUserListQueryHandler = null;
Expand Down Expand Up @@ -478,6 +479,28 @@ public static boolean isUsingUserIdForNickname() {
return useUserIdForNickname;
}

/**
* Sets whether the voice message is used on the channel screen and message thread screen.
* The voice message is only active in group channels.
*
* @param useVoiceMessage If <code>true</code> the voice message will be used, <code>false</code> other wise.
* @since 3.4.0
*/
public static void setUseVoiceMessage(boolean useVoiceMessage) {
SendbirdUIKit.useVoiceMessage = useVoiceMessage;
}

/**
* Returns set value whether the voice message is used on the channel screen and message thread screen.
* The voice message is only active in group channels.
*
* @return The value whether the voice message is used on the channel screen, message thread screen.
* @since 3.4.0
*/
public static boolean isUsingVoiceMessage() {
return SendbirdUIKit.useVoiceMessage;
}

/**
* Connects to Sendbird with given <code>UserInfo</code>.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ public enum MessageType {
*
* @since 3.3.0
*/
VIEW_TYPE_PARENT_MESSAGE_INFO(12);
VIEW_TYPE_PARENT_MESSAGE_INFO(12),
/**
* Type of voice message sent by the current user.
*
* @since 3.4.0
*/
VIEW_TYPE_VOICE_MESSAGE_ME(15),
/**
* Type of voice message sent by users other than the current user.
*
* @since 3.4.0
*/
VIEW_TYPE_VOICE_MESSAGE_OTHER(16);

final int value;
MessageType(int value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.sendbird.uikit.databinding.SbViewMyFileMessageBinding;
import com.sendbird.uikit.databinding.SbViewMyFileVideoMessageBinding;
import com.sendbird.uikit.databinding.SbViewMyUserMessageBinding;
import com.sendbird.uikit.databinding.SbViewMyVoiceMessageBinding;
import com.sendbird.uikit.databinding.SbViewOpenChannelAdminMessageBinding;
import com.sendbird.uikit.databinding.SbViewOpenChannelFileImageMessageBinding;
import com.sendbird.uikit.databinding.SbViewOpenChannelFileMessageBinding;
Expand All @@ -24,13 +25,15 @@
import com.sendbird.uikit.databinding.SbViewOtherFileMessageBinding;
import com.sendbird.uikit.databinding.SbViewOtherFileVideoMessageBinding;
import com.sendbird.uikit.databinding.SbViewOtherUserMessageBinding;
import com.sendbird.uikit.databinding.SbViewOtherVoiceMessageBinding;
import com.sendbird.uikit.databinding.SbViewParentMessageInfoHolderBinding;
import com.sendbird.uikit.databinding.SbViewTimeLineMessageBinding;
import com.sendbird.uikit.internal.ui.viewholders.AdminMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.MyFileMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.MyImageFileMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.MyUserMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.MyVideoFileMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.MyVoiceMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OpenChannelAdminMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OpenChannelFileMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OpenChannelImageFileMessageViewHolder;
Expand All @@ -40,6 +43,7 @@
import com.sendbird.uikit.internal.ui.viewholders.OtherImageFileMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OtherUserMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OtherVideoFileMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OtherVoiceMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.ParentMessageInfoViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.TimelineViewHolder;
import com.sendbird.uikit.model.MessageListUIParams;
Expand Down Expand Up @@ -192,6 +196,12 @@ public static MessageViewHolder createViewHolder(@NonNull LayoutInflater inflate
case VIEW_TYPE_PARENT_MESSAGE_INFO:
holder = new ParentMessageInfoViewHolder(SbViewParentMessageInfoHolderBinding.inflate(inflater, parent, false));
break;
case VIEW_TYPE_VOICE_MESSAGE_ME:
holder = new MyVoiceMessageViewHolder(SbViewMyVoiceMessageBinding.inflate(inflater, parent, false), messageListUIParams);
break;
case VIEW_TYPE_VOICE_MESSAGE_OTHER:
holder = new OtherVoiceMessageViewHolder(SbViewOtherVoiceMessageBinding.inflate(inflater, parent, false), messageListUIParams);
break;
default:
// unknown message type
if (viewType == MessageType.VIEW_TYPE_UNKNOWN_MESSAGE_ME) {
Expand Down Expand Up @@ -232,7 +242,13 @@ public static MessageType getMessageType(@NonNull BaseMessage message) {
} else if (message instanceof FileMessage) {
FileMessage fileMessage = (FileMessage) message;
String mimeType = fileMessage.getType().toLowerCase();
if (mimeType.startsWith(StringSet.image)) {
if (MessageUtils.isVoiceMessage(fileMessage)) {
if (MessageUtils.isMine(message)) {
type = MessageType.VIEW_TYPE_VOICE_MESSAGE_ME;
} else {
type = MessageType.VIEW_TYPE_VOICE_MESSAGE_OTHER;
}
} else if (mimeType.startsWith(StringSet.image)) {
if (mimeType.contains(StringSet.svg)) {
if (MessageUtils.isMine(message)) {
type = MessageType.VIEW_TYPE_FILE_MESSAGE_ME;
Expand Down
6 changes: 6 additions & 0 deletions uikit/src/main/java/com/sendbird/uikit/consts/StringSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,21 @@ public class StringSet {
public final static String KEY_ERROR_TEXT_RES_ID = "KEY_ERROR_TEXT_RES_ID";
public final static String KEY_USE_SUGGESTED_MENTION_LIST_DIVIDER = "KEY_USE_SUGGESTED_MENTION_LIST_DIVIDER";
public final static String KEY_USE_REFRESH_LAYOUT = "KEY_USE_REFRESH_LAYOUT";
public final static String KEY_VOICE_MESSAGE_DURATION = "KEY_VOICE_MESSAGE_DURATION";
public final static String KEY_INTERNAL_MESSAGE_TYPE = "KEY_INTERNAL_MESSAGE_TYPE";

public final static String sb_uikit = "sb_uikit";
public final static String sbu_type = "sbu_type";
public final static String audio = "audio";
public final static String image = "image";
public final static String video = "video";
public final static String voice = "voice";
public final static String jpg = "jpg";
public final static String jpeg = "jpeg";
public final static String gif = "gif";
public final static String png = "png";
public final static String webp = "webp";
public final static String m4a = "m4a";
public final static String svg = "svg";
public final static String size = "size";
public final static String name = "name";
Expand All @@ -98,6 +103,7 @@ public class StringSet {
public final static String mCursorDrawableRes = "mCursorDrawableRes";
public final static String LABEL_COPY_TEXT = "COPY_TEXT";
public final static String DEFAULT_CHANNEL_COVER_URL = "https://static.sendbird.com/sample/cover/cover_";
public final static String Voice_message = "Voice_message";

// attributes list
public final static String reactions = "reactions";
Expand Down
Loading

0 comments on commit 4af87e4

Please sign in to comment.