Skip to content

Commit

Permalink
Added v3.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sendbird-sdk-deployment committed Apr 25, 2024
1 parent d934102 commit c017656
Show file tree
Hide file tree
Showing 75 changed files with 2,622 additions and 291 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
# Changelog
### v3.16.0 (Apr 25, 2024) with Chat SDK `v4.16.2`
Support a way to customise the menu items in the `ChannelSettingsMenuComponent` and `OpenChannelSettingsMenuComponent`.
- Added `createMenuView(Context, String, String, SingleMenuType, int, int)` in `ChannelSettingsMenuComponent`
- Added `setMenuList(List<Menu>, MenuViewProvider) in `ChannelSettingsMenuComponent.Params`
- Added `MenuViewProvider` to ChannelSettings that allows you to create and make custom menus.

* Simple example for creating custom menu.
```kotlin
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ ->
ChannelSettingsModule(context).apply {
val customMenuList = ChannelSettingsMenuComponent.defaultMenuSet.toMutableList().apply {
add(ChannelSettingsMenuComponent.Menu.CUSTOM)
}
val component = ChannelSettingsMenuComponent().apply {
// set the custom menu list.
params.setMenuList(customMenuList) { context, _ -> // create custom menu view.
createMenuView(
context,
"Go to Chat",
null,
SingleMenuType.NONE,
R.drawable.icon_chat,
0
)
}
}
setChannelSettingsMenuComponent(component)
}
}
```

- Added `getActionContextMenuTitle(Member, GroupChannel)`, `makeActionContextMenu(Member, GroupChannel)`, and `onActionContextMenuItemClicked(Member, DialogListItem, GroupChannel)` in `MemberListFragment`
- Added `getActionContextMenuTitle(User, OpenChannel)`, `makeActionContextMenu(User, OpenChannel)`, and `onActionContextMenuItemClicked(User, DialogListItem, OpenChannel)` in `MemberListFragment`
- Added `Message template` feature for `GroupChannel`.
### v3.15.0 (Mar 28, 2024) with Chat SDK `v4.16.0`
* Added `sendLogViewed(List<BaseMessage>)` in `FeedNotificationChannelViewModel`.
* Deprecated `sendLogImpression(List<BaseMessage>)` in `FeedNotificationChannelViewModel`.
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.15.0
UIKIT_VERSION = 3.16.0
UIKIT_VERSION_CODE = 1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal fun SampleType?.getLogoDrawable(context: Context): Drawable? {
return when (this) {
null -> R.drawable.logo_sendbird
SampleType.Basic -> R.drawable.logo_sendbird
SampleType.Notification -> R.drawable.logo_notifications
SampleType.Notification -> R.drawable.logo_business_messaging
SampleType.Customization -> R.drawable.logo_sendbird
SampleType.AiChatBot -> R.drawable.logo_sendbird
}.let { ContextCompat.getDrawable(context, it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ import com.sendbird.uikit.samples.customization.channel.showNewMessageTypeSample
import com.sendbird.uikit.samples.customization.channellist.showChannelItemFilteringSample
import com.sendbird.uikit.samples.customization.channellist.showChannelItemUISample
import com.sendbird.uikit.samples.customization.channellist.showNewChannelItemTypeSample
import com.sendbird.uikit.samples.customization.channelsettings.showAppendNewCustomGroupChannelSettingsMenuSample
import com.sendbird.uikit.samples.customization.channelsettings.showCustomGroupChannelSettingsMenuSample
import com.sendbird.uikit.samples.customization.channelsettings.showHidingChannelSettingsMenuSample
import com.sendbird.uikit.samples.customization.global.showAdapterProvidersSample
import com.sendbird.uikit.samples.customization.global.showFragmentProvidersSample
import com.sendbird.uikit.samples.customization.global.showModuleProvidersSample
import com.sendbird.uikit.samples.customization.global.showViewModelProvidersSample
import com.sendbird.uikit.samples.customization.userlist.showCustomMemberContextMenuSample
import com.sendbird.uikit.samples.customization.userlist.showUserItemDataSourceSample
import com.sendbird.uikit.samples.customization.userlist.showUserItemFilteringSample
import com.sendbird.uikit.samples.customization.userlist.showUserItemSelectSample
Expand Down Expand Up @@ -130,6 +134,25 @@ class CustomizationHomeActivity : ComponentActivity() {
) { showChannelItemFilteringSample(this) },
// endregion

// region channel settings customization
CustomizationItem(
isHeader = true,
title = getString(R.string.text_list_title_channel_settings)
),
CustomizationItem(
title = getString(R.string.text_title_custom_channel_settings_menu_sample),
description = getString(R.string.text_desc_custom_channel_settings_menu_sample)
) { showCustomGroupChannelSettingsMenuSample(this) },
CustomizationItem(
title = getString(R.string.text_title_append_new_channel_settings_menu_sample),
description = getString(R.string.text_desc_append_new_channel_settings_menu_sample)
) { showAppendNewCustomGroupChannelSettingsMenuSample(this) },
CustomizationItem(
title = getString(R.string.text_title_hide_channel_settings_menu_sample),
description = getString(R.string.text_desc_hide_channel_settings_menu_sample)
) { showHidingChannelSettingsMenuSample(this) },
// endregion

// region user list customization
CustomizationItem(
isHeader = true,
Expand All @@ -150,7 +173,11 @@ class CustomizationHomeActivity : ComponentActivity() {
CustomizationItem(
title = getString(R.string.text_title_user_item_custom_datasource),
description = getString(R.string.text_desc_user_item_custom_datasource),
) { showUserItemDataSourceSample(this) }
) { showUserItemDataSourceSample(this) },
CustomizationItem(
title = getString(R.string.text_title_custom_member_context_menu),
description = getString(R.string.text_desc_custom_member_context_menu),
) { showCustomMemberContextMenuSample(this) }
// endregion
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package com.sendbird.uikit.samples.customization.channelsettings

import android.app.Activity
import com.sendbird.uikit.activities.ChannelSettingsActivity
import com.sendbird.uikit.consts.SingleMenuType
import com.sendbird.uikit.interfaces.providers.ChannelSettingsModuleProvider
import com.sendbird.uikit.modules.ChannelSettingsModule
import com.sendbird.uikit.modules.components.ChannelSettingsMenuComponent
import com.sendbird.uikit.providers.ModuleProviders
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.customization.GroupChannelRepository

fun showAppendNewCustomGroupChannelSettingsMenuSample(activity: Activity) {
// You can customize the Group Channel settings menu using the following code.
// The following code is an example of how to customize the Group Channel settings menu.
// If you want to handle the CUSTOM menu click event, you should handle it yourself after creating a custom menu view.
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ ->
val module = ChannelSettingsModule(context).apply {
val customMenuList = ChannelSettingsMenuComponent.defaultMenuSet.toMutableList().apply {
add(ChannelSettingsMenuComponent.Menu.CUSTOM)
}
val component = ChannelSettingsMenuComponent().apply {
// set the custom menu list.
params.setMenuList(customMenuList) { context, _ -> // create custom menu view.
createMenuView(
context,
"Go to Chat",
null,
SingleMenuType.NEXT,
R.drawable.icon_chat,
0
).apply {
// set the click event listener here.
setOnClickListener {
println(">>>>>> Go to Chat")
}
}
}
}
setChannelSettingsMenuComponent(component)
}
module
}

GroupChannelRepository.getRandomChannel(activity) { channel ->
activity.startActivity(ChannelSettingsActivity.newIntent(activity, channel.url))
}
}

fun showCustomGroupChannelSettingsMenuSample(activity: Activity) {
// You can customize the Group Channel settings menu using the following code.
// It shows how to make custom menu items in the Group Channel settings menu.
// If you want to handle the CUSTOM menu click event, you should handle it yourself after creating a custom menu view.
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ ->
val module = ChannelSettingsModule(context).apply {
val component = ChannelSettingsMenuComponent().apply {
// set the custom menu list.
params.setMenuList(
listOf(
ChannelSettingsMenuComponent.Menu.CUSTOM,
ChannelSettingsMenuComponent.Menu.MEMBERS,
ChannelSettingsMenuComponent.Menu.LEAVE_CHANNEL,
)
) { context, _ -> // create custom menu view.
createMenuView(
context,
"Go to Chat",
null,
SingleMenuType.NEXT,
R.drawable.icon_chat,
0
).apply {
// set the click event listener here.
setOnClickListener {
println(">>>>>> Go to Chat")
}
}
}
}
setChannelSettingsMenuComponent(component)
}
module
}

GroupChannelRepository.getRandomChannel(activity) { channel ->
activity.startActivity(ChannelSettingsActivity.newIntent(activity, channel.url))
}
}

fun showHidingChannelSettingsMenuSample(activity: Activity) {
// It shows how to hide the default menu items in the Group Channel settings menu.
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ ->
val module = ChannelSettingsModule(context).apply {
val customMenuList = ChannelSettingsMenuComponent.defaultMenuSet.toMutableList().apply {
remove(ChannelSettingsMenuComponent.Menu.LEAVE_CHANNEL)
}
val component = ChannelSettingsMenuComponent().apply {
// hide LEAVE_CHANNEL menu.
params.setMenuList(customMenuList, null)
}
setChannelSettingsMenuComponent(component)
}
module
}

GroupChannelRepository.getRandomChannel(activity) { channel ->
activity.startActivity(ChannelSettingsActivity.newIntent(activity, channel.url))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.sendbird.uikit.samples.customization.userlist

import android.app.Activity
import com.sendbird.android.channel.GroupChannel
import com.sendbird.android.user.Member
import com.sendbird.uikit.activities.MemberListActivity
import com.sendbird.uikit.fragments.MemberListFragment
import com.sendbird.uikit.interfaces.providers.MemberListFragmentProvider
import com.sendbird.uikit.model.DialogListItem
import com.sendbird.uikit.providers.FragmentProviders
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.customization.GroupChannelRepository

fun showCustomMemberContextMenuSample(activity: Activity) {
GroupChannelRepository.getRandomChannel(activity) { channel ->
FragmentProviders.memberList = MemberListFragmentProvider { channelUrl, _ ->
MemberListFragment.Builder(channelUrl)
.setCustomFragment(CustomMemberListFragment())
.build()
}
activity.startActivity(MemberListActivity.newIntent(activity, channel.url))
}
}

class CustomMemberListFragment : MemberListFragment() {
override fun getActionContextMenuTitle(member: Member, channel: GroupChannel?): String {
return "Custom Context Menu"
}

override fun makeActionContextMenu(member: Member, channel: GroupChannel?): MutableList<DialogListItem> {
return super.makeActionContextMenu(member, channel).apply {
add(DialogListItem(R.string.text_menu_thumbs_up, R.drawable.icon_good))
add(DialogListItem(R.string.text_menu_thumbs_down, R.drawable.icon_bad))
}
}

override fun onActionContextMenuItemClicked(member: Member, item: DialogListItem, channel: GroupChannel?): Boolean {
return when (item.key) {
R.string.text_menu_thumbs_up -> {
println(">>>>>> Thumbs Up")
true
}
R.string.text_menu_thumbs_down -> {
println(">>>>>> Thumbs Down")
true
}
else -> super.onActionContextMenuItemClicked(member, item, channel)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class NotificationHomeActivity : ThemeHomeActivity() {
getFeedChannelUrl()
)
)

}
btSignOut.setOnClickListener { logout() }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified uikit-samples/src/main/res/drawable-hdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified uikit-samples/src/main/res/drawable-mdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions uikit-samples/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sb_size_56"
android:background="@drawable/logo_notifications"
android:background="@drawable/logo_business_messaging"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
Expand All @@ -32,7 +32,7 @@
android:textSize="@dimen/sb_text_size_24"
android:textStyle="bold"
android:textColor="@color/onlight_01"
android:text="@string/text_title_login_activity"
android:text="@string/text_title_uikit_sample_app"
app:layout_constraintTop_toBottomOf="@id/logoImageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down Expand Up @@ -168,12 +168,10 @@
android:layout_height="wrap_content"
android:text="@string/text_use_feed_channel_only"
android:buttonTint="@color/primary_300"
android:paddingStart="@dimen/sb_size_8"
android:layout_marginTop="@dimen/sb_size_24"
app:layout_constraintTop_toBottomOf="@id/nicknameLayout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/signInButton"
style="@android:style/Widget.DeviceDefault.Light.CompoundButton.RadioButton"
/>

<Button
Expand Down Expand Up @@ -210,9 +208,9 @@
android:layout_width="@dimen/sb_size_18"
android:layout_height="@dimen/sb_size_18"
android:src="@drawable/icon_chevron_right"
android:tint="@color/selector_primary"
android:rotation="180"
android:layout_marginEnd="@dimen/sb_size_4"
app:tint="@color/selector_primary"
app:layout_constraintTop_toTopOf="@id/selectSampleText"
app:layout_constraintBottom_toBottomOf="@id/selectSampleText"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:textStyle="bold"
android:textColor="@color/onlight_01"
android:fontFamily="sans-serif"
android:text="@string/text_notification_home"/>
android:text="@string/text_business_messaging"/>

<com.sendbird.uikit.samples.common.widgets.EntryButton
android:id="@+id/feedOnlyButton"
Expand Down
2 changes: 1 addition & 1 deletion uikit-samples/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="ExtraTranslation">
tools:ignore="MissingTranslation,ExtraTranslation">

<!-- Header Title -->
<string name="sb_text_header_channel_list">채널</string>
Expand Down
21 changes: 17 additions & 4 deletions uikit-samples/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation,ExtraTranslation">
<string name="app_name">UIKitSamples</string>

<!-- LOGIN -->
<string name="text_title_login_activity">Sendbird UIKit sample</string>
<string name="text_title_basic_sample">Basic Usage</string>
<string name="text_title_basic_sample">Basic Usages</string>
<string name="text_title_ai_chat_bot_sample">Talk to an AI Chatbot</string>
<string name="text_title_customization_sample">Customizations</string>
<string name="text_title_notification_sample">Sendbird Notification</string>
<string name="text_title_notification_sample">Business Messaging sample</string>
<string name="text_title_uikit_sample_app">UIKit sample app</string>

<string name="text_version_info">UI Kit v%1$s &#160;&#160;&#160;&#160; SDK v%2$s</string>
Expand Down Expand Up @@ -58,7 +58,7 @@
<string name="sb_text_go_to_readme">Go to README</string>

<!-- Notifications -->
<string name="text_notification_home">Notification Home</string>
<string name="text_business_messaging">Business Messaging</string>
<string name="text_notification_chat_and_feed_type">Chat and Feed channels</string>
<string name="text_notification_feed_type_only">Feed channel only</string>

Expand Down Expand Up @@ -108,6 +108,15 @@
<string name="text_channel_typing_indicator_double">%s and %s are typing&#8230;</string>
<string name="text_channel_typing_indicator_multiple">Several people are typing&#8230;</string>

<!-- Channel Settings Customization -->
<string name="text_list_title_channel_settings">Channel Settings Customization</string>
<string name="text_title_append_new_channel_settings_menu_sample">Append New Channel Settings Menu</string>
<string name="text_desc_append_new_channel_settings_menu_sample">Append new channel Settings menus.</string>
<string name="text_title_hide_channel_settings_menu_sample">Hide Default Channel Settings Menu</string>
<string name="text_desc_hide_channel_settings_menu_sample">Hide default channel Settings menus.</string>
<string name="text_title_custom_channel_settings_menu_sample">Change The Whole Channel Settings Menu</string>
<string name="text_desc_custom_channel_settings_menu_sample">Change the whole channel Settings menus.</string>

<!-- User List Customization -->
<string name="text_list_title_user_list">User List Customization</string>
<string name="text_title_user_item_ui_sample">User Item UI</string>
Expand All @@ -118,10 +127,14 @@
<string name="text_desc_user_item_filtering">Implement filtering for users based on a specific criteria for display.</string>
<string name="text_title_user_item_custom_datasource">User Item Custom Data Source</string>
<string name="text_desc_user_item_custom_datasource">Retrieve user data from external sources.</string>
<string name="text_title_custom_member_context_menu">Customize member context menu</string>
<string name="text_desc_custom_member_context_menu">Provide a way to make custom member context menus</string>

<string name="text_list_item_nickname_format">#%d. %s</string>

<string name="text_resend">Resend</string>
<string name="text_delete">Delete</string>
<string name="text_custom_header">Custom Header</string>
<string name="text_menu_thumbs_up" >Thumbs Up</string>
<string name="text_menu_thumbs_down">Thumbs Down</string>
</resources>
Loading

0 comments on commit c017656

Please sign in to comment.