Skip to content

Commit

Permalink
Added 3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Doo Rim authored and Doo Rim committed Sep 29, 2022
1 parent 4005be4 commit 65e1917
Show file tree
Hide file tree
Showing 45 changed files with 557 additions and 160 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

### v3.2.1 (Sep 29, 2022) with Core 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`
* Added `setMessageInputTextUIConfig(TextUIConfig)` in `OpenChannelFragment.Builder`
* Added `setMessageInputTextUIConfig(TextUIConfig)` and `getMessageInputTextUIConfig()` in `MessageInputComponent.Params`
* Added `setMessageInputTextUIConfig(TextUIConfig)` and `getMessageInputTextUIConfig()` in `OpenChannelMessageInputComponent.Params`
* Added `setRepliedMessageTextUIConfig(TextUIConfig)` in `MessageListComponent.Params`
* Added `setCustomFontRes(int)` in `TextUIConfig.Builder`

### v3.2.0 (Sep 15, 2022) with Core SDK `v4.0.8`
* Support OpenChannel list
* Added `OpenChannelListActivity`, `OpenChannelListFragment`, `OpenChannelListModule`, `OpenChannelListViewModel`, `OpenChannelListComponent`, and `OpenChannelListAdapter`
Expand Down
26 changes: 5 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://repo.sendbird.com/public/maven" }
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
id 'com.google.gms.google-services' version '4.3.10' apply false
}

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.0
UIKIT_VERSION = 3.2.1
UIKIT_VERSION_CODE = 1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon May 02 15:36:41 KST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
17 changes: 17 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://repo.sendbird.com/public/maven" }
}
}

include ':uikit-custom-sample'
include ':uikit-sample', ':uikit'
rootProject.name='sendbird-uikit-android-sources'
6 changes: 4 additions & 2 deletions uikit-custom-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

android {
compileSdkVersion 33
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.sendbird.uikit.customsample.groupchannel.fragments.CustomRegisterOperatorFragment;
import com.sendbird.uikit.customsample.openchannel.CustomCreateOpenChannelFragment;
import com.sendbird.uikit.customsample.openchannel.CustomOpenChannelSettingsFragment;
import com.sendbird.uikit.fragments.ChannelFragment;
import com.sendbird.uikit.fragments.UIKitFragmentFactory;

/**
Expand All @@ -38,9 +39,10 @@ public Fragment newChannelListFragment(@NonNull Bundle args) {
@NonNull
@Override
public Fragment newChannelFragment(@NonNull String channelUrl, @NonNull Bundle args) {
final Fragment fragment = new CustomChannelFragment();
fragment.setArguments(args);
return fragment;
return new ChannelFragment.Builder(channelUrl)
.setCustomFragment(new CustomChannelFragment())
.withArguments(args)
.build();
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private void showMediaSelectDialog() {

private void takeCamera() {
SendbirdChat.setAutoBackgroundDetection(false);
this.mediaUri = FileUtils.createPictureImageUri(requireContext());
this.mediaUri = FileUtils.createImageFileUri(requireContext());
if (mediaUri == null) return;
Intent intent = IntentUtils.getCameraIntent(requireContext(), mediaUri);
if (IntentUtils.hasIntent(requireContext(), intent)) {
Expand Down
6 changes: 4 additions & 2 deletions uikit-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

version = UIKIT_VERSION
android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ private void showMediaSelectDialog() {

private void takeCamera() {
SendbirdChat.setAutoBackgroundDetection(false);
this.mediaUri = FileUtils.createPictureImageUri(requireContext());
this.mediaUri = FileUtils.createImageFileUri(requireContext());
if (mediaUri == null) return;
Intent intent = IntentUtils.getCameraIntent(requireContext(), mediaUri);
if (IntentUtils.hasIntent(requireContext(), intent)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ protected OpenChannelFragment createOpenChannelFragment(@NonNull String channelU
args.putString("DESCRIPTION", creatorName);
args.putString("INPUT_TEXT", inputText);

LiveStreamChannelFragment fragment = new LiveStreamChannelFragment();
fragment.setArguments(args);
return fragment;
return new OpenChannelFragment.Builder(channelUrl)
.withArguments(args)
.setCustomFragment(new LiveStreamChannelFragment())
.setUseHeader(true)
.build();
}
}
8 changes: 5 additions & 3 deletions uikit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}

version = UIKIT_VERSION
android {
Expand Down Expand Up @@ -63,7 +65,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// Sendbird
api 'com.sendbird.sdk:sendbird-chat:4.0.8'
api 'com.sendbird.sdk:sendbird-chat:4.0.9'

implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
Expand Down
2 changes: 2 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 @@ -26,6 +26,7 @@ public class StringSet {
public final static String KEY_USE_MESSAGE_GROUP_UI = "KEY_USE_MESSAGE_GROUP_UI";
public final static String KEY_MENTION_UI_CONFIG_SENT_FROM_ME = "KEY_MENTION_UI_CONFIG_SENT_FROM_ME";
public final static String KEY_MENTION_UI_CONFIG_SENT_FROM_OTHERS = "KEY_MENTION_UI_CONFIG_SENT_FROM_OTHERS";
public final static String KEY_MESSAGE_INPUT_TEXT_UI_CONFIG = "KEY_MESSAGE_INPUT_TEXT_UI_CONFIG";
public final static String KEY_EDITED_MARK_UI_CONFIG_SENT_FROM_ME = "KEY_EDITED_MARK_UI_CONFIG_SENT_FROM_ME";
public final static String KEY_EDITED_MARK_UI_CONFIG_SENT_FROM_OTHERS = "KEY_EDITED_MARK_UI_CONFIG_SENT_FROM_OTHERS";
public final static String KEY_MESSAGE_TEXT_UI_CONFIG_SENT_FROM_ME = "KEY_MESSAGE_TEXT_UI_CONFIG_SENT_FROM_ME";
Expand All @@ -34,6 +35,7 @@ public class StringSet {
public final static String KEY_SENT_AT_TEXT_UI_CONFIG_SENT_FROM_OTHERS = "KEY_SENT_AT_TEXT_UI_CONFIG_SENT_FROM_OTHERS";
public final static String KEY_NICKNAME_TEXT_UI_CONFIG_SENT_FROM_ME = "KEY_NICKNAME_TEXT_UI_CONFIG_SENT_FROM_ME";
public final static String KEY_NICKNAME_TEXT_UI_CONFIG_SENT_FROM_OTHERS = "KEY_NICKNAME_TEXT_UI_CONFIG_SENT_FROM_OTHERS";
public final static String KEY_REPLIED_MESSAGE_TEXT_UI_CONFIG = "KEY_REPLIED_MESSAGE_TEXT_UI_CONFIG";
public final static String KEY_OPERATOR_TEXT_UI_CONFIG = "KEY_OPERATOR_TEXT_UI_CONFIG";
public final static String KEY_MESSAGE_BACKGROUND_SENT_FROM_ME = "KEY_MESSAGE_BACKGROUND_SENT_FROM_ME";
public final static String KEY_MESSAGE_BACKGROUND_SENT_FROM_OTHERS = "KEY_MESSAGE_BACKGROUND_SENT_FROM_OTHERS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void toastError(@NonNull String message) {
*/
@Override
public void toastError(@NonNull String message, boolean useOverlay) {
if (isFragmentAlive()) ContextUtils.toastError(requireContext(), message);
if (isFragmentAlive()) ContextUtils.toastError(requireContext(), message, useOverlay);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ public class ChannelFragment extends BaseModuleFragment<ChannelModule, ChannelVi
SendbirdChat.setAutoBackgroundDetection(true);
int resultCode = result.getResultCode();

if (resultCode != RESULT_OK || getContext() == null) return;
final Uri mediaUri = ChannelFragment.this.mediaUri;
if (mediaUri != null && isFragmentAlive()) {
sendFileMessage(mediaUri);
}
});
private final ActivityResultLauncher<Intent> takeVideoLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
SendbirdChat.setAutoBackgroundDetection(true);
int resultCode = result.getResultCode();

if (resultCode != RESULT_OK) return;
final Uri mediaUri = ChannelFragment.this.mediaUri;
if (mediaUri != null && isFragmentAlive()) {
Expand Down Expand Up @@ -1025,6 +1035,7 @@ protected void showMediaSelectDialog() {
if (getContext() == null) return;
DialogListItem[] items = {
new DialogListItem(R.string.sb_text_channel_input_camera, R.drawable.icon_camera),
new DialogListItem(R.string.sb_text_channel_input_take_video, R.drawable.icon_camera),
new DialogListItem(R.string.sb_text_channel_input_gallery, R.drawable.icon_photo),
new DialogListItem(R.string.sb_text_channel_input_document, R.drawable.icon_document)
};
Expand All @@ -1034,6 +1045,8 @@ protected void showMediaSelectDialog() {
try {
if (key == R.string.sb_text_channel_input_camera) {
takeCamera();
} else if (key == R.string.sb_text_channel_input_take_video) {
takeVideo();
} else if (key == R.string.sb_text_channel_input_gallery) {
takePhoto();
} else {
Expand All @@ -1043,6 +1056,8 @@ protected void showMediaSelectDialog() {
Logger.e(e);
if (key == R.string.sb_text_channel_input_camera) {
toastError(R.string.sb_text_error_open_camera);
} else if (key == R.string.sb_text_channel_input_take_video) {
toastError(R.string.sb_text_error_open_camera);
} else if (key == R.string.sb_text_channel_input_gallery) {
toastError(R.string.sb_text_error_open_gallery);
} else {
Expand All @@ -1061,15 +1076,34 @@ public void takeCamera() {
SendbirdChat.setAutoBackgroundDetection(false);
requestPermission(PermissionUtils.CAMERA_PERMISSION, () -> {
if (getContext() == null) return;
this.mediaUri = FileUtils.createPictureImageUri(getContext());
this.mediaUri = FileUtils.createImageFileUri(getContext());
if (mediaUri == null) return;
Intent intent = IntentUtils.getCameraIntent(getContext(), mediaUri);
if (IntentUtils.hasIntent(getContext(), intent)) {
Intent intent = IntentUtils.getCameraIntent(requireContext(), mediaUri);
if (IntentUtils.hasIntent(requireContext(), intent)) {
takeCameraLauncher.launch(intent);
}
});
}

/**
* Call taking camera application for video capture.
*
* @since 3.2.1
*/
public void takeVideo() {
SendbirdChat.setAutoBackgroundDetection(false);
requestPermission(PermissionUtils.CAMERA_PERMISSION, () -> {
if (getContext() == null) return;
this.mediaUri = FileUtils.createVideoFileUri(getContext());
if (mediaUri == null) return;

Intent intent = IntentUtils.getVideoCaptureIntent(getContext(), mediaUri);
if (IntentUtils.hasIntent(getContext(), intent)) {
takeVideoLauncher.launch(intent);
}
});
}

/**
* Call taking gallery application.
*
Expand Down Expand Up @@ -2048,6 +2082,32 @@ public Builder setNicknameTextUIConfig(@NonNull TextUIConfig configSentFromOther
return this;
}

/**
* Sets the UI configuration of the replied parent message text.
*
* @param configRepliedMessage the UI configuration of the replied parent message text.
* @return This Builder object to allow for chaining of calls to set methods.
* @since 3.2.1
*/
@NonNull
public Builder setRepliedMessageTextUIConfig(@NonNull TextUIConfig configRepliedMessage) {
bundle.putParcelable(StringSet.KEY_REPLIED_MESSAGE_TEXT_UI_CONFIG, configRepliedMessage);
return this;
}

/**
* Sets the UI configuration of message input text.
*
* @param textUIConfig the UI configuration of the message input text.
* @return This Builder object to allow for chaining of calls to set methods.
* @since 3.2.1
*/
@NonNull
public Builder setMessageInputTextUIConfig(@NonNull TextUIConfig textUIConfig) {
bundle.putParcelable(StringSet.KEY_MESSAGE_INPUT_TEXT_UI_CONFIG, textUIConfig);
return this;
}

/**
* Sets the UI configuration of message background drawable.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ private void showMediaSelectDialog() {

private void takeCamera() {
if (!isFragmentAlive()) return;
mediaUri = FileUtils.createPictureImageUri(requireContext());
mediaUri = FileUtils.createImageFileUri(requireContext());
if (mediaUri == null) return;
Intent intent = IntentUtils.getCameraIntent(requireActivity(), mediaUri);
if (IntentUtils.hasIntent(requireContext(), intent)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private void takeCamera() {
SendbirdChat.setAutoBackgroundDetection(false);
requestPermission(PermissionUtils.CAMERA_PERMISSION, () -> {
if (getContext() == null) return;
this.mediaUri = FileUtils.createPictureImageUri(getContext());
this.mediaUri = FileUtils.createImageFileUri(getContext());
if (mediaUri == null) return;
Intent intent = IntentUtils.getCameraIntent(getContext(), mediaUri);
if (IntentUtils.hasIntent(getContext(), intent)) {
Expand Down
Loading

0 comments on commit 65e1917

Please sign in to comment.