Skip to content

Commit

Permalink
Merge pull request #30 from sendbird/release/3.14.0
Browse files Browse the repository at this point in the history
3.14.0
  • Loading branch information
sendbird-sdk-deployment authored Mar 19, 2024
2 parents 60cd795 + 138d452 commit 3de1ff7
Show file tree
Hide file tree
Showing 45 changed files with 390 additions and 216 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Changelog
### v3.14.0 (Mar 19, 2024) with Chat SDK `v4.15.6`
* A feedback feature has been added to give opinions on the message.
* Added `setEmptyIcon(int)`, `setEmptyIcon(int, ColorStateList)`, `setEmptyText(int)`, and `setErrorText(int)` in `ChatNotificationChannelFragment`.
* Added `setEmptyIcon(int)`, `setEmptyIcon(int, ColorStateList)`, `setEmptyText(int)`, and `setErrorText(int)` in `FeedNotificationChannelFragment`.
* Simple example for creating `FeedNotificationChannelFragment` with empty icon and text.
```kotlin
val feedChannelFragment = FeedNotificationChannelFragment.Builder(channelUrl)
.withArguments(args)
.setEmptyIcon(R.drawable.icon_empty)
.setEmptyText(R.string.text_empty_notification)
.build()
```
### v3.13.0 (Feb 1, 2024) with Chat SDK `v4.14.2`
* A feedback feature has been added to give opinions on the message.
* Added `enableFeedback` in `ChannelConfig`.
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.13.0
UIKIT_VERSION = 3.14.0
UIKIT_VERSION_CODE = 1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package com.sendbird.uikit.samples.notification
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.sendbird.uikit.activities.FeedNotificationChannelActivity
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.common.ThemeHomeActivity
Expand Down
2 changes: 1 addition & 1 deletion uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// Sendbird
api 'com.sendbird.sdk:sendbird-chat:4.14.2'
api 'com.sendbird.sdk:sendbird-chat:4.15.6'

implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
Expand Down
1 change: 1 addition & 0 deletions uikit/internal.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {
testImplementation "io.mockk:mockk:1.13.4"
testImplementation 'androidx.arch.core:core-testing:2.2.0'
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.8.20"
testImplementation("pl.pragmatists:JUnitParams:1.1.0")
}

