Skip to content

Commit

Permalink
Added 3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rimdoo committed Mar 30, 2023
1 parent 4212539 commit ff55695
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
### v3.5.1 (Mar 30, 2023) with Chat SDK `v4.6.0`
* Extended the maximum recording time of voice message to 10 minutes.
* Notifications
* Fixed bug that the theme is not applying when the notifications are empty
* Improved stability

### v3.5.0 (Mar 14, 2023) with Chat SDK `v4.6.0`
We’re excited to announce the launch of Sendbird Notifications v1.0! It’s a powerful solutions that makes it easier for brands to send marketing, transactional, and operational messages to their users. We’ve introduced a new type of channel called the notification channel that’s specifically designed for these kinds of messages. Just a heads up, you’ll need to use notification channels with Sendbird Notifications, otherwise things might not work properly.
* Support Notification Channel
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ 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
id 'com.google.gms.google-services' version '4.3.15' 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.5.0
UIKIT_VERSION = 3.5.1
UIKIT_VERSION_CODE = 1
3 changes: 2 additions & 1 deletion uikit-custom-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ dependencies {
// implementation project(":uikit")
implementation "com.sendbird.sdk:uikit:$UIKIT_VERSION"

implementation platform('com.google.firebase:firebase-bom:31.3.0')
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.firebase:firebase-messaging:23.0.3'
implementation 'com.google.firebase:firebase-messaging'

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
Expand Down
3 changes: 2 additions & 1 deletion uikit-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ dependencies {
// implementation project(":uikit")
implementation "com.sendbird.sdk:uikit:$UIKIT_VERSION"

implementation platform('com.google.firebase:firebase-bom:31.3.0')
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.firebase:firebase-messaging:23.0.3'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.android.material:material:1.5.0'

implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c

// It shouldn't exist other than a function that is always called.
void onAuthenticateComplete(@NonNull ReadyStatus status, @NonNull MT module) {
if (!isFragmentAlive()) return;
onBeforeReady(status, module, viewModel);
onReady(status, module, viewModel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import com.sendbird.uikit.internal.ui.notifications.ChatNotificationChannelModule;
import com.sendbird.uikit.internal.ui.notifications.ChatNotificationHeaderComponent;
import com.sendbird.uikit.internal.ui.notifications.ChatNotificationListComponent;
import com.sendbird.uikit.internal.ui.notifications.NotificationStatusComponent;
import com.sendbird.uikit.log.Logger;
import com.sendbird.uikit.model.Action;
import com.sendbird.uikit.model.ReadyStatus;
import com.sendbird.uikit.modules.components.StatusComponent;
import com.sendbird.uikit.utils.IntentUtils;
import com.sendbird.uikit.utils.TextUtils;
import com.sendbird.uikit.vm.ChatNotificationChannelViewModel;
Expand Down Expand Up @@ -153,14 +153,14 @@ protected void onBindNotificationListComponent(@NonNull ChatNotificationListComp
}

/**
* Called to bind events to the StatusComponent. This is called from {@link #onBeforeReady(ReadyStatus, ChatNotificationChannelModule, ChatNotificationChannelViewModel)} regardless of the value of {@link ReadyStatus}.
* Called to bind events to the NotificationStatusComponent. This is called from {@link #onBeforeReady(ReadyStatus, ChatNotificationChannelModule, ChatNotificationChannelViewModel)} regardless of the value of {@link ReadyStatus}.
*
* @param statusComponent The component to which the event will be bound
* @param viewModel A view model that provides the data needed for the fragment
* @param channel The {@code GroupChannel} that contains the data needed for this fragment
* @since 3.5.0
*/
protected void onBindStatusComponent(@NonNull StatusComponent statusComponent, @NonNull ChatNotificationChannelViewModel viewModel, @Nullable GroupChannel channel) {
protected void onBindStatusComponent(@NonNull NotificationStatusComponent statusComponent, @NonNull ChatNotificationChannelViewModel viewModel, @Nullable GroupChannel channel) {
Logger.d(">> ChatNotificationChannelFragment::onBindStatusComponent()");
statusComponent.setOnActionButtonClickListener(v -> {
statusComponent.notifyStatusChanged(StatusFrameView.Status.LOADING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.sendbird.uikit.internal.ui.notifications.FeedNotificationChannelModule;
import com.sendbird.uikit.internal.ui.notifications.FeedNotificationHeaderComponent;
import com.sendbird.uikit.internal.ui.notifications.FeedNotificationListComponent;
import com.sendbird.uikit.internal.ui.notifications.NotificationStatusComponent;
import com.sendbird.uikit.log.Logger;
import com.sendbird.uikit.model.Action;
import com.sendbird.uikit.model.ReadyStatus;
Expand Down Expand Up @@ -150,14 +151,14 @@ protected void onBindNotificationListComponent(@NonNull FeedNotificationListComp
}

/**
* Called to bind events to the StatusComponent. This is called from {@link #onBeforeReady(ReadyStatus, FeedNotificationChannelModule, FeedNotificationChannelViewModel)} regardless of the value of {@link ReadyStatus}.
* Called to bind events to the NotificationStatusComponent. This is called from {@link #onBeforeReady(ReadyStatus, FeedNotificationChannelModule, FeedNotificationChannelViewModel)} regardless of the value of {@link ReadyStatus}.
*
* @param statusComponent The component to which the event will be bound
* @param viewModel A view model that provides the data needed for the fragment
* @param channel The {@code FeedChannel} that contains the data needed for this fragment
* @since 3.5.0
*/
protected void onBindStatusComponent(@NonNull StatusComponent statusComponent, @NonNull FeedNotificationChannelViewModel viewModel, @Nullable FeedChannel channel) {
protected void onBindStatusComponent(@NonNull NotificationStatusComponent statusComponent, @NonNull FeedNotificationChannelViewModel viewModel, @Nullable FeedChannel channel) {
Logger.d(">> FeedNotificationChannelFragment::onBindStatusComponent()");
statusComponent.setOnActionButtonClickListener(v -> {
statusComponent.notifyStatusChanged(StatusFrameView.Status.LOADING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ internal class VoiceRecorder(

interface OnProgressUpdateListener {
@UiThread
fun onProgressUpdated(status: Status, milliseconds: Int, amplitude: Int)
}

companion object {
const val maxDurationMillis = 60000
fun onProgressUpdated(status: Status, milliseconds: Int, maxDurationMillis: Int)
}

private val recorder: MediaRecorder
Expand All @@ -50,6 +46,8 @@ internal class VoiceRecorder(
private val progressExecutor by lazy { ClearableScheduledExecutorService() }
private val uiThreadHandler by lazy { Handler(Looper.getMainLooper()) }

private val maxDurationMillis = TimeUnit.MINUTES.toMillis(10).toInt()

init {
recorder = createRecorder(context)
recordFilePath = createRecordFilePath(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.sendbird.uikit.SendbirdUIKit.ThemeMode
import com.sendbird.uikit.interfaces.LoadingDialogHandler
import com.sendbird.uikit.internal.model.notifications.NotificationConfig
import com.sendbird.uikit.modules.BaseModule
import com.sendbird.uikit.modules.components.StatusComponent

/**
* A module for notification channel.
Expand Down Expand Up @@ -55,7 +54,7 @@ internal class ChatNotificationChannelModule @JvmOverloads constructor(
* @return The status component of this module
* @since 3.5.0
*/
var statusComponent: StatusComponent
var statusComponent: NotificationStatusComponent
private set

/**
Expand All @@ -78,7 +77,7 @@ internal class ChatNotificationChannelModule @JvmOverloads constructor(
params.setUseRightButton(false)
}
notificationListComponent = ChatNotificationListComponent(uiConfig = uiConfig)
statusComponent = StatusComponent()
statusComponent = NotificationStatusComponent(uiConfig)
}

override fun onCreateView(context: Context, inflater: LayoutInflater, args: Bundle?): View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.sendbird.uikit.SendbirdUIKit.ThemeMode
import com.sendbird.uikit.interfaces.LoadingDialogHandler
import com.sendbird.uikit.internal.model.notifications.NotificationConfig
import com.sendbird.uikit.modules.BaseModule
import com.sendbird.uikit.modules.components.StatusComponent

/**
* A module for notification channel.
Expand Down Expand Up @@ -55,7 +54,7 @@ internal class FeedNotificationChannelModule @JvmOverloads constructor(
* @return The status component of this module
* @since 3.5.0
*/
var statusComponent: StatusComponent
var statusComponent: NotificationStatusComponent
private set

/**
Expand All @@ -73,7 +72,7 @@ internal class FeedNotificationChannelModule @JvmOverloads constructor(
params.setUseLeftButton(false)
}
notificationListComponent = FeedNotificationListComponent(uiConfig = uiConfig)
statusComponent = StatusComponent()
statusComponent = NotificationStatusComponent(uiConfig)
}

override fun onCreateView(context: Context, inflater: LayoutInflater, args: Bundle?): View {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.sendbird.uikit.internal.ui.notifications

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.sendbird.uikit.internal.model.notifications.NotificationConfig
import com.sendbird.uikit.modules.components.StatusComponent

@JvmSuppressWildcards
internal class NotificationStatusComponent(
private val uiConfig: NotificationConfig? = null
) : StatusComponent() {

override fun onCreateView(context: Context, inflater: LayoutInflater, parent: ViewGroup, args: Bundle?): View {
val layout = super.onCreateView(context, inflater, parent, args)
uiConfig?.let {
val themeMode = it.themeMode
it.theme.listTheme.apply {
layout.setBackgroundColor(backgroundColor.getColor(themeMode))
}
}
return layout
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,17 @@ internal class VoiceMessageInputView @JvmOverloads constructor(
}
}
onRecorderProgressUpdateListener = object : VoiceRecorder.OnProgressUpdateListener {
override fun onProgressUpdated(status: VoiceRecorder.Status, milliseconds: Int, amplitude: Int) {
override fun onProgressUpdated(
status: VoiceRecorder.Status,
milliseconds: Int,
maxDurationMillis: Int
) {
if (status == VoiceRecorder.Status.COMPLETED) return
if (milliseconds >= 1000) {
binding.ibtnSend.isEnabled = true
}
ViewUtils.drawTimeline(binding.tvTimeline, milliseconds)
ViewUtils.drawVoicePlayerProgress(binding.progress, milliseconds, VoiceRecorder.maxDurationMillis)
ViewUtils.drawVoicePlayerProgress(binding.progress, milliseconds, maxDurationMillis)
}
}
recorder = VoiceRecorder(context, onRecorderUpdateListener, onRecorderProgressUpdateListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public synchronized BaseMessage deleteByMessageId(long msgId) {
for (BaseMessage message : messages) {
if (message.getMessageId() == msgId) {
removedMessage = message;
messages.remove(message);
delete(message);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void onMessageReceived(@NonNull BaseChannel baseChannel, @NonNull BaseMes
if (messageListParams == null || !messageListParams.belongsTo(baseMessage)) return;

if (isCurrentChannel(baseChannel.getUrl())) {
Logger.i(">> ChannelFragnemt::onMessageReceived(%s)", baseMessage.getMessageId());
Logger.i(">> OpenChannelViewModel::onMessageReceived(%s)", baseMessage.getMessageId());
messageCollection.add(baseMessage);
notifyDataSetChanged();
}
Expand Down Expand Up @@ -777,11 +777,6 @@ public void deleteMessage(@NonNull BaseMessage message, @Nullable OnCompleteHand
if (handler != null) handler.onComplete(e);
return;
}

Logger.i("++ deleted message : %s", message);
messageDeleted.postValue(message.getMessageId());
messageCollection.delete(message);
notifyDataSetChanged();
});
} else {
PendingMessageRepository.getInstance().removePendingMessage(message.getChannelUrl(), message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ class StatusFrameView @JvmOverloads constructor(
binding.actionPanel.setOnClickListener(listener)
}

override fun setBackgroundColor(color: Int) {
binding.frameParentPanel.setBackgroundColor(color)
}

override fun setBackground(drawable: Drawable) {
binding.frameParentPanel.background = drawable
}

private fun setAlert(text: String?, icon: Drawable?, iconTint: ColorStateList?) {
this.visibility = VISIBLE
binding.ivAlertIcon.setImageDrawable(DrawableUtils.setTintList(icon, iconTint))
Expand Down

0 comments on commit ff55695

Please sign in to comment.