Skip to content

Commit

Permalink
Merge pull request #39 from sendbird/release/3.19.0
Browse files Browse the repository at this point in the history
3.19.0
  • Loading branch information
sendbird-sdk-deployment authored Aug 1, 2024
2 parents d7deb36 + 7b261b0 commit a688bff
Show file tree
Hide file tree
Showing 233 changed files with 1,086 additions and 755 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog
### v3.18.0 (Jun 20, 2024) with Chat SDK `v4.16.4`
### v3.19.0 (Aug 1, 2024) with Chat SDK `v4.17.0`
* Deprecated `authenticateFeed(AuthenticationHandler)` in `SendbirdUIKit`, which is replaced by `authenticate(AuthenticationHandler)`.
* Fixed the crash issue caused by the `bindingAdapterPosition` in the RecyclerView not being returned correctly.
* Support Right-to-Left (RTL) languages.### v3.18.0 (Jun 20, 2024) with Chat SDK `v4.16.4`
* Updated dependencies
* update compileSdkVersion to 34
* [Gradle Plugin] Gradle 8.6
Expand Down
8 changes: 7 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.7.20'
ext.paparazzi_version = '1.3.1'

dependencies {
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// It will force the kotlin compiler version to be changed to a higher one, so it should only include the plugin in real tests.
if (project.hasProperty('withSnapshotTest')) {
classpath "app.cash.paparazzi:paparazzi-gradle-plugin:$paparazzi_version"
}
}
}
plugins {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand All @@ -22,5 +22,5 @@ android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.enableR8.fullMode=false

UIKIT_VERSION = 3.18.0
UIKIT_VERSION = 3.19.0
UIKIT_VERSION_CODE = 1
3 changes: 1 addition & 2 deletions uikit-samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ android {
}

dependencies {
// implementation project(":uikit")
implementation "com.sendbird.sdk:uikit:$UIKIT_VERSION"
implementation "com.sendbird.sdk:uikit:$UIKIT_VERSION"

implementation(platform("com.google.firebase:firebase-bom:32.2.3"))
implementation "androidx.multidex:multidex:2.0.1"
Expand Down
6 changes: 4 additions & 2 deletions uikit-samples/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="false"
android:supportsRtl="true"
android:resizeableActivity="false"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
Expand All @@ -29,7 +29,9 @@
<!-- common activities -->
<activity
android:name=".common.SelectServiceActivity"
android:launchMode="singleTask" />
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize|stateHidden"/>
<activity
android:name=".common.LoginActivity"
android:launchMode="singleTop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,15 @@ import com.sendbird.uikit.samples.common.fcm.MyFirebaseMessagingService
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils

private const val APP_ID = "FEA2129A-EA73-4EB9-9E0B-EC738E7EB768"
internal const val enableAiChatBotSample = false
internal const val enableNotificationSample = false
internal const val enableAiChatBotSample = true
internal const val enableNotificationSample = true

class BaseApplication : MultiDexApplication() {
companion object {
internal val initState = MutableLiveData(InitState.NONE)

/**
* Returns the state of the result from initialization of Sendbird UIKit.
*
* @return the [InitState] instance
*/
fun initStateChanges(): LiveData<InitState> {
return initState
}

private fun initUIKit(context: Context) {
SendbirdUIKit.init(object : SendbirdUIKitAdapter {
internal val adapter by lazy {
object : SendbirdUIKitAdapter {
override fun getAppId(): String = PreferenceUtils.appId.ifEmpty { APP_ID }

override fun getAccessToken(): String? = null
Expand All @@ -64,12 +55,25 @@ class BaseApplication : MultiDexApplication() {
initState.value = InitState.SUCCEED
}
}
}, context)
}
}

/**
* Returns the state of the result from initialization of Sendbird UIKit.
*
* @return the [InitState] instance
*/
fun initStateChanges(): LiveData<InitState> {
return initState
}

private fun initUIKit(context: Context) {
SendbirdUIKit.init(adapter, context)

// set theme mode
SendbirdUIKit.setDefaultThemeMode(PreferenceUtils.themeMode)
// register push notification
SendbirdPushHelper.registerPushHandler(MyFirebaseMessagingService())
SendbirdPushHelper.registerHandler(MyFirebaseMessagingService())
// set logger
SendbirdUIKit.setLogLevel(SendbirdUIKit.LogLevel.ALL)
}
Expand Down Expand Up @@ -98,6 +102,7 @@ class BaseApplication : MultiDexApplication() {
UIKitConfig.groupChannelConfig.typingIndicatorTypes = setOf(TypingIndicatorType.BUBBLE, TypingIndicatorType.TEXT)
// set whether to use feedback
UIKitConfig.groupChannelConfig.enableFeedback = true

// set custom params
SendbirdUIKit.setCustomParamsHandler(object : CustomParamsHandler {
override fun onBeforeCreateOpenChannel(params: OpenChannelCreateParams) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ 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" })
}
}
Expand All @@ -43,7 +41,7 @@ class AiChatBotLoginActivity : LoginActivity() {
}
PreferenceUtils.userId = userId
PreferenceUtils.nickname = nickname
SendbirdPushHelper.registerPushHandler(MyFirebaseMessagingService())
SendbirdPushHelper.registerHandler(MyFirebaseMessagingService())
val intent = PreferenceUtils.selectedSampleType.startingIntent(this)
startActivity(intent)
finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class BasicHomeActivity : ThemeHomeActivity() {
// initialize total unread count
SendbirdChat.getTotalUnreadMessageCount(
GroupChannelTotalUnreadMessageCountParams(),
UnreadMessageCountHandler { totalCount: Int, _: Int, e: SendbirdException? ->
UnreadMessageCountHandler { groupChannelCount: Int, _: Int, e: SendbirdException? ->
if (e != null) {
return@UnreadMessageCountHandler
}
if (totalCount > 0) {
if (groupChannelCount > 0) {
binding.groupChannelButton.unreadCountVisibility = View.VISIBLE
binding.groupChannelButton.unreadCount =
if (totalCount > 99) getString(R.string.text_tab_badge_max_count) else totalCount.toString()
if (groupChannelCount > 99) getString(R.string.text_tab_badge_max_count) else groupChannelCount.toString()
} else {
binding.groupChannelButton.unreadCountVisibility = View.GONE
}
Expand All @@ -94,11 +94,11 @@ class BasicHomeActivity : ThemeHomeActivity() {
SendbirdChat.addUserEventHandler(USER_EVENT_HANDLER_KEY, object : UserEventHandler() {
override fun onFriendsDiscovered(users: List<User>) {}
override fun onTotalUnreadMessageCountChanged(unreadMessageCount: UnreadMessageCount) {
val totalCount = unreadMessageCount.groupChannelCount
if (totalCount > 0) {
val groupChannelCount = unreadMessageCount.groupChannelCount
if (groupChannelCount > 0) {
binding.groupChannelButton.unreadCountVisibility = View.VISIBLE
binding.groupChannelButton.unreadCount =
if (totalCount > 99) getString(R.string.text_tab_badge_max_count) else totalCount.toString()
if (groupChannelCount > 99) getString(R.string.text_tab_badge_max_count) else groupChannelCount.toString()
} else {
binding.groupChannelButton.unreadCountVisibility = View.GONE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ class GroupChannelMainActivity : AppCompatActivity() {
super.onResume()
SendbirdChat.getTotalUnreadMessageCount(
GroupChannelTotalUnreadMessageCountParams(),
UnreadMessageCountHandler { totalCount: Int, _: Int, e: SendbirdException? ->
UnreadMessageCountHandler { groupChannelCount: Int, _: Int, e: SendbirdException? ->
if (e != null) {
return@UnreadMessageCountHandler
}
if (totalCount > 0) {
if (groupChannelCount > 0) {
unreadCountTab.setBadgeVisibility(View.VISIBLE)
unreadCountTab.setBadgeCount(if (totalCount > 99) getString(R.string.text_tab_badge_max_count) else totalCount.toString())
unreadCountTab.setBadgeCount(if (groupChannelCount > 99) getString(R.string.text_tab_badge_max_count) else groupChannelCount.toString())
} else {
unreadCountTab.setBadgeVisibility(View.GONE)
}
})
SendbirdChat.addUserEventHandler(USER_EVENT_HANDLER_KEY, object : UserEventHandler() {
override fun onFriendsDiscovered(users: List<User>) {}
override fun onTotalUnreadMessageCountChanged(unreadMessageCount: UnreadMessageCount) {
val totalCount = unreadMessageCount.groupChannelCount
if (totalCount > 0) {
val groupChannelCount = unreadMessageCount.groupChannelCount
if (groupChannelCount > 0) {
unreadCountTab.setBadgeVisibility(View.VISIBLE)
unreadCountTab.setBadgeCount(if (totalCount > 99) getString(R.string.text_tab_badge_max_count) else totalCount.toString())
unreadCountTab.setBadgeCount(if (groupChannelCount > 99) getString(R.string.text_tab_badge_max_count) else groupChannelCount.toString())
} else {
unreadCountTab.setBadgeVisibility(View.GONE)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.sendbird.uikit.samples.common

import android.content.Intent
import android.os.Bundle
import android.os.Process
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.sendbird.android.SendbirdChat.sdkVersion
import com.sendbird.android.exception.SendbirdException
Expand All @@ -12,9 +10,11 @@ import com.sendbird.android.user.User
import com.sendbird.uikit.SendbirdUIKit
import com.sendbird.uikit.log.Logger
import com.sendbird.uikit.samples.R
import com.sendbird.uikit.samples.common.extensions.apiHost
import com.sendbird.uikit.samples.common.extensions.authenticate
import com.sendbird.uikit.samples.common.extensions.getLogoDrawable
import com.sendbird.uikit.samples.common.extensions.startingIntent
import com.sendbird.uikit.samples.common.extensions.wsHost
import com.sendbird.uikit.samples.common.fcm.MyFirebaseMessagingService
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils
import com.sendbird.uikit.samples.common.widgets.WaitingDialog
Expand All @@ -30,30 +30,17 @@ open class LoginActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
binding.apply {
val context = this@LoginActivity
applicationId.visibility = View.VISIBLE
saveButton.visibility = View.VISIBLE
userId.setSelectAllOnFocus(true)
nickname.setSelectAllOnFocus(true)
versionInfo.text = String.format(
resources.getString(R.string.text_version_info),
com.sendbird.uikit.BuildConfig.VERSION_NAME,
sdkVersion
)
SendbirdUIKit.getAdapter()?.appId?.let { applicationId.setText(it) }

val sampleType = PreferenceUtils.selectedSampleType
logoImageView.background = sampleType.getLogoDrawable(context)
title.text = "${sampleType?.name} Sample"
saveButton.setOnClickListener {
val appId = applicationId.text
if (!appId.isNullOrEmpty()) {
PreferenceUtils.appId = appId.toString()
saveButton.postDelayed({
finish()
Process.killProcess(Process.myPid())
}, 500)
}
}
signInButton.setOnClickListener {
// Remove all spaces from userID
val userId = binding.userId.text.toString().replace("\\s".toRegex(), "")
Expand All @@ -63,10 +50,15 @@ open class LoginActivity : AppCompatActivity() {
}
PreferenceUtils.userId = userId
PreferenceUtils.nickname = nickname
// set region
val region = PreferenceUtils.region
SendbirdUIKit.setCustomHosts(
region.apiHost(),
region.wsHost()
)
onSignUp(userId, nickname)
}
selectSampleLayout.setOnClickListener {
PreferenceUtils.clearAll()
startActivity(Intent(context, SelectServiceActivity::class.java))
finish()
}
Expand All @@ -80,14 +72,16 @@ open class LoginActivity : AppCompatActivity() {
authenticate { _: User?, e: SendbirdException? ->
if (e != null) {
Logger.e(e)
PreferenceUtils.userId = ""
PreferenceUtils.nickname = ""
ContextUtils.toastError(this@LoginActivity, "${e.message}")
WaitingDialog.dismiss()
return@authenticate
}
WaitingDialog.dismiss()
PreferenceUtils.userId = userId
PreferenceUtils.nickname = nickname
SendbirdPushHelper.registerPushHandler(MyFirebaseMessagingService())
SendbirdPushHelper.registerHandler(MyFirebaseMessagingService())
val intent = PreferenceUtils.selectedSampleType.startingIntent(this)
startActivity(intent)
finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ import com.sendbird.uikit.utils.FileUtils
import com.sendbird.uikit.utils.IntentUtils
import com.sendbird.uikit.utils.PermissionUtils
import com.sendbird.uikit.utils.TextUtils
import java.io.File
import java.util.Locale
import java.util.TimeZone
import java.io.File

/**
* Displays a settings screen.
Expand Down
Loading

0 comments on commit a688bff

Please sign in to comment.