tasks.register("ktlintCheck", JavaExec) {
Expand Down
36 changes: 18 additions & 18 deletions uikit/src/main/java/com/sendbird/uikit/SendbirdUIKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
import com.sendbird.uikit.internal.singleton.NotificationChannelManager;
import com.sendbird.uikit.internal.singleton.UIKitConfigRepository;
import com.sendbird.uikit.internal.tasks.JobResultTask;
import com.sendbird.uikit.internal.wrappers.SendbirdChatImpl;
import com.sendbird.uikit.internal.wrappers.SendbirdChatWrapper;
import com.sendbird.uikit.internal.wrappers.TaskQueueImpl;
import com.sendbird.uikit.internal.wrappers.TaskQueueWrapper;
import com.sendbird.uikit.internal.contracts.SendbirdChatImpl;
import com.sendbird.uikit.internal.contracts.SendbirdChatContract;
import com.sendbird.uikit.internal.contracts.TaskQueueImpl;
import com.sendbird.uikit.internal.contracts.TaskQueueContract;
import com.sendbird.uikit.log.Logger;
import com.sendbird.uikit.model.EmojiManager;
import com.sendbird.uikit.model.UserMentionConfig;
Expand Down Expand Up @@ -269,7 +269,7 @@ public synchronized static void initFromForeground(@NonNull SendbirdUIKitAdapter

@VisibleForTesting
synchronized static void init(
@NonNull SendbirdChatWrapper sendbirdChatWrapper,
@NonNull SendbirdChatContract sendbirdChatContract,
@NonNull SendbirdUIKitAdapter adapter,
@NonNull UIKitConfigRepository uikitConfigRepo,
@NonNull Context context,
Expand All @@ -296,7 +296,7 @@ public void onInitFailed(@NonNull SendbirdException e) {
public void onInitSucceed() {
Logger.d(">> onInitSucceed()");
try {
sendbirdChatWrapper.addExtension(StringSet.sb_uikit, BuildConfig.VERSION_NAME);
sendbirdChatContract.addExtension(StringSet.sb_uikit, BuildConfig.VERSION_NAME);
} catch (Throwable ignored) {
}
try {
Expand All @@ -305,7 +305,7 @@ public void onInitSucceed() {
SendbirdPlatform.ANDROID,
BuildConfig.VERSION_NAME
);
sendbirdChatWrapper.addSendbirdExtensions(Collections.singletonList(o), null);
sendbirdChatContract.addSendbirdExtensions(Collections.singletonList(o), null);
} catch (Throwable ignored) {
}

Expand All @@ -316,7 +316,7 @@ public void onInitSucceed() {
final com.sendbird.android.LogLevel logLevel = BuildConfig.DEBUG ? com.sendbird.android.LogLevel.VERBOSE : com.sendbird.android.LogLevel.WARN;
// useCaching=true is required for UIKit
final InitParams initParams = new InitParams(adapter.getAppId(), context, true, logLevel, isForeground);
sendbirdChatWrapper.init(initParams, initResultHandler);
sendbirdChatContract.init(initParams, initResultHandler);
FileUtils.removeDeletableDir(context.getApplicationContext());
UIKitPrefs.init(context.getApplicationContext());
NotificationChannelManager.init(context.getApplicationContext());
Expand Down Expand Up @@ -564,18 +564,18 @@ private enum ConnectType {
}

@VisibleForTesting
static void connectInternal(@NonNull SendbirdChatWrapper sendbirdChat,
@NonNull TaskQueueWrapper taskQueueWrapper,
static void connectInternal(@NonNull SendbirdChatContract sendbirdChat,
@NonNull TaskQueueContract taskQueueContract,
@Nullable ConnectHandler handler) {
connectInternal(ConnectType.CONNECT, sendbirdChat, taskQueueWrapper, handler);
connectInternal(ConnectType.CONNECT, sendbirdChat, taskQueueContract, handler);
}

private static void connectInternal(
@NonNull ConnectType connectType,
@NonNull SendbirdChatWrapper sendbirdChat,
@NonNull TaskQueueWrapper taskQueueWrapper,
@NonNull SendbirdChatContract sendbirdChat,
@NonNull TaskQueueContract taskQueueContract,
@Nullable ConnectHandler handler) {
taskQueueWrapper.addTask(new JobResultTask<Pair<User, SendbirdException>>() {
taskQueueContract.addTask(new JobResultTask<Pair<User, SendbirdException>>() {
@Override
public Pair<User, SendbirdException> call() throws Exception {
final Pair<User, SendbirdException> data;
Expand Down Expand Up @@ -654,7 +654,7 @@ public void onResultForUiThread(@Nullable Pair<User, SendbirdException> data, @N
}

@NonNull
private static Pair<User, SendbirdException> connectBlocking(@NonNull SendbirdChatWrapper sendbirdChat) throws InterruptedException {
private static Pair<User, SendbirdException> connectBlocking(@NonNull SendbirdChatContract sendbirdChat) throws InterruptedException {
AtomicReference<User> result = new AtomicReference<>();
AtomicReference<SendbirdException> error = new AtomicReference<>();
CountDownLatch latch = new CountDownLatch(1);
Expand All @@ -675,7 +675,7 @@ private static Pair<User, SendbirdException> connectBlocking(@NonNull SendbirdCh
}

@NonNull
private static Pair<User, SendbirdException> authenticateFeedBlocking(@NonNull SendbirdChatWrapper sendbirdChat) throws InterruptedException {
private static Pair<User, SendbirdException> authenticateFeedBlocking(@NonNull SendbirdChatContract sendbirdChat) throws InterruptedException {
AtomicReference<User> result = new AtomicReference<>();
AtomicReference<SendbirdException> error = new AtomicReference<>();
CountDownLatch latch = new CountDownLatch(1);
Expand Down Expand Up @@ -719,10 +719,10 @@ public static void updateUserInfo(@NonNull UserUpdateParams params, @Nullable Co
SendbirdChat.updateCurrentUserInfo(params, handler);
}

private static void updateUserInfoBlocking(@NonNull SendbirdChatWrapper sendbirdChatWrapper, @NonNull UserUpdateParams params) throws SendbirdException, InterruptedException {
private static void updateUserInfoBlocking(@NonNull SendbirdChatContract sendbirdChatContract, @NonNull UserUpdateParams params) throws SendbirdException, InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<SendbirdException> error = new AtomicReference<>();
sendbirdChatWrapper.updateCurrentUserInfo(params, e -> {
sendbirdChatContract.updateCurrentUserInfo(params, e -> {
if (e != null) error.set(e);
latch.countDown();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import com.sendbird.uikit.internal.singleton.MessageDisplayDataManager;
import com.sendbird.uikit.internal.ui.viewholders.MyUserMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.OtherUserMessageViewHolder;
import com.sendbird.uikit.internal.wrappers.SendbirdUIKitImpl;
import com.sendbird.uikit.internal.wrappers.SendbirdUIKitWrapper;
import com.sendbird.uikit.internal.contracts.SendbirdUIKitImpl;
import com.sendbird.uikit.internal.contracts.SendbirdUIKitContract;
import com.sendbird.uikit.log.Logger;
import com.sendbird.uikit.model.MessageListUIParams;
import com.sendbird.uikit.model.MessageUIConfig;
Expand Down Expand Up @@ -86,7 +86,7 @@ abstract public class BaseMessageListAdapter extends BaseMessageAdapter<BaseMess
private final ExecutorService differWorker = Executors.newSingleThreadExecutor();

@NonNull
protected final SendbirdUIKitWrapper sendbirdUIKit;
protected final SendbirdUIKitContract sendbirdUIKit;

/**
* Constructor
Expand Down Expand Up @@ -145,7 +145,7 @@ public BaseMessageListAdapter(@Nullable GroupChannel channel, @NonNull MessageLi
}

@VisibleForTesting
BaseMessageListAdapter(@Nullable GroupChannel channel, @NonNull MessageListUIParams messageListUIParams, @NonNull SendbirdUIKitWrapper sendbirdUIKit) {
BaseMessageListAdapter(@Nullable GroupChannel channel, @NonNull MessageListUIParams messageListUIParams, @NonNull SendbirdUIKitContract sendbirdUIKit) {
if (channel != null) this.channel = GroupChannel.clone(channel);
this.messageListUIParams = messageListUIParams;
this.sendbirdUIKit = sendbirdUIKit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.sendbird.uikit.interfaces.FormSubmitButtonClickListener;
import com.sendbird.uikit.internal.ui.viewholders.FormMessageViewHolder;
import com.sendbird.uikit.internal.ui.viewholders.SuggestedRepliesViewHolder;
import com.sendbird.uikit.internal.wrappers.SendbirdUIKitImpl;
import com.sendbird.uikit.internal.wrappers.SendbirdUIKitWrapper;
import com.sendbird.uikit.internal.contracts.SendbirdUIKitImpl;
import com.sendbird.uikit.internal.contracts.SendbirdUIKitContract;
import com.sendbird.uikit.model.MessageListUIParams;

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ public MessageListAdapter(@Nullable GroupChannel channel, @NonNull MessageListUI
}

@VisibleForTesting
MessageListAdapter(@Nullable GroupChannel channel, @NonNull MessageListUIParams messageListUIParams, @NonNull SendbirdUIKitWrapper sendbirdUIKit) {
MessageListAdapter(@Nullable GroupChannel channel, @NonNull MessageListUIParams messageListUIParams, @NonNull SendbirdUIKitContract sendbirdUIKit) {
super(channel,
new MessageListUIParams.Builder(messageListUIParams)
.setUseQuotedView(true)
Expand Down
1 change: 1 addition & 0 deletions uikit/src/main/java/com/sendbird/uikit/consts/StringSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ object StringSet {
const val ThreadInfo = "ThreadInfo"
const val ParentMessageMenu = "ParentMessageMenu"
const val _AT = "@"
const val disable_chat_input = "disable_chat_input"

// template message syntax
const val web = "web"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;

import com.sendbird.android.channel.GroupChannel;
Expand Down Expand Up @@ -388,6 +391,59 @@ public Builder setNotificationListParams(@NonNull MessageListParams params) {
return this;
}

/**
* Sets the icon when the data is not exists.
*
* @param resId the resource identifier of the drawable.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setEmptyIcon(@DrawableRes int resId) {
return setEmptyIcon(resId, null);
}

/**
* Sets the icon when the data is not exists.
*
* @param resId the resource identifier of the drawable.
* @param tint Color state list to use for tinting this resource, or null to clear the tint.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setEmptyIcon(@DrawableRes int resId, @Nullable ColorStateList tint) {
bundle.putInt(StringSet.KEY_EMPTY_ICON_RES_ID, resId);
bundle.putParcelable(StringSet.KEY_EMPTY_ICON_TINT, tint);
return this;
}

/**
* Sets the text when the data is not exists
*
* @param resId the resource identifier of text to be displayed.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setEmptyText(@StringRes int resId) {
bundle.putInt(StringSet.KEY_EMPTY_TEXT_RES_ID, resId);
return this;
}

/**
* Sets the text when error occurs
*
* @param resId the resource identifier of text to be displayed.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setErrorText(@StringRes int resId) {
bundle.putInt(StringSet.KEY_ERROR_TEXT_RES_ID, resId);
return this;
}

/**
* Creates an {@link ChatNotificationChannelFragment} with the arguments supplied to this
* builder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;

import com.sendbird.android.channel.FeedChannel;
Expand Down Expand Up @@ -123,7 +126,7 @@ protected void onBindNotificationListComponent(@NonNull FeedNotificationListComp
Logger.d(">> FeedNotificationChannelFragment::onBindFeedNotificationListComponent()");
listComponent.setOnMessageTemplateActionHandler(actionHandler != null ? actionHandler : this::handleAction);
listComponent.setOnTooltipClickListener(v -> listComponent.scrollToFirst());
listComponent.setOnImpressionDetectedListener(viewModel::sendLogImpression);
listComponent.setOnNotificationViewedDetectedListener(viewModel::sendLogImpression);
listComponent.setOnNotificationCategorySelectListener(category -> {
Logger.d("++ selected category = %s", category);
listComponent.clearData();
Expand Down Expand Up @@ -416,6 +419,59 @@ public Builder setNotificationListParams(@NonNull MessageListParams params) {
return this;
}

/**
* Sets the icon when the data is not exists.
*
* @param resId the resource identifier of the drawable.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setEmptyIcon(@DrawableRes int resId) {
return setEmptyIcon(resId, null);
}

/**
* Sets the icon when the data is not exists.
*
* @param resId the resource identifier of the drawable.
* @param tint Color state list to use for tinting this resource, or null to clear the tint.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setEmptyIcon(@DrawableRes int resId, @Nullable ColorStateList tint) {
bundle.putInt(StringSet.KEY_EMPTY_ICON_RES_ID, resId);
bundle.putParcelable(StringSet.KEY_EMPTY_ICON_TINT, tint);
return this;
}

/**
* Sets the text when the data is not exists
*
* @param resId the resource identifier of text to be displayed.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setEmptyText(@StringRes int resId) {
bundle.putInt(StringSet.KEY_EMPTY_TEXT_RES_ID, resId);
return this;
}

/**
* Sets the text when error occurs
*
* @param resId the resource identifier of text to be displayed.
* @return This Builder object to allow for chaining of calls to set methods.
* since 3.14.0
*/
@NonNull
public Builder setErrorText(@StringRes int resId) {
bundle.putInt(StringSet.KEY_ERROR_TEXT_RES_ID, resId);
return this;
}

/**
* Creates an {@link FeedNotificationChannelFragment} with the arguments supplied to this
* builder.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.sendbird.uikit.internal.wrappers
package com.sendbird.uikit.internal.contracts

import com.sendbird.android.channel.GroupChannel
import com.sendbird.android.handler.GroupChannelCollectionHandler
import com.sendbird.android.handler.GroupChannelsCallbackHandler

internal interface GroupChannelCollectionWrapper {
internal interface GroupChannelCollectionContract {
fun setGroupChannelCollectionHandler(handler: GroupChannelCollectionHandler?)
fun loadMore(handler: GroupChannelsCallbackHandler)
fun getChannelList(): List<GroupChannel>
Expand Down
Loading

0 comments on commit 3de1ff7

Please sign in to comment.