Skip to content

Commit

Permalink
Merge pull request #12 from sendbird/release/leo/v3.8.0
Browse files Browse the repository at this point in the history
updated v3.8.0
  • Loading branch information
leo-shin authored Sep 4, 2023
2 parents f866b70 + 15ea7bb commit 80e9739
Show file tree
Hide file tree
Showing 49 changed files with 653 additions and 257 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog

### v3.8.0 (Sep 4 2023) with Chat SDK `v4.12.0`
* Support category filtering in feed notification channel. Categories by which messages can be filtered can be created and edited in the dashboard.
* Added `startChatWithAiBot(Context, String, Boolean, CompletionHandler)` that initiates a group channel with AI Bot which is created in Sendbird dashboard and launches `ChannelActivity`. `SendbirdUIKit.init()` and `SendbirdUIKit.connect()` must precede.

### v3.7.0 (Jul 17 2023) with Chat SDK `v4.11.0`
* Change the default authentication method for FeedChannel from WebSocket connection to API.
* Added `authenticatedFeed(AuthenticationHandler)` in `SendbirdUIKit`
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.7.0
UIKIT_VERSION = 3.8.0
UIKIT_VERSION_CODE = 1
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class HomeActivity : AppCompatActivity() {
binding.groupChannelButton.setOnClickListener { clickGroupChannel() }
binding.openChannelButton.setOnClickListener { clickOpenChannel() }
binding.customSampleButton.setOnClickListener { moveToCustomSample() }
binding.aiBotButton.setOnClickListener { clickAiBot() }
binding.btSignOut.setOnClickListener { signOut() }
TextViewCompat.setTextAppearance(binding.tvUnreadCount, R.style.SendbirdCaption3OnDark01)
binding.tvUnreadCount.setBackgroundResource(R.drawable.shape_badge_background)
TextViewCompat.setTextAppearance(binding.tvGroupChannelUnreadCount, R.style.SendbirdCaption3OnDark01)
binding.tvGroupChannelUnreadCount.setBackgroundResource(R.drawable.shape_badge_background)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
val permission = Manifest.permission.POST_NOTIFICATIONS
if (ContextCompat.checkSelfPermission(this, permission) == PermissionChecker.PERMISSION_GRANTED) {
Expand All @@ -86,11 +87,11 @@ class HomeActivity : AppCompatActivity() {
return@UnreadMessageCountHandler
}
if (totalCount > 0) {
binding.tvUnreadCount.visibility = View.VISIBLE
binding.tvUnreadCount.text =
binding.tvGroupChannelUnreadCount.visibility = View.VISIBLE
binding.tvGroupChannelUnreadCount.text =
if (totalCount > 99) getString(R.string.text_tab_badge_max_count) else totalCount.toString()
} else {
binding.tvUnreadCount.visibility = View.GONE
binding.tvGroupChannelUnreadCount.visibility = View.GONE
}
})
// register total unread count event
Expand All @@ -99,11 +100,11 @@ class HomeActivity : AppCompatActivity() {
override fun onTotalUnreadMessageCountChanged(unreadMessageCount: UnreadMessageCount) {
val totalCount = unreadMessageCount.groupChannelCount
if (totalCount > 0) {
binding.tvUnreadCount.visibility = View.VISIBLE
binding.tvUnreadCount.text =
binding.tvGroupChannelUnreadCount.visibility = View.VISIBLE
binding.tvGroupChannelUnreadCount.text =
if (totalCount > 99) getString(R.string.text_tab_badge_max_count) else totalCount.toString()
} else {
binding.tvUnreadCount.visibility = View.GONE
binding.tvGroupChannelUnreadCount.visibility = View.GONE
}
}
})
Expand All @@ -130,6 +131,15 @@ class HomeActivity : AppCompatActivity() {
startActivity(browserIntent)
}

private fun clickAiBot() {
val botId = "client_bot_____"
SendbirdUIKit.startChatWithAiBot(this, botId, true) { e ->
if (e != null) {
ContextUtils.toastError(this, "Failed to start chat with ai bot. ${e.message}")
}
}
}

private fun signOut() {
WaitingDialog.show(this)
PushUtils.unregisterPushHandler(object : PushRequestCompleteHandler {
Expand Down
142 changes: 106 additions & 36 deletions uikit-sample/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,24 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/groupChannelButton"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginTop="-10dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/sb_size_8"
android:layout_marginRight="@dimen/sb_size_8"
android:background="@drawable/selector_home_channel_type_button">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/groupChannelButtonGuildLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />

<TextView
android:id="@+id/tvGroupChannelTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sb_size_24"
android:layout_marginLeft="@dimen/sb_size_24"
android:layout_marginRight="@dimen/sb_size_24"
android:text="@string/text_group_channel"
android:textSize="@dimen/sb_text_size_20"
android:fontFamily="sans-serif"
Expand All @@ -59,10 +64,10 @@
android:lineSpacingExtra="@dimen/sb_text_size_4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
app:layout_constraintBottom_toTopOf="@id/groupChannelButtonGuildLine" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvUnreadCount"
android:id="@+id/tvGroupChannelUnreadCount"
android:layout_gravity="center_horizontal"
android:translationX="@dimen/sb_size_4"
android:layout_width="wrap_content"
Expand All @@ -72,60 +77,64 @@
android:paddingLeft="@dimen/sb_size_6"
android:paddingRight="@dimen/sb_size_6"
android:includeFontPadding="false"
android:visibility="gone"
app:layout_constraintTop_toTopOf="@id/tvGroupChannelTitle"
app:layout_constraintBottom_toBottomOf="@id/tvGroupChannelTitle"
app:layout_constraintStart_toEndOf="@id/tvGroupChannelTitle"/>
android:visibility="visible"
android:layout_marginEnd="@dimen/sb_size_4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivGroupChannelChevronRight"/>

<TextView
android:id="@+id/tvGroupChannelDesc"
android:layout_width="@dimen/sb_size_0"
android:layout_height="@dimen/sb_size_0"
android:layout_marginTop="@dimen/sb_size_8"
android:layout_marginLeft="@dimen/sb_size_24"
android:layout_marginRight="@dimen/sb_size_24"
android:layout_marginStart="@dimen/sb_size_24"
android:layout_marginBottom="@dimen/sb_size_24"
android:textSize="@dimen/sb_text_size_14"
android:fontFamily="sans-serif-medium"
android:textStyle="normal"
android:textColor="@color/onlight_02"
android:letterSpacing="-0.01"
android:lineSpacingExtra="@dimen/sb_text_size_2"
android:text="@string/text_group_channel_description"
app:layout_constraintTop_toBottomOf="@id/tvGroupChannelTitle"
app:layout_constraintTop_toBottomOf="@id/groupChannelButtonGuildLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivGroupChannelImage"
app:layout_constraintStart_toStartOf="parent"
/>
app:layout_constraintEnd_toStartOf="@id/tvGroupChannelUnreadCount"/>

<ImageView
android:id="@+id/ivGroupChannelImage"
android:layout_width="@dimen/sb_size_78"
android:layout_height="@dimen/sb_size_56"
android:layout_marginEnd="@dimen/sb_size_24"
android:layout_marginRight="@dimen/sb_size_24"
android:layout_marginBottom="@dimen/sb_size_24"
android:src="@drawable/img_groupchannel"
app:layout_constraintStart_toEndOf="@id/tvGroupChannelDesc"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivGroupChannelChevronRight"
android:layout_width="@dimen/sb_size_20"
android:layout_height="@dimen/sb_size_20"
android:src="@drawable/icon_chevron_right"
android:layout_marginEnd="@dimen/sb_size_16"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/openChannelButton"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_height="wrap_content"
android:layout_marginTop="-12dp"
android:layout_marginLeft="@dimen/sb_size_8"
android:layout_marginRight="@dimen/sb_size_8"
android:background="@drawable/selector_home_channel_type_button">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/openChannelButtonGuildLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />

<TextView
android:id="@+id/tvOpenChannelTitle"
android:layout_width="@dimen/sb_size_0"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sb_size_24"
android:layout_marginLeft="@dimen/sb_size_24"
android:layout_marginRight="@dimen/sb_size_24"
android:text="@string/text_open_channel"
android:textSize="@dimen/sb_text_size_20"
android:fontFamily="sans-serif"
Expand All @@ -134,7 +143,7 @@
android:lineSpacingExtra="@dimen/sb_text_size_4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/openChannelButtonGuildLine"
/>

<TextView
Expand All @@ -151,21 +160,82 @@
android:letterSpacing="-0.01"
android:lineSpacingExtra="@dimen/sb_text_size_2"
android:text="@string/text_open_channel_description"
app:layout_constraintTop_toBottomOf="@id/tvOpenChannelTitle"
app:layout_constraintTop_toBottomOf="@id/openChannelButtonGuildLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivOpenChannelImage"
app:layout_constraintEnd_toStartOf="@id/ivOpenChannelChevronRight"
app:layout_constraintStart_toStartOf="parent"
/>

<ImageView
android:id="@+id/ivOpenChannelImage"
android:layout_width="@dimen/sb_size_78"
android:layout_height="@dimen/sb_size_56"
android:layout_marginEnd="@dimen/sb_size_24"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivOpenChannelChevronRight"
android:layout_width="@dimen/sb_size_20"
android:layout_height="@dimen/sb_size_20"
android:src="@drawable/icon_chevron_right"
android:layout_marginEnd="@dimen/sb_size_16"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/aiBotButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-12dp"
android:layout_marginLeft="@dimen/sb_size_8"
android:layout_marginRight="@dimen/sb_size_8"
android:background="@drawable/selector_home_channel_type_button">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/aiBotButtonGuildLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />

<TextView
android:id="@+id/tvAiBotTitle"
android:layout_width="@dimen/sb_size_0"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sb_size_24"
android:layout_marginLeft="@dimen/sb_size_24"
android:text="@string/text_ai_chatbot"
android:textSize="@dimen/sb_text_size_20"
android:fontFamily="sans-serif"
android:textStyle="bold"
android:textColor="@color/onlight_01"
android:lineSpacingExtra="@dimen/sb_text_size_4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/aiBotButtonGuildLine"
/>

<TextView
android:id="@+id/tvAiBotDesc"
android:layout_width="@dimen/sb_size_0"
android:layout_height="@dimen/sb_size_0"
android:layout_marginTop="@dimen/sb_size_8"
android:layout_marginLeft="@dimen/sb_size_24"
android:layout_marginRight="@dimen/sb_size_24"
android:layout_marginBottom="@dimen/sb_size_24"
android:src="@drawable/img_openchannel"
app:layout_constraintStart_toEndOf="@id/tvOpenChannelDesc"
android:textSize="@dimen/sb_text_size_14"
android:fontFamily="sans-serif-medium"
android:textStyle="normal"
android:textColor="@color/onlight_02"
android:letterSpacing="-0.01"
android:lineSpacingExtra="@dimen/sb_text_size_2"
android:text="@string/text_ai_chatbot_description"
app:layout_constraintTop_toBottomOf="@id/aiBotButtonGuildLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivAiBotChevronRight"/>

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivAiBotChevronRight"
android:layout_width="@dimen/sb_size_20"
android:layout_height="@dimen/sb_size_20"
android:src="@drawable/icon_chevron_right"
android:layout_marginEnd="@dimen/sb_size_16"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
2 changes: 2 additions & 0 deletions uikit-sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
<string name="text_home">Home</string>
<string name="text_group_channel">Group channel</string>
<string name="text_open_channel">Open channel</string>
<string name="text_ai_chatbot">Talk to an AI Chatbot</string>
<string name="text_custom_sample">Custom sample</string>
<string name="text_group_channel_description">1 on 1, Group chat with members</string>
<string name="text_open_channel_description">Live streams, Open community chat</string>
<string name="text_ai_chatbot_description">1 on 1, Group chat with bots</string>
<string name="text_create_community">Create community</string>
<string name="text_live_streams">Live streams</string>
<string name="text_community">Community</string>
Expand Down
2 changes: 1 addition & 1 deletion uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// Sendbird
api 'com.sendbird.sdk:sendbird-chat:4.11.0'
api 'com.sendbird.sdk:sendbird-chat:4.12.0'

implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
Expand Down
Loading

0 comments on commit 80e9739

Please sign in to comment.