Skip to content

Commit

Permalink
Added 3.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rimdoo committed Dec 9, 2022
1 parent f3c7800 commit c9d2c6b
Show file tree
Hide file tree
Showing 37 changed files with 544 additions and 244 deletions.
29 changes: 18 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Changelog

### v3.3.1 (Nov 21, 2022) with Core SDK `v4.1.3`
### v3.3.2 (Dec 09, 2022) with Chat SDK `v4.1.3`
* Support authenticated file caching
* Change the default value of `SendbirdUIKit.shouldUseImageCompression()` to `true`
* Change the default value of `SendbirdUIKit.getCompressQuality()` to `70`
* Improved message input dialog mode
* Improved stability

### v3.3.1 (Nov 21, 2022) with Chat SDK `v4.1.3`
* Fixed message update issue when an app is built with Proguard on
* Improved stability

### v3.3.0 (Nov 10, 2022) with Core SDK `v4.1.1`
### v3.3.0 (Nov 10, 2022) with Chat SDK `v4.1.1`
* Support thread type in GroupChannel
* Added `THREAD` in `ReplyType`
* Added `enum ThreadReplySelectType { PARENT, THREAD }`
Expand All @@ -27,14 +34,14 @@
* 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`
### v3.2.2 (Oct 27, 2022) with Chat SDK `v4.1.1`
* Added `setOnScrollFirstButtonClickListener(OnConsumableClickListener)` in `ChannelFragment.Builder` and `OpenChannelFragment.Builder`
* Added `scrollToFirst()`, `setOnScrollFirstButtonClickListener(OnConsumableClickListener)`, and `onScrollFirstButtonClicked(View)` in `MessageListComponent` and `OpemChannelMessageListComponent`
* Deprecated `setOnScrollBottomButtonClickListener(View.OnClickListener)` in `ChannelFragment.Builder` and `OpenChannelFragment.Builder`
* Deprecated `scrollToBottom()`, `setOnScrollBottomButtonClickListener(View.OnClickListener)`, and `onScrollBottomButtonClicked(View)` in `MessageListComponent` and `OpemChannelMessageListComponent`
* Improved stability

### v3.2.1 (Sep 29, 2022) with Core SDK `v4.0.9`
### v3.2.1 (Sep 29, 2022) with Chat SDK `v4.0.9`
* Added `takeVideo()` in `ChannelFragment` and `OpenChannelFragment`
* Support custom font in message bubble and input filed.
* Added `setRepliedMessageTextUIConfig(TextUIConfig)`, and `setMessageInputTextUIConfig(TextUIConfig)` in `ChannelFragment.Builder`
Expand All @@ -44,15 +51,15 @@
* Added `setRepliedMessageTextUIConfig(TextUIConfig)` in `MessageListComponent.Params`
* Added `setCustomFontRes(int)` in `TextUIConfig.Builder`

### v3.2.0 (Sep 15, 2022) with Core SDK `v4.0.8`
### v3.2.0 (Sep 15, 2022) with Chat SDK `v4.0.8`
* Support OpenChannel list
* Added `OpenChannelListActivity`, `OpenChannelListFragment`, `OpenChannelListModule`, `OpenChannelListViewModel`, `OpenChannelListComponent`, and `OpenChannelListAdapter`
* Added `CreateOpenChannelActivity`, `CreateOpenChannelFragment`, `CreateOpenChannelModule`, `CreateOpenChannelViewModel`, and `ChannelProfileInputComponent`
* Moved widgets class into internal package.
* `setCustomFragment()` functions have been added in the all Fragment.Builder class
* Improved stability

### v3.1.1 (Aug 17, 2022) with Core SDK `v4.0.5`
### v3.1.1 (Aug 17, 2022) with Chat SDK `v4.0.5`
* Added `setMessageTextUIConfig(TextUIConfig, TextUIConfig)` in `ChannelFragment.Builder`, `OpenChannelFragment.Builder`, `MessageListComponent.Params`, `OpenChannelMessageListComponent.Params`
* Added `setSentAtTextUIConfig(TextUIConfig, TextUIConfig)` in `ChannelFragment.Builder`, `OpenChannelFragment.Builder`, `MessageListComponent.Params`, `OpenChannelMessageListComponent.Params`
* Added `setNicknameTextUIConfig(TextUIConfig)` in `ChannelFragment.Builder`, `MessageListComponent.Params`
Expand All @@ -66,7 +73,7 @@
* Added `setLinkedTextColor(int)` in `ChannelFragment.Builder`, `OpenChannelFragment.Builder`
* Added `setLinkedTextColor(ColorStateList)` in `MessageListComponent.Params`, `OpenChannelMessageListComponent.Params`

### v3.1.0 (Aug 3, 2022) with Core SDK `v4.0.5`
### v3.1.0 (Aug 3, 2022) with Chat SDK `v4.0.5`
* Support Android 13
* Set the `maxSdkVersion` of `android.permission.READ_EXTERNAL_STORAGE` to `32`
* Removed `android.permission.REQUEST_INSTALL_PACKAGES` permission
Expand All @@ -80,7 +87,7 @@
* Added `newOpenChannelModerationFragment()`, `newOpenChannelOperatorListFragment()`, `newOpenChannelRegisterOperatorFragment()`, `newOpenChannelMutedParticipantListFragment()`, `newOpenChannelBannedUserListFragment()` in `UIKitFragmentFactory`
* Improved stability

### v3.0.0 (Jul 12, 2022) with Core SDK `v4.0.4`
### v3.0.0 (Jul 12, 2022) with Chat SDK `v4.0.4`
* Support `modules` and `components` in the UIKit
* Added `setEditedTextMarkUIConfig(TextUIConfig, TextUIConfig)` in `OpenChannelFragment.Builder`
* Rename `PromoteOperator` to `RegisterOperator`
Expand All @@ -99,7 +106,7 @@
* See more details and breaking changes. [[details](/changelogs/BREAKINGCHANGES_V3.md)]
* See the Migration Guide for Converting V2 to V3. [[details](/changelogs/MIGRATIONGUIDE_V3.md)]

### v3.0.0-beta.3 (Jun 02, 2022) with Core SDK `v3.1.14`
### v3.0.0-beta.3 (Jun 02, 2022) with Chat SDK `v3.1.14`
* Synchronized Builder methods and Params methods
* Added `setErrorText()` in `BannedUserListFragment.Builder`, `ChannelListFragment.Builder`, `MemberListFragment.Builder`, `MutedMemberListFragment.Builder`, `OperatorListFragment.Builder`
* Added `setOnInputRightButtonClickListener()`, `setOnEditModeCancelButtonClickListener()`, `setOnEditModeSaveButtonClickListener()`, `setOnQuoteReplyModeCloseButtonClickListener()`, `setOnInputModeChangedListener()`, `setUseSuggestedMentionListDivider()`, `setOnTooltipClickListener()`, `setOnScrollBottomButtonClickListener()`, `setErrorText()` in `ChannelFragment.Builder`, `OpenChannelFragment.Builder`
Expand All @@ -122,7 +129,7 @@
* Added `ChannelPushSettingFragment` and `ChannelPushSettingActivity`
* Added `ChannelPushSettingViewModel`, `ChannelPushSettingModule`, and `ChannelPushSettingComponent`

### v3.0.0-beta.2 (Apr 29, 2022) with Core SDK `v3.1.12`
### v3.0.0-beta.2 (Apr 29, 2022) with Chat SDK `v3.1.12`
* Supported user mention in `GroupChannel`
* Now you can send mentioning text to the other users in `GroupChannel`. These following functions are available
* Added `setUseMention(boolean)`, `setUserMentionConfig(UserMentionConfig)`, `getUserMentionConfig()` and `isUsingMention()` in `SendbirdUIKit`
Expand All @@ -142,7 +149,7 @@
* Added `getMentionSuggestion()` in `ChannelViewModel`
* Added `loadMemberList(String)` in `ChannelViewModel`

### v3.0.0-beta (Apr 12, 2022) with Core SDK `v3.1.10`
### v3.0.0-beta (Apr 12, 2022) with Chat SDK `v3.1.10`
* Support `modules` and `components` in the UIKit
* See more details and breaking changes. [[details](/changelogs/BREAKINGCHANGES_V3.md)]
* See the Migration Guide for Converting V2 to V3. [[details](/changelogs/MIGRATIONGUIDE_V3.md)]
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.1
UIKIT_VERSION = 3.3.2
UIKIT_VERSION_CODE = 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.sendbird.android.channel.BaseChannel;
import com.sendbird.android.message.BaseMessage;
import com.sendbird.android.message.Reaction;
Expand Down Expand Up @@ -66,7 +65,6 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
Glide.with(context)
.load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.signature(new ObjectKey(url))
.error(errorIcon)
.apply(RequestOptions.circleCropTransform())
.into(binding.ivProfileView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.sendbird.android.channel.BaseChannel;
import com.sendbird.android.message.BaseMessage;
import com.sendbird.android.message.Reaction;
Expand Down Expand Up @@ -66,7 +65,6 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
Glide.with(context)
.load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.signature(new ObjectKey(url))
.error(errorIcon)
.apply(RequestOptions.circleCropTransform())
.into(binding.ivProfileView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.sendbird.android.channel.BaseChannel;
import com.sendbird.android.channel.OpenChannel;
import com.sendbird.android.message.BaseMessage;
Expand Down Expand Up @@ -87,7 +86,6 @@ public void bind(@NonNull BaseChannel channel, @NonNull BaseMessage message, @No
Glide.with(context)
.load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.signature(new ObjectKey(url))
.error(errorIcon)
.apply(RequestOptions.circleCropTransform())
.into(binding.ivProfileView);
Expand Down
10 changes: 5 additions & 5 deletions uikit/src/main/java/com/sendbird/uikit/SendbirdUIKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ public ColorStateList getErrorTintColorStateList(@NonNull Context context) {
@NonNull
private static volatile ThemeMode defaultThemeMode = ThemeMode.Light;
private static volatile boolean useDefaultUserProfile = false;
private static volatile boolean useCompression = false;
private static volatile boolean useCompression = true;
@Nullable
private static CustomUserListQueryHandler customUserListQueryHandler;
@Nullable
private static CustomParamsHandler customParamsHandler;
private static int compressQuality = 100;
private static int compressQuality = 70;
@NonNull
private static Pair<Integer, Integer> resizingSize = new Pair<>(DEFAULT_RESIZING_WIDTH_SIZE, DEFAULT_RESIZING_HEIGHT_SIZE);
@NonNull
Expand Down Expand Up @@ -637,7 +637,7 @@ private static void updateEmojiList() {
}

/**
* Sets whether the image file compress when trying to send image file message. Default value is <code>false</code>.
* Sets whether the image file compress when trying to send image file message. Default value is <code>true</code>.
* The target image types are 'image/jpg`, `image/jpeg`, and `image/png`, the others will be ignored.
*
* @param useCompression If <code>true</code> the image file will be transferred to the original image, <code>false</code> other wise.
Expand All @@ -658,11 +658,11 @@ public static boolean shouldUseImageCompression() {
}

/**
* Image compression quality value that will be used when sending image. Default value is 100.
* Image compression quality value that will be used when sending image. Default value is 70.
* It has to be bigger than 0 and cannot exceed 100.
*
* @param compressQuality Hint to the compressor, 0-100. 0 meaning compress for
* small size, 100 meaning compress for max quality. Some
* smallest size, 100 meaning compress for max quality. Some
* formats, like PNG which is lossless, will ignore the
* quality setting
* @see android.graphics.Bitmap#compress(Bitmap.CompressFormat format, int quality, OutputStream stream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ public static Intent newIntent(@NonNull Context context, @NonNull ChannelType ch
intent.putExtra(StringSet.KEY_MESSAGE_FILENAME, message.getName());
intent.putExtra(StringSet.KEY_CHANNEL_URL, message.getChannelUrl());
intent.putExtra(StringSet.KEY_IMAGE_URL, message.getUrl());
intent.putExtra(StringSet.KEY_IMAGE_PLAIN_URL, message.getPlainUrl());
intent.putExtra(StringSet.KEY_REQUEST_ID, message.getRequestId());
intent.putExtra(StringSet.KEY_MESSAGE_MIMETYPE, message.getType());
intent.putExtra(StringSet.KEY_MESSAGE_CREATEDAT, message.getCreatedAt());
intent.putExtra(StringSet.KEY_SENDER_ID, message.getSender().getUserId());
intent.putExtra(StringSet.KEY_SENDER_ID, message.getSender() == null ? 0 : message.getSender().getUserId());
intent.putExtra(StringSet.KEY_MESSAGE_SENDER_NAME, message.getSender().getNickname());
intent.putExtra(StringSet.KEY_CHANNEL_TYPE, channelType);
intent.putExtra(StringSet.KEY_DELETABLE_MESSAGE, MessageUtils.isDeletableMessage(message));
Expand All @@ -50,14 +52,16 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
final String channelUrl = intent.getStringExtra(StringSet.KEY_CHANNEL_URL);
final String fileName = intent.getStringExtra(StringSet.KEY_MESSAGE_FILENAME);
final String url = intent.getStringExtra(StringSet.KEY_IMAGE_URL);
final String plainUrl = intent.getStringExtra(StringSet.KEY_IMAGE_PLAIN_URL);
final String requestId = intent.getStringExtra(StringSet.KEY_REQUEST_ID);
final String mimeType = intent.getStringExtra(StringSet.KEY_MESSAGE_MIMETYPE);
final String senderNickname = intent.getStringExtra(StringSet.KEY_MESSAGE_SENDER_NAME);
final long createdAt = intent.getLongExtra(StringSet.KEY_MESSAGE_CREATEDAT, 0L);
final ChannelType channelType = (ChannelType) intent.getSerializableExtra(StringSet.KEY_CHANNEL_TYPE);
final boolean isDeletable = intent.getBooleanExtra(StringSet.KEY_DELETABLE_MESSAGE, MessageUtils.isMine(senderId));

final PhotoViewFragment fragment = new PhotoViewFragment.Builder(senderId, fileName,
channelUrl, url, mimeType, senderNickname, createdAt,
channelUrl, url, plainUrl, requestId, mimeType, senderNickname, createdAt,
messageId, channelType, SendbirdUIKit.getDefaultThemeMode(), isDeletable)
.build();

Expand Down
3 changes: 3 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 @@ -11,6 +11,8 @@ public class StringSet {

public final static String KEY_MESSAGE_FILENAME = "KEY_MESSAGE_FILENAME";
public final static String KEY_IMAGE_URL = "KEY_IMAGE_URL";
public final static String KEY_IMAGE_PLAIN_URL = "KEY_IMAGE_PLAIN_URL";
public final static String KEY_REQUEST_ID = "KEY_REQUEST_ID";
public final static String KEY_MESSAGE_MIMETYPE = "KEY_MESSAGE_MIMETYPE";
public final static String KEY_MESSAGE_CREATEDAT = "KEY_MESSAGE_CREATEDAT";
public final static String KEY_MESSAGE_SENDER_NAME = "KEY_MESSAGE_SENDER_NAME";
Expand Down Expand Up @@ -118,6 +120,7 @@ public class StringSet {
public final static String EVENT_MESSAGE_SENT = "EVENT_MESSAGE_SENT";
public final static String EVENT_MESSAGE_RECEIVED = "EVENT_MESSAGE_RECEIVED";
public final static String EVENT_MESSAGE_UPDATED = "EVENT_MESSAGE_UPDATED";
public final static String INVALID_URL = "INVALID_URL";
public final static String photo = "photo";

public final static String Chat = "Chat";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.sendbird.uikit.consts.StringSet;
import com.sendbird.uikit.databinding.SbFragmentPhotoViewBinding;
import com.sendbird.uikit.interfaces.LoadingDialogHandler;
import com.sendbird.uikit.internal.model.GlideCachedUrlLoader;
import com.sendbird.uikit.internal.tasks.JobResultTask;
import com.sendbird.uikit.internal.tasks.TaskQueue;
import com.sendbird.uikit.log.Logger;
Expand All @@ -61,6 +62,10 @@ public class PhotoViewFragment extends PermissionFragment implements PermissionF
@Nullable
private String url;
@Nullable
private String plainUrl;
@Nullable
private String requestId;
@Nullable
private String mimeType;
@Nullable
private String senderNickname;
Expand Down Expand Up @@ -90,6 +95,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
fileName = args.getString(StringSet.KEY_MESSAGE_FILENAME);
channelUrl = args.getString(StringSet.KEY_CHANNEL_URL);
url = args.getString(StringSet.KEY_IMAGE_URL);
plainUrl = args.getString(StringSet.KEY_IMAGE_PLAIN_URL);
requestId = args.getString(StringSet.KEY_REQUEST_ID);
mimeType = args.getString(StringSet.KEY_MESSAGE_MIMETYPE);
senderNickname = args.getString(StringSet.KEY_MESSAGE_SENDER_NAME);
createdAt = args.getLong(StringSet.KEY_MESSAGE_CREATEDAT);
Expand Down Expand Up @@ -133,11 +140,11 @@ public void onResume() {
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

private <T> RequestBuilder<T> makeRequestBuilder(@NonNull String url, @NonNull Class<T> clazz) {
private <T> RequestBuilder<T> makeRequestBuilder(@NonNull String url, @NonNull String cacheKey, @NonNull Class<T> clazz) {
final View loading = binding.loading;
final RequestManager glide = Glide.with(this);

return glide.as(clazz).diskCacheStrategy(DiskCacheStrategy.ALL).load(url).listener(new RequestListener<T>() {
return GlideCachedUrlLoader.load(glide.as(clazz), url, cacheKey).diskCacheStrategy(DiskCacheStrategy.ALL).listener(new RequestListener<T>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<T> target, boolean isFirstResource) {
if (!isFragmentAlive()) return false;
Expand Down Expand Up @@ -167,16 +174,18 @@ protected void onDrawPage() {
final TextView tvCreatedAt = binding.tvCreatedAt;
final View loading = binding.loading;
final String url = this.url;
final String plainUrl = this.plainUrl == null ? "" : this.plainUrl;
final String requestId = this.requestId == null ? "" : this.requestId;

tvTitle.setText(senderNickname);
tvCreatedAt.setText(DateUtils.formatTime(requireContext(), this.createdAt));
loading.setVisibility(View.VISIBLE);

if (url != null) {
if (mimeType != null && mimeType.toLowerCase().contains(StringSet.gif)) {
makeRequestBuilder(url, GifDrawable.class).into(ivPhoto);
makeRequestBuilder(url, generateCacheKey(plainUrl, requestId), GifDrawable.class).into(ivPhoto);
} else {
makeRequestBuilder(url, Bitmap.class).into(ivPhoto);
makeRequestBuilder(url, generateCacheKey(plainUrl, requestId), Bitmap.class).into(ivPhoto);
}
}

Expand Down Expand Up @@ -220,6 +229,11 @@ protected void onDrawPage() {
attacher.setOnPhotoTapListener((view, x, y) -> togglePhotoActionBar());
}

@NonNull
private String generateCacheKey(@NonNull String plainUrl, @NonNull String requestId) {
return (TextUtils.isNotEmpty(requestId)) ? requestId : String.valueOf(plainUrl.hashCode());
}

private void togglePhotoActionBar() {
View vgHeader = binding.vgHeader;
View vgBottom = binding.vgBottom;
Expand Down Expand Up @@ -342,12 +356,14 @@ public static class Builder {
private LoadingDialogHandler loadingDialogHandler;

public Builder(@Nullable String senderId, @Nullable String fileName, @Nullable String channelUrl,
@Nullable String url, @Nullable String mimeType, @Nullable String senderNickname, long createdAt,
@Nullable String url, @Nullable String plainUrl, @Nullable String requestId, @Nullable String mimeType, @Nullable String senderNickname, long createdAt,
long messageId, @Nullable ChannelType channelType, @Nullable SendbirdUIKit.ThemeMode themeMode, boolean isDeletableMessage) {
bundle.putString(StringSet.KEY_SENDER_ID, senderId);
bundle.putString(StringSet.KEY_MESSAGE_FILENAME, fileName);
bundle.putString(StringSet.KEY_CHANNEL_URL, channelUrl);
bundle.putString(StringSet.KEY_IMAGE_URL, url);
bundle.putString(StringSet.KEY_IMAGE_PLAIN_URL, plainUrl);
bundle.putString(StringSet.KEY_REQUEST_ID, requestId);
bundle.putString(StringSet.KEY_MESSAGE_MIMETYPE, mimeType);
bundle.putString(StringSet.KEY_MESSAGE_SENDER_NAME, senderNickname);
bundle.putLong(StringSet.KEY_MESSAGE_CREATEDAT, createdAt);
Expand Down
Loading

0 comments on commit c9d2c6b

Please sign in to comment.