Skip to content

Commit

Permalink
Merge pull request #89 from sendbird/v4.1.2
Browse files Browse the repository at this point in the history
Add 4.1.2.
  • Loading branch information
sf-tyler-jeong authored Dec 12, 2023
2 parents 534fc28 + 0b619e5 commit 3a2149a
Show file tree
Hide file tree
Showing 16 changed files with 262 additions and 168 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## v4.1.2 (Dec 12, 2023)

### Features
- Added `createdBefore` and `createdAfter` in `GroupChannelListQuery` and `PublicGroupChannelListQuery`
- Added `markAsClicked()` in `FeedChannel`
- Replaced `markAsReadBy()` with `markAsRead()` in `FeedChannel`

### Improvements
- Fix the bugs regarding FeedChannel
- Fix the bugs regarding ReactionEvent
- Improved stability

## v4.1.1 (Nov 8, 2023)

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Before installing Sendbird Chat SDK, you need to create a Sendbird application o

```yaml
dependencies:
sendbird_chat_sdk: ^4.1.1
sendbird_chat_sdk: ^4.1.2
```
- Run `flutter pub get` command in your project directory.
Expand Down
1 change: 0 additions & 1 deletion lib/sendbird_chat_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export 'src/public/main/handler/session_handler.dart';
export 'src/public/main/handler/user_event_handler.dart';
export 'src/public/main/model/channel/feed_channel_change_logs.dart';
export 'src/public/main/model/channel/group_channel_change_logs.dart';
export 'src/public/main/model/channel/group_channel_filter.dart';
export 'src/public/main/model/channel/group_channel_unread_item_count.dart';
export 'src/public/main/model/channel/notification_category.dart';
export 'src/public/main/model/chat/do_not_disturb.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/internal/main/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ part 'chat_notifications.dart';
part 'chat_push.dart';
part 'chat_user.dart';

const sdkVersion = '4.1.1';
const sdkVersion = '4.1.2';

// Internal implementation for main class. Do not directly access this class.
class Chat with WidgetsBindingObserver {
Expand Down
106 changes: 106 additions & 0 deletions lib/src/internal/main/model/group_channel_filter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Copyright (c) 2023 Sendbird, Inc. All rights reserved.

import 'package:json_annotation/json_annotation.dart';
import 'package:sendbird_chat_sdk/sendbird_chat_sdk.dart';
import 'package:sendbird_chat_sdk/src/internal/main/utils/enum_utils.dart';

part 'group_channel_filter.g.dart';

// The GroupChannelFilter class for [GroupChannelListQuery] and [PublicGroupChannelListQuery].
@JsonSerializable()
class GroupChannelFilter {
// Sets the member state filter.
@JsonKey(toJson: memberStateFilterEnumForQuery)
MyMemberStateFilter memberStateFilter = MyMemberStateFilter.all;

// Sets to filter super channel. Default is `all`.
@JsonKey(toJson: groupChannelSuperFilterEnum)
SuperChannelFilter superMode = SuperChannelFilter.all;

// Sets to filter public channel. Default is `all`.
PublicChannelFilter publicMode = PublicChannelFilter.all;

// Sets to filter channels by custom type that starts with.
@JsonKey(name: 'custom_type_startswith')
String? customTypeStartsWith;

// Sets the custom type filter.
List<String>? customTypes;

// Sets the filter with nickname.
// Query result will contains channels that any one of member contains given nickname.
String? membersNicknameContains;

// Sets the filter with user IDs that query result will return
// if any one of user id matches with channel's members.
@JsonKey(includeFromJson: false, includeToJson: false)
List<String>? membersIncludeIn;

// Sets the filter with user IDs that query result will return
// only if channel's members are exactly matched with this property.
List<String>? membersExactlyIn;

// Sets a filter to return only channels that contains the
// specified group channel name.
String? nameContains;

// Sets to filter channels by the unread messages.
// The default value is `all`.
UnreadChannelFilter unreadFilter = UnreadChannelFilter.all;

// Sets a key for ordering by value in the metadata.
// This is valid when the `order` is `channelMetaDataValueAlphabetical` only.
@JsonKey(includeFromJson: false, includeToJson: false)
String? metadataOrderKey;

// Sets to filter channels by the hidden state.
// The default value is `unhidden`.
HiddenChannelFilter hiddenMode = HiddenChannelFilter.unhidden;

// Sets to filter channels by the membership filter.
// The default value is `all`.
@JsonKey(name: 'public_membership_mode')
MembershipFilter publicMembershipFilter = MembershipFilter.all;

// Searches for group channels with metadata containing an item with the
// specified key.
@JsonKey(name: 'metadata_key')
String? metaDataKey;

// Searches for group channels with metadata containing an item with the
// specified values.
@JsonKey(name: 'metadata_values')
List<String>? metaDataValues;

// Searches for group channels with metadata containing an item with the
// key specified by the metaDataKey and the values of that item start with
// the specified value.
@JsonKey(name: 'metadata_value_startswith')
String? metaDataValueStartsWithFilter;

// Restricts the search scope to only retrieve group channels which have been created before the specified time, in milliseconds.
int? createdBefore;

// Restricts the search scope to only retrieve group channels which have been created after the specified time, in milliseconds.
int? createdAfter;

static GroupChannelFilter fromJson(Map<String, dynamic> json) {
return _$GroupChannelFilterFromJson(json);
}

Map<String, dynamic> toJson() {
final json = _$GroupChannelFilterToJson(this);
if (json['metadata_key'] == null) {
json.remove('metadata_values');
json.remove('metadata_value_startswith');
}
return json;
}

static int? toSec(int? ms) {
if (ms != null && ms.toString().length == 13) {
return ms ~/ 1000;
}
return ms;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart';
import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart';
import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart';
import 'package:sendbird_chat_sdk/src/public/main/model/channel/group_channel_filter.dart';
import 'package:sendbird_chat_sdk/src/internal/main/model/group_channel_filter.dart';

class GroupChannelListRequest extends ApiRequest {
@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/response/responses.dart';
import 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_channel.dart';
import 'package:sendbird_chat_sdk/src/public/main/define/enums.dart';
import 'package:sendbird_chat_sdk/src/public/main/model/channel/group_channel_filter.dart';
import 'package:sendbird_chat_sdk/src/internal/main/model/group_channel_filter.dart';

class PublicGroupChannelListRequest extends ApiRequest {
@override
Expand Down
46 changes: 32 additions & 14 deletions lib/src/public/core/channel/base_channel/base_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,29 +254,44 @@ abstract class BaseChannel implements Cacheable {
@override
bool operator ==(other) {
if (identical(other, this)) return true;
if (other is! BaseChannel) return false;

bool result = true;
if (this is! FeedChannel && other is! FeedChannel) {
result = other.coverUrl == coverUrl &&
other.data == data &&
other.customType == customType &&
other.isFrozen == isFrozen &&
other.isEphemeral == isEphemeral;
}

return other is BaseChannel &&
other.channelUrl == channelUrl &&
return other.channelUrl == channelUrl &&
other.name == name &&
other.coverUrl == coverUrl &&
other.createdAt == createdAt &&
other.data == data &&
other.customType == customType &&
other.isFrozen == isFrozen &&
other.isEphemeral == isEphemeral;
result;
}

@override
int get hashCode => Object.hash(
int get hashCode {
if (this is FeedChannel) {
return Object.hash(
channelUrl,
name,
createdAt,
);
} else {
return Object.hash(
channelUrl,
name,
coverUrl,
createdAt,
coverUrl,
data,
customType,
isFrozen,
isEphemeral,
);
}
}

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

if (this is! FeedChannel && other is! FeedChannel) {
coverUrl = other.coverUrl;
data = other.data;
customType = other.customType;
isFrozen = other.isFrozen;
isEphemeral = other.isEphemeral;
}

channelUrl = other.channelUrl;
name = other.name;
createdAt = other.createdAt;
_coverUrl = other._coverUrl;
_data = other._data;
_customType = other._customType;
_isFrozen = other._isFrozen;
_isEphemeral = other._isEphemeral;

fromCache = other.fromCache;
dirty = other.dirty;
Expand Down
Loading

0 comments on commit 3a2149a

Please sign in to comment.