Skip to content

Commit 0b619e5

Browse files
Add 4.1.2.
1 parent 534fc28 commit 0b619e5

File tree

16 files changed

+262
-168
lines changed

16 files changed

+262
-168
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## v4.1.2 (Dec 12, 2023)
2+
3+
### Features
4+
- Added `createdBefore` and `createdAfter` in `GroupChannelListQuery` and `PublicGroupChannelListQuery`
5+
- Added `markAsClicked()` in `FeedChannel`
6+
- Replaced `markAsReadBy()` with `markAsRead()` in `FeedChannel`
7+
8+
### Improvements
9+
- Fix the bugs regarding FeedChannel
10+
- Fix the bugs regarding ReactionEvent
11+
- Improved stability
12+
113
## v4.1.1 (Nov 8, 2023)
214

315
### Improvements

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Before installing Sendbird Chat SDK, you need to create a Sendbird application o
4848

4949
```yaml
5050
dependencies:
51-
sendbird_chat_sdk: ^4.1.1
51+
sendbird_chat_sdk: ^4.1.2
5252
```
5353
5454
- Run `flutter pub get` command in your project directory.

lib/sendbird_chat_sdk.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export 'src/public/main/handler/session_handler.dart';
4343
export 'src/public/main/handler/user_event_handler.dart';
4444
export 'src/public/main/model/channel/feed_channel_change_logs.dart';
4545
export 'src/public/main/model/channel/group_channel_change_logs.dart';
46-
export 'src/public/main/model/channel/group_channel_filter.dart';
4746
export 'src/public/main/model/channel/group_channel_unread_item_count.dart';
4847
export 'src/public/main/model/channel/notification_category.dart';
4948
export 'src/public/main/model/chat/do_not_disturb.dart';

lib/src/internal/main/chat/chat.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ part 'chat_notifications.dart';
5858
part 'chat_push.dart';
5959
part 'chat_user.dart';
6060

61-
const sdkVersion = '4.1.1';
61+
const sdkVersion = '4.1.2';
6262

6363
// Internal implementation for main class. Do not directly access this class.
6464
class Chat with WidgetsBindingObserver {
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Copyright (c) 2023 Sendbird, Inc. All rights reserved.
2+
3+
import 'package:json_annotation/json_annotation.dart';
4+
import 'package:sendbird_chat_sdk/sendbird_chat_sdk.dart';
5+
import 'package:sendbird_chat_sdk/src/internal/main/utils/enum_utils.dart';
6+
7+
part 'group_channel_filter.g.dart';
8+
9+
// The GroupChannelFilter class for [GroupChannelListQuery] and [PublicGroupChannelListQuery].
10+
@JsonSerializable()
11+
class GroupChannelFilter {
12+
// Sets the member state filter.
13+
@JsonKey(toJson: memberStateFilterEnumForQuery)
14+
MyMemberStateFilter memberStateFilter = MyMemberStateFilter.all;
15+
16+
// Sets to filter super channel. Default is `all`.
17+
@JsonKey(toJson: groupChannelSuperFilterEnum)
18+
SuperChannelFilter superMode = SuperChannelFilter.all;
19+
20+
// Sets to filter public channel. Default is `all`.
21+
PublicChannelFilter publicMode = PublicChannelFilter.all;
22+
23+
// Sets to filter channels by custom type that starts with.
24+
@JsonKey(name: 'custom_type_startswith')
25+
String? customTypeStartsWith;
26+
27+
// Sets the custom type filter.
28+
List<String>? customTypes;
29+
30+
// Sets the filter with nickname.
31+
// Query result will contains channels that any one of member contains given nickname.
32+
String? membersNicknameContains;
33+
34+
// Sets the filter with user IDs that query result will return
35+
// if any one of user id matches with channel's members.
36+
@JsonKey(includeFromJson: false, includeToJson: false)
37+
List<String>? membersIncludeIn;
38+
39+
// Sets the filter with user IDs that query result will return
40+
// only if channel's members are exactly matched with this property.
41+
List<String>? membersExactlyIn;
42+
43+
// Sets a filter to return only channels that contains the
44+
// specified group channel name.
45+
String? nameContains;
46+
47+
// Sets to filter channels by the unread messages.
48+
// The default value is `all`.
49+
UnreadChannelFilter unreadFilter = UnreadChannelFilter.all;
50+
51+
// Sets a key for ordering by value in the metadata.
52+
// This is valid when the `order` is `channelMetaDataValueAlphabetical` only.
53+
@JsonKey(includeFromJson: false, includeToJson: false)
54+
String? metadataOrderKey;
55+
56+
// Sets to filter channels by the hidden state.
57+
// The default value is `unhidden`.
58+
HiddenChannelFilter hiddenMode = HiddenChannelFilter.unhidden;
59+
60+
// Sets to filter channels by the membership filter.
61+
// The default value is `all`.
62+
@JsonKey(name: 'public_membership_mode')
63+
MembershipFilter publicMembershipFilter = MembershipFilter.all;
64+
65+
// Searches for group channels with metadata containing an item with the
66+
// specified key.
67+
@JsonKey(name: 'metadata_key')
68+
String? metaDataKey;
69+
70+
// Searches for group channels with metadata containing an item with the
71+
// specified values.
72+
@JsonKey(name: 'metadata_values')
73+
List<String>? metaDataValues;
74+
75+
// Searches for group channels with metadata containing an item with the
76+
// key specified by the metaDataKey and the values of that item start with
77+
// the specified value.
78+
@JsonKey(name: 'metadata_value_startswith')
79+
String? metaDataValueStartsWithFilter;
80+
81+
// Restricts the search scope to only retrieve group channels which have been created before the specified time, in milliseconds.
82+
int? createdBefore;
83+
84+
// Restricts the search scope to only retrieve group channels which have been created after the specified time, in milliseconds.
85+
int? createdAfter;
86+
87+
static GroupChannelFilter fromJson(Map<String, dynamic> json) {
88+
return _$GroupChannelFilterFromJson(json);
89+
}
90+
91+
Map<String, dynamic> toJson() {
92+
final json = _$GroupChannelFilterToJson(this);
93+
if (json['metadata_key'] == null) {
94+
json.remove('metadata_values');
95+
json.remove('metadata_value_startswith');
96+
}
97+
return json;
98+
}
99+
100+
static int? toSec(int? ms) {
101+
if (ms != null && ms.toString().length == 13) {
102+
return ms ~/ 1000;
103+
}
104+
return ms;
105+
}
106+
}

lib/src/public/main/model/channel/group_channel_filter.g.dart renamed to lib/src/internal/main/model/group_channel_filter.g.dart

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/internal/network/http/http_client/request/channel/group_channel/group_channel_list_request.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/
1010
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart';
1111
import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart';
1212
import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart';
13-
import 'package:sendbird_chat_sdk/src/public/main/model/channel/group_channel_filter.dart';
13+
import 'package:sendbird_chat_sdk/src/internal/main/model/group_channel_filter.dart';
1414

1515
class GroupChannelListRequest extends ApiRequest {
1616
@override

lib/src/internal/network/http/http_client/request/channel/group_channel/public/public_group_channel_list_request.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/
99
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart';
1010
import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart';
1111
import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart';
12-
import 'package:sendbird_chat_sdk/src/public/main/model/channel/group_channel_filter.dart';
12+
import 'package:sendbird_chat_sdk/src/internal/main/model/group_channel_filter.dart';
1313

1414
class PublicGroupChannelListRequest extends ApiRequest {
1515
@override

lib/src/public/core/channel/base_channel/base_channel.dart

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,29 +254,44 @@ abstract class BaseChannel implements Cacheable {
254254
@override
255255
bool operator ==(other) {
256256
if (identical(other, this)) return true;
257+
if (other is! BaseChannel) return false;
258+
259+
bool result = true;
260+
if (this is! FeedChannel && other is! FeedChannel) {
261+
result = other.coverUrl == coverUrl &&
262+
other.data == data &&
263+
other.customType == customType &&
264+
other.isFrozen == isFrozen &&
265+
other.isEphemeral == isEphemeral;
266+
}
257267

258-
return other is BaseChannel &&
259-
other.channelUrl == channelUrl &&
268+
return other.channelUrl == channelUrl &&
260269
other.name == name &&
261-
other.coverUrl == coverUrl &&
262270
other.createdAt == createdAt &&
263-
other.data == data &&
264-
other.customType == customType &&
265-
other.isFrozen == isFrozen &&
266-
other.isEphemeral == isEphemeral;
271+
result;
267272
}
268273

269274
@override
270-
int get hashCode => Object.hash(
275+
int get hashCode {
276+
if (this is FeedChannel) {
277+
return Object.hash(
278+
channelUrl,
279+
name,
280+
createdAt,
281+
);
282+
} else {
283+
return Object.hash(
271284
channelUrl,
272285
name,
273-
coverUrl,
274286
createdAt,
287+
coverUrl,
275288
data,
276289
customType,
277290
isFrozen,
278291
isEphemeral,
279292
);
293+
}
294+
}
280295

281296
@override
282297
String get key => 'channel/$channelType$channelUrl';
@@ -288,14 +303,17 @@ abstract class BaseChannel implements Cacheable {
288303
void copyWith(dynamic other) {
289304
if (other is! BaseChannel) return;
290305

306+
if (this is! FeedChannel && other is! FeedChannel) {
307+
coverUrl = other.coverUrl;
308+
data = other.data;
309+
customType = other.customType;
310+
isFrozen = other.isFrozen;
311+
isEphemeral = other.isEphemeral;
312+
}
313+
291314
channelUrl = other.channelUrl;
292315
name = other.name;
293316
createdAt = other.createdAt;
294-
_coverUrl = other._coverUrl;
295-
_data = other._data;
296-
_customType = other._customType;
297-
_isFrozen = other._isFrozen;
298-
_isEphemeral = other._isEphemeral;
299317

300318
fromCache = other.fromCache;
301319
dirty = other.dirty;

0 commit comments

Comments
 (0)