From ec21198bcb09fb4bdac283b9ee891760f567cf66 Mon Sep 17 00:00:00 2001 From: Tyler Jeong Date: Wed, 20 Nov 2024 11:36:49 +0900 Subject: [PATCH] Add 4.2.29. --- CHANGELOG.md | 8 ++++++ README.md | 2 +- .../message/meta/c_channel_message.dart | 27 ++++++++++++++++--- lib/src/internal/main/chat/chat.dart | 2 +- .../base_message_collection.dart | 25 ++++++++++++++--- pubspec.yaml | 8 +++--- 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0850651..e499374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## v4.2.29 (Nov 20, 2024) + +### Features +- Updated the versions for `mime`, `web_socket_channel` and `flutter_lints` packages + +### Improvements +- Added the filtering for `replyType` in `MessageCollection` + ## v4.2.28 (Nov 15, 2024) ### Improvements diff --git a/README.md b/README.md index bc91e02..0d5d78e 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Before installing Sendbird Chat SDK, you need to create a Sendbird application o ```yaml dependencies: - sendbird_chat_sdk: ^4.2.28 + sendbird_chat_sdk: ^4.2.29 ``` - Run `flutter pub get` command in your project directory. diff --git a/lib/src/internal/db/schema/message/meta/c_channel_message.dart b/lib/src/internal/db/schema/message/meta/c_channel_message.dart index 83f2958..42eb3e3 100644 --- a/lib/src/internal/db/schema/message/meta/c_channel_message.dart +++ b/lib/src/internal/db/schema/message/meta/c_channel_message.dart @@ -160,9 +160,6 @@ class CChannelMessage { // [includeParentMessageInfo] // When calling API, this value have to be `true` to make chunk. - // [replyType] - // Must call API, because this can not be queried with local cache. - // [showSubChannelMessagesOnly] // Must call API, because this can not be queried with local cache. @@ -259,6 +256,30 @@ class CChannelMessage { } } + //+ replyType + messages.removeWhere((message) { + if (message is BaseMessage) { + switch (params.replyType) { + case ReplyType.none: + if (message.parentMessageId != null) { + return true; // Remove + } + break; + case ReplyType.all: + break; + case ReplyType.onlyReplyToChannel: + if (message.parentMessageId != null && !message.isReplyToChannel) { + return true; // Remove + } + break; + case null: + break; + } + } + return false; // Do not remove + }); + //- replyType + // reversed if (messages.length >= 2) { if ((isPrevious && !params.reverse) || (!isPrevious && params.reverse)) { diff --git a/lib/src/internal/main/chat/chat.dart b/lib/src/internal/main/chat/chat.dart index 8bd4048..d255cc2 100644 --- a/lib/src/internal/main/chat/chat.dart +++ b/lib/src/internal/main/chat/chat.dart @@ -62,7 +62,7 @@ part 'chat_notifications.dart'; part 'chat_push.dart'; part 'chat_user.dart'; -const sdkVersion = '4.2.28'; +const sdkVersion = '4.2.29'; // Internal implementation for main class. Do not directly access this class. class Chat with WidgetsBindingObserver { diff --git a/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart b/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart index dfb1a34..e781420 100644 --- a/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart +++ b/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart @@ -885,9 +885,7 @@ abstract class BaseMessageCollection { } // [Filter] senderIds - if (addedMessage is BaseMessage && - params.senderIds != null && - params.customTypes!.isNotEmpty) { + if (addedMessage is BaseMessage && params.senderIds != null) { bool found = false; for (final senderId in params.senderIds!) { if (addedMessage.sender?.userId == senderId) { @@ -901,6 +899,27 @@ abstract class BaseMessageCollection { } } + // [Filter] replyType + if (addedMessage is BaseMessage) { + switch (params.replyType) { + case ReplyType.none: + if (addedMessage.parentMessageId != null) { + return false; + } + break; + case ReplyType.all: + break; + case ReplyType.onlyReplyToChannel: + if (addedMessage.parentMessageId != null && + !addedMessage.isReplyToChannel) { + return false; + } + break; + case null: + break; + } + } + return true; } diff --git a/pubspec.yaml b/pubspec.yaml index 86c7526..b420a23 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: sendbird_chat_sdk description: With Sendbird Chat for Flutter, you can easily build an in-app chat with all the essential messaging features. -version: 4.2.28 +version: 4.2.29 homepage: https://sendbird.com repository: https://github.com/sendbird/sendbird-chat-sdk-flutter documentation: https://sendbird.com/docs/chat/sdk/v4/flutter/getting-started/send-first-message @@ -24,10 +24,10 @@ dependencies: shared_preferences: ^2.2.2 http: '>=0.13.6 <2.0.0' logger: '>=1.4.0 <3.0.0' - mime: ^1.0.4 + mime: '>=1.0.4 <3.0.0' connectivity_plus: '>=5.0.1 <7.0.0' http_parser: ^4.0.2 - web_socket_channel: ^2.4.0 + web_socket_channel: '>=2.4.0 <4.0.0' universal_io: ^2.2.0 async: ^2.10.0 isar: ^3.1.0+1 @@ -38,7 +38,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.1 + flutter_lints: '>=2.0.1 <6.0.0' test: ^1.22.0 stack_trace: ^1.11.0 json_serializable: ^6.6.2