Skip to content

Commit

Permalink
Merge pull request #35 from sendbird/release/3.17.0
Browse files Browse the repository at this point in the history
3.17.0
  • Loading branch information
sendbird-sdk-deployment authored May 23, 2024
2 parents 436e979 + d275c11 commit 797e0b1
Show file tree
Hide file tree
Showing 75 changed files with 1,589 additions and 388 deletions.
30 changes: 27 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog
### v3.16.1 (May 3, 2024) with Chat SDK `v4.16.2`
### v3.17.0 (May 23, 2024) with Chat SDK `v4.16.3`
* Deprecated `notifyStatusUpdated(GroupChannel, StatusFrameView)` in `MessageThreadInputComponent`
* Added a new interface to set the enable state of the message input field
* Added `boolean tryToChangeEnableInputView(boolean, String)` in `ChannelFragment`, `MessageThreadFragment`, `OpenChannelFragment`
* Added `boolean tryToChangeEnableInputView(boolean, GroupChannel, String)` in `MessageInputComponent`
* Added `boolean tryToChangeEnableInputView(boolean, OpenChannel, String)` in `OpenChannelMessageInputComponent`

* A new interface has been added to allow you to customise the items in the RecyclerView
* Added `String getActionContextMenuTitle(GroupChannel)`, `List<DialogListItem> makeChannelContextMenu(GroupChannel)`, and `boolean onChannelContextMenuItemClicked(GroupChannel, View, DialogListItem)` in `ChannelListFragment`

* Added a new interface to receive events when a message is clicked or long-clicked on the screen used in Sendbird Business Messaging
* Added `setOnItemClickListener(OnItemClickListener<BaseMessage>)` and `setOnItemLongClickListener(OnItemLongClickListener<BaseMessage>)` in `ChatNotificationChannelFragment.Builder` and `FeedNotificationChannelFragment.Builder`

* Added a new feature to support markdown syntax in UserMessage
* Added `enableMarkdownForUserMessage: Boolean` in `ChannelConfig`. If you enable this feature, you can use markdown syntax in the UserMessage.
* Currently, the following markdown syntax is supported:
* Bold: `**bold**`, `__bold__`
* Link: `[link](https://sendbird.com)`

* Options for Suggested Replies, Direction and Target, have been added.
* These two options only work when `ChannelConfig.enableSuggestedReplies` is enabled, and each flag operates independently.
* Added `SuggestedRepliesDirection.VERTICAL` and `SuggestedRepliesDirection.HORIZONTAL` which indicate the direction of the suggested replies in `SuggestedRepliesView`.
* Added `SuggestedRepliesFor.ALL_MESSAGES` and `SuggestedRepliesFor.LAST_MESSAGE_ONLY`, which specify the target messages for suggested replies.
* Added `suggestedRepliesFor` in `ChannelConfig` to set the target messages for suggested replies.
* Added `suggestedRepliesDirection` in `ChannelConfig` to set the direction of the suggested replies.### v3.16.1 (May 3, 2024) with Chat SDK `v4.16.2`
* Fixed timeline messages not showing up in the channel.
### 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`.
Expand Down Expand Up @@ -177,7 +201,7 @@ ViewModelProviders.channel = ChannelViewModelProvider { owner, channelUrl, param
* Improved stability

### v3.6.0 (Jun 23, 2023) with Chat SDK `v4.9.1`
* Support feature configuration
* Support feature configuration
* Added `UIKitConfig` object
* Added `setChannelConfig(ChannelConfig)` in `ChannelFragment.Builder`, `MessageThreadFragment.Builder`
* Added `setChanneListConfig(ChannelListConfig)` in `ChannelListFragment.Builder`
Expand Down Expand Up @@ -290,7 +314,7 @@ We’re excited to announce the launch of Sendbird Notifications v1.0! It’s a
* Added `setUseBanner(boolean)` in `MessageListComponent.Params`
* Added `setUseUserIdForNickname(boolean)` and `isUsingUserIdForNickname()` in `SendbirdUIKit`

### v3.2.2 (Oct 27, 2022) with Chat 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`
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.16.1
UIKIT_VERSION = 3.17.0
UIKIT_VERSION_CODE = 1
8 changes: 8 additions & 0 deletions uikit-samples/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
android:name=".aichatbot.AIChatBotHomeActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:launchMode="singleTask" />
<activity
android:name=".aichatbot.AiChatBotLoginActivity"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize|stateHidden" />

<!-- notification activities -->
<activity
Expand All @@ -71,6 +75,10 @@
android:name=".notification.NotificationLoginActivity"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name=".notification.FeedChannelListMainActivity"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize|stateHidden" />

<!-- customization activities -->
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.sendbird.uikit.SendbirdUIKit
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.common.ThemeHomeActivity
import com.sendbird.uikit.samples.common.extensions.logout
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils
import com.sendbird.uikit.samples.common.widgets.WaitingDialog
import com.sendbird.uikit.samples.databinding.ActivityAiChatbotHomeBinding
import com.sendbird.uikit.utils.ContextUtils
Expand Down Expand Up @@ -35,7 +36,7 @@ class AIChatBotHomeActivity : ThemeHomeActivity() {
ContextUtils.toastError(this, "Connection must be made. ${e.message}")
return@connect
}
val botId = "client_bot"
val botId = PreferenceUtils.botId
SendbirdUIKit.startChatWithAiBot(this, botId, true) { error ->
if (error != null) {
ContextUtils.toastError(this, "Failed to start chat with ai bot. ${error.message}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.sendbird.uikit.samples.aichatbot

import android.os.Bundle
import android.view.View
import com.sendbird.android.exception.SendbirdException
import com.sendbird.android.push.SendbirdPushHelper
import com.sendbird.android.user.User
import com.sendbird.uikit.log.Logger
import com.sendbird.uikit.samples.common.LoginActivity
import com.sendbird.uikit.samples.common.extensions.authenticate
import com.sendbird.uikit.samples.common.extensions.startingIntent
import com.sendbird.uikit.samples.common.fcm.MyFirebaseMessagingService
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils
import com.sendbird.uikit.samples.common.widgets.WaitingDialog
import com.sendbird.uikit.utils.ContextUtils

class AiChatBotLoginActivity : LoginActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.apply {
title.visibility = View.GONE
botIdLayout.visibility = View.VISIBLE
notificationTitle.visibility = View.VISIBLE
botId.setText(PreferenceUtils.botId.ifEmpty { "client_bot" })
}
}

override fun onSignUp(userId: String, nickname: String) {
Logger.i(">> AiChatBotLoginActivity::onSignUp(), userId=$userId, nickname=$nickname")
val botId = binding.botId.text.toString()
if (botId.isEmpty()) return
Logger.i("++ onSignUp botId=$botId")

WaitingDialog.show(this)
PreferenceUtils.botId = botId
authenticate { _: User?, e: SendbirdException? ->
WaitingDialog.dismiss()
if (e != null) {
Logger.e(e)
ContextUtils.toastError(this@AiChatBotLoginActivity, "${e.message}")
return@authenticate
}
PreferenceUtils.userId = userId
PreferenceUtils.nickname = nickname
SendbirdPushHelper.registerPushHandler(MyFirebaseMessagingService())
val intent = PreferenceUtils.selectedSampleType.startingIntent(this)
startActivity(intent)
finish()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.core.content.ContextCompat
import com.sendbird.android.SendbirdChat
import com.sendbird.uikit.BuildConfig
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.aichatbot.AiChatBotLoginActivity
import com.sendbird.uikit.samples.common.consts.SampleType
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils
import com.sendbird.uikit.samples.databinding.ActivitySelectServiceBinding
Expand All @@ -36,7 +37,7 @@ class SelectServiceActivity : AppCompatActivity() {
aiChatBotSampleButton.setOnClickListener {
if (enableAiChatBotSample) {
PreferenceUtils.selectedSampleType = SampleType.AiChatBot
startActivity(Intent(this@SelectServiceActivity, LoginActivity::class.java))
startActivity(Intent(this@SelectServiceActivity, AiChatBotLoginActivity::class.java))
finish()
} else {
showSampleNotSupported("https://github.com/sendbird/sendbird-uikit-android/tree/main/uikit-samples/src/main/java/com/sendbird/uikit/samples/aichatbot/README.md")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import com.sendbird.android.handler.ConnectHandler
import com.sendbird.android.handler.PushRequestCompleteHandler
import com.sendbird.android.push.SendbirdPushHelper
import com.sendbird.uikit.SendbirdUIKit
import com.sendbird.uikit.activities.FeedNotificationChannelActivity
import com.sendbird.uikit.log.Logger
import com.sendbird.uikit.providers.AdapterProviders
import com.sendbird.uikit.providers.FragmentProviders
import com.sendbird.uikit.providers.ModuleProviders
import com.sendbird.uikit.providers.ViewModelProviders
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.aichatbot.AIChatBotHomeActivity
import com.sendbird.uikit.samples.aichatbot.AiChatBotLoginActivity
import com.sendbird.uikit.samples.basic.BasicHomeActivity
import com.sendbird.uikit.samples.basic.GroupChannelMainActivity
import com.sendbird.uikit.samples.common.LoginActivity
Expand All @@ -31,6 +31,7 @@ import com.sendbird.uikit.samples.common.consts.StringSet
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils
import com.sendbird.uikit.samples.common.widgets.WaitingDialog
import com.sendbird.uikit.samples.customization.CustomizationHomeActivity
import com.sendbird.uikit.samples.notification.FeedChannelListMainActivity
import com.sendbird.uikit.samples.notification.NotificationHomeActivity
import com.sendbird.uikit.samples.notification.NotificationLoginActivity
import com.sendbird.uikit.samples.notification.NotificationMainActivity
Expand All @@ -42,7 +43,7 @@ internal fun SampleType?.getLogoDrawable(context: Context): Drawable? {
SampleType.Basic -> R.drawable.logo_sendbird
SampleType.Notification -> R.drawable.logo_business_messaging
SampleType.Customization -> R.drawable.logo_sendbird
SampleType.AiChatBot -> R.drawable.logo_sendbird
SampleType.AiChatBot -> R.drawable.logo_ai_chatbot
}.let { ContextCompat.getDrawable(context, it) }
}

Expand Down Expand Up @@ -75,7 +76,7 @@ internal fun SampleType?.startingIntent(context: Context): Intent {
if (userId.isNotEmpty()) {
Intent(context, AIChatBotHomeActivity::class.java)
} else {
Intent(context, LoginActivity::class.java)
Intent(context, AiChatBotLoginActivity::class.java)
}
}
}
Expand All @@ -100,8 +101,11 @@ internal fun SampleType?.newRedirectToChannelIntent(
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}
} else {
FeedNotificationChannelActivity.newIntent(context, channelUrl).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
FeedChannelListMainActivity.newRedirectToChannelIntent(
context,
channelUrl,
).apply {
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import com.sendbird.uikit.samples.common.consts.SampleType
internal object PreferenceUtils {
private const val PREFERENCE_KEY_APP_ID = "PREFERENCE_KEY_APP_ID"
private const val PREFERENCE_KEY_USER_ID = "PREFERENCE_KEY_USER_ID"
private const val PREFERENCE_KEY_BOT_ID = "PREFERENCE_KEY_BOT_ID"
private const val PREFERENCE_KEY_NICKNAME = "PREFERENCE_KEY_NICKNAME"
private const val PREFERENCE_KEY_PROFILE_URL = "PREFERENCE_KEY_PROFILE_URL"
private const val PREFERENCE_KEY_THEME_MODE = "PREFERENCE_KEY_THEME_MODE"
private const val PREFERENCE_KEY_DO_NOT_DISTURB = "PREFERENCE_KEY_DO_NOT_DISTURB"
private const val PREFERENCE_KEY_LATEST_USED_SAMPLE = "PREFERENCE_KEY_LATEST_USED_SAMPLE"
private const val PREFERENCE_KEY_NOTIFICATION_USE_AUTHENTICATE = "PREFERENCE_KEY_NOTIFICATION_USE_AUTHENTICATE"
private const val PREFERENCE_KEY_NOTIFICATION_USE_FEED_CHANNEL_ONLY = "PREFERENCE_KEY_NOTIFICATION_USE_FEED_CHANNEL_ONLY"

private lateinit var pref: Preference
Expand Down Expand Up @@ -50,9 +50,9 @@ internal object PreferenceUtils {
get() = pref.getBoolean(PREFERENCE_KEY_DO_NOT_DISTURB, false)
set(doNotDisturb) = pref.putBoolean(PREFERENCE_KEY_DO_NOT_DISTURB, doNotDisturb)

// var isUsingAuthenticate: Boolean
// get() = pref.getBoolean(PREFERENCE_KEY_NOTIFICATION_USE_AUTHENTICATE, false)
// set(useAuth) = pref.putBoolean(PREFERENCE_KEY_NOTIFICATION_USE_AUTHENTICATE, useAuth)
var botId: String
get() = pref.getString(PREFERENCE_KEY_BOT_ID) ?: ""
set(nickname) = pref.putString(PREFERENCE_KEY_BOT_ID, nickname)

var isUsingFeedChannelOnly: Boolean
get() = pref.getBoolean(PREFERENCE_KEY_NOTIFICATION_USE_FEED_CHANNEL_ONLY, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun showAppendNewCustomGroupChannelSettingsMenuSample(activity: Activity) {
// 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 {
ChannelSettingsModule(context).apply {
val customMenuList = ChannelSettingsMenuComponent.defaultMenuSet.toMutableList().apply {
add(ChannelSettingsMenuComponent.Menu.CUSTOM)
}
Expand All @@ -26,7 +26,7 @@ fun showAppendNewCustomGroupChannelSettingsMenuSample(activity: Activity) {
context,
"Go to Chat",
null,
SingleMenuType.NEXT,
SingleMenuType.NONE,
R.drawable.icon_chat,
0
).apply {
Expand All @@ -39,7 +39,6 @@ fun showAppendNewCustomGroupChannelSettingsMenuSample(activity: Activity) {
}
setChannelSettingsMenuComponent(component)
}
module
}

GroupChannelRepository.getRandomChannel(activity) { channel ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.sendbird.uikit.samples.notification

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.sendbird.android.SendbirdChat
import com.sendbird.uikit.SendbirdUIKit
import com.sendbird.uikit.activities.FeedNotificationChannelActivity
import com.sendbird.uikit.modules.components.HeaderComponent
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.common.extensions.setAppearance
import com.sendbird.uikit.samples.databinding.LayoutFeedChannelListBinding
import com.sendbird.uikit.samples.databinding.ViewFeedChannelItemBinding

class FeedChannelListFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return getContentView(inflater, savedInstanceState)
}

private fun getContentView(inflater: LayoutInflater, savedInstanceState: Bundle?): View {
val binding = LayoutFeedChannelListBinding.inflate(inflater)
val themeMode = SendbirdUIKit.getDefaultThemeMode()
binding.feedChannelList.setBackgroundResource(
if (themeMode == SendbirdUIKit.ThemeMode.Light) R.color.background_50 else R.color.background_600
)

HeaderComponent().apply {
this.params.title = getString(R.string.text_tab_channels)
this.params.setUseLeftButton(false)
this.params.setUseRightButton(false)
val header = this.onCreateView(requireContext(), inflater, binding.headerComponent, savedInstanceState)
binding.headerComponent.addView(header)
}

SendbirdChat.appInfo?.notificationInfo?.feedChannels?.let { feedChannels ->
val background = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.drawable.selector_rectangle_light else R.drawable.selector_rectangle_dark600
val dividerColor = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.color.onlight_04 else R.color.ondark_04
val channelKeyStyle = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.style.SendbirdSubtitle1OnLight01 else R.style.SendbirdSubtitle1OnDark01
val channelUrlStyle = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.style.SendbirdBody3OnLight03 else R.style.SendbirdBody3OnDark03
feedChannels.entries.forEach { entry ->
val itemBinding = ViewFeedChannelItemBinding.inflate(inflater)
itemBinding.root.setBackgroundResource(background)
itemBinding.divider.setBackgroundResource(dividerColor)
itemBinding.tvChannelKey.text = entry.key
itemBinding.tvChannelUrl.text = entry.value
itemBinding.tvChannelKey.setAppearance(requireContext(), channelKeyStyle)
itemBinding.tvChannelUrl.setAppearance(requireContext(), channelUrlStyle)
itemBinding.root.setOnClickListener {
startActivity(
FeedNotificationChannelActivity.newIntent(
requireContext(),
entry.value
)
)
}
binding.feedChannelContainer.addView(itemBinding.root)
}
}
return binding.root
}
}
Loading

0 comments on commit 797e0b1

Please sign in to comment.