Skip to content

Commit

Permalink
Add 4.0.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
sf-tyler-jeong committed Jun 30, 2023
1 parent 8f5e7c4 commit ccc12b8
Show file tree
Hide file tree
Showing 97 changed files with 2,226 additions and 589 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
## v4.0.3 (Jun 30, 2023)

### Features

#### FeedChannel
- Added `FeedChannelListQuery`
- Added `FeedChannel`.
- Added `feed` in `ChannelType`.
- Added `getMyFeedChannelChangeLogs()` with `FeedChannelChangeLogsParams` in SendbirdChat.
- Added `getTotalUnreadMessageCountWithFeedChannel()
` in SendbirdChat.
- Added `FeedChannelHandler`.
- Added `onTotalUnreadMessageCountChanged()` in `UserEventHandler` and `UnreadMessageCount`.

#### Collection for notifications
- Added `NotificationCollection`, `NotificationCollectionHandler` and `NotificationContext`.
- Added `BaseMessageCollection`, `BaseMessageCollectionHandler` and `BaseMessageContext`.
- Added `FeedChannelContext`, `BaseChannelContext`.

#### ChatNotification for GroupChannel
- Added `isChatNotification` in GroupChannel.
- Added `includeChatNotification` in `GroupChannelListQuery` and `GroupChannelChangeLogsParams`.

#### Setting and Template for Notification
- Added `getGlobalNotificationChannelSetting()
` and `GlobalNotificationChannelSetting` in SendbirdChat.
- Added `getNotificationTemplateListByToken()
` with `NotificationTemplateListParams` and `NotificationTemplateList` in SendbirdChat.
- Added `getNotificationTemplate()
` and `NotificationTemplate` in SendbirdChat.

#### NotificationInfo
- Added `NotificationInfo`.
- Added `notificationInfo` in `AppInfo`.

### Improvements
- Improved stability.

## v4.0.2 (Jun 23, 2023)
- Improved stability.

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.0.2
sendbird_chat_sdk: ^4.0.3
```
- Run `flutter pub get` command in your project directory.
Expand Down
20 changes: 19 additions & 1 deletion lib/sendbird_chat_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
library sendbird_chat_sdk;

export 'src/public/core/channel/base_channel/base_channel.dart';
export 'src/public/core/channel/feed_channel/feed_channel.dart';
export 'src/public/core/channel/group_channel/group_channel.dart';
export 'src/public/core/channel/open_channel/open_channel.dart';
export 'src/public/core/message/admin_message.dart';
Expand All @@ -17,32 +18,46 @@ export 'src/public/core/user/user.dart';
export 'src/public/main/chat/sendbird_chat.dart';
export 'src/public/main/chat/sendbird_chat_options.dart';
export 'src/public/main/collection/collection_event_source.dart';
export 'src/public/main/collection/group_channel_collection/group_channel_context.dart';
export 'src/public/main/collection/group_channel_collection/base_channel_context.dart';
export 'src/public/main/collection/group_channel_collection/feed_channel_context.dart';
export 'src/public/main/collection/group_channel_collection/group_channel_collection.dart';
export 'src/public/main/collection/group_channel_collection/group_channel_collection_handler.dart';
export 'src/public/main/collection/group_channel_collection/group_channel_context.dart';
export 'src/public/main/collection/group_channel_message_collection/base_message_collection.dart';
export 'src/public/main/collection/group_channel_message_collection/base_message_collection_handler.dart';
export 'src/public/main/collection/group_channel_message_collection/base_message_context.dart';
export 'src/public/main/collection/group_channel_message_collection/message_collection.dart';
export 'src/public/main/collection/group_channel_message_collection/message_collection_handler.dart';
export 'src/public/main/collection/group_channel_message_collection/message_context.dart';
export 'src/public/main/collection/group_channel_message_collection/notification_collection.dart';
export 'src/public/main/collection/group_channel_message_collection/notification_collection_handler.dart';
export 'src/public/main/collection/group_channel_message_collection/notification_context.dart';
export 'src/public/main/define/enums.dart';
export 'src/public/main/define/exceptions.dart';
export 'src/public/main/define/sendbird_error.dart';
export 'src/public/main/handler/channel_handler.dart';
export 'src/public/main/handler/connection_handler.dart';
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/chat/do_not_disturb.dart';
export 'src/public/main/model/chat/emoji.dart';
export 'src/public/main/model/chat/global_notification_channel_setting.dart';
export 'src/public/main/model/chat/notification_template.dart';
export 'src/public/main/model/chat/notification_template_list.dart';
export 'src/public/main/model/chat/snooze_period.dart';
export 'src/public/main/model/info/app_info.dart';
export 'src/public/main/model/info/file_info.dart';
export 'src/public/main/model/info/mute_info.dart';
export 'src/public/main/model/info/notification_info.dart';
export 'src/public/main/model/info/scheduled_info.dart';
export 'src/public/main/model/message/apple_critical_alert_options.dart';
export 'src/public/main/model/message/message_change_logs.dart';
export 'src/public/main/model/message/message_meta_array.dart';
export 'src/public/main/model/message/unread_message_count.dart';
export 'src/public/main/model/og/og_image.dart';
export 'src/public/main/model/og/og_meta_data.dart';
export 'src/public/main/model/poll/poll.dart';
Expand All @@ -56,6 +71,7 @@ export 'src/public/main/model/reaction/reaction_event.dart';
export 'src/public/main/model/thread/thread_info.dart';
export 'src/public/main/model/thread/thread_info_updated_event.dart';
export 'src/public/main/model/thread/threaded_messages.dart';
export 'src/public/main/params/channel/feed_channel_change_logs_params.dart';
export 'src/public/main/params/channel/group_channel_change_logs_params.dart';
export 'src/public/main/params/channel/group_channel_create_params.dart';
export 'src/public/main/params/channel/group_channel_total_unread_channel_count_params.dart';
Expand All @@ -81,13 +97,15 @@ export 'src/public/main/params/message/threaded_message_list_params.dart';
export 'src/public/main/params/message/total_scheduled_message_count_params.dart';
export 'src/public/main/params/message/user_message_create_params.dart';
export 'src/public/main/params/message/user_message_update_params.dart';
export 'src/public/main/params/notifications/notification_template_list_params.dart';
export 'src/public/main/params/poll/poll_create_params.dart';
export 'src/public/main/params/poll/poll_list_query_params.dart';
export 'src/public/main/params/poll/poll_option_retrieval_params.dart';
export 'src/public/main/params/poll/poll_retrieval_params.dart';
export 'src/public/main/params/poll/poll_update_params.dart';
export 'src/public/main/params/poll/poll_voter_list_query_params.dart';
export 'src/public/main/query/base_query.dart';
export 'src/public/main/query/channel/feed_channel_list_query.dart';
export 'src/public/main/query/channel/group_channel_list_query.dart';
export 'src/public/main/query/channel/open_channel_list_query.dart';
export 'src/public/main/query/channel/public_group_channel_list_query.dart';
Expand Down
13 changes: 10 additions & 3 deletions lib/src/internal/main/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ import 'package:sendbird_chat_sdk/src/internal/main/logger/sendbird_logger.dart'
import 'package:sendbird_chat_sdk/src/internal/main/utils/async/async_queue.dart';
import 'package:sendbird_chat_sdk/src/internal/main/utils/async/async_task.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/api_client.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/group_channel/group_channel_change_log_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/feed_channel/feed_channel_change_logs_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/group_channel/group_channel_change_logs_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/group_channel/group_channel_delivery_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/group_channel/group_channel_read_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/group_channel/scheduled_message/group_channel_scheduled_message_total_count_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/channel/invitation/channel_invitation_preference_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/main/emoji/emoji_category_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/main/emoji/emoji_container_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/main/emoji/emoji_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/main/notifications/global_notification_channel_setting_get_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/main/notifications/notification_template_get_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/main/notifications/notification_template_list_get_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/user/block/user_block_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/user/block/user_unblock_request.dart';
import 'package:sendbird_chat_sdk/src/internal/network/http/http_client/request/user/count/user_group_channel_count_request.dart';
Expand All @@ -46,10 +50,11 @@ part 'chat_channel.dart';
part 'chat_connection.dart';
part 'chat_emoji.dart';
part 'chat_event_handler.dart';
part 'chat_notifications.dart';
part 'chat_push.dart';
part 'chat_user.dart';

const sdkVersion = '4.0.2';
const sdkVersion = '4.0.3';

// Internal implementation for main class. Do not directly access this class.
class Chat with WidgetsBindingObserver {
Expand All @@ -61,8 +66,9 @@ class Chat with WidgetsBindingObserver {
// Extra data
static const extraDataPremiumFeatureList = 'premium_feature_list';
static const extraDataFileUploadSizeLimit = 'file_upload_size_limit';
static const extraDataEmojiHash = 'emoji_hash';
static const extraDataApplicationAttributes = 'application_attributes';
static const extraDataEmojiHash = 'emoji_hash';
static const extraDataNotifications = 'notifications';

static int globalChatId = 0;

Expand All @@ -72,6 +78,7 @@ class Chat with WidgetsBindingObserver {
extraDataFileUploadSizeLimit,
extraDataApplicationAttributes,
extraDataEmojiHash,
extraDataNotifications,
];

bool? _isObserverRegistered;
Expand Down
40 changes: 29 additions & 11 deletions lib/src/internal/main/chat/chat_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,27 @@ extension ChatChannel on Chat {
return res;
}

Future<FeedChannelChangeLogs> getMyFeedChannelChangeLogs(
FeedChannelChangeLogsParams params, {
String? token,
int? timestamp,
}) async {
sbLog.i(StackTrace.current, 'token: $token');

final res = await apiClient.send<FeedChannelChangeLogs>(
FeedChannelChangeLogsGetRequest(this, params,
token: token, timestamp: timestamp));

for (final element in res.updatedChannels) {
element.saveToCache(this);
}
return res;
}

Future<void> markAsReadAll() async {
sbLog.i(StackTrace.current);
await apiClient.send(GroupChannelMarkAsReadRequest(this,
userId: chatContext.currentUserId));
await apiClient.send(
GroupChannelMarkAsReadRequest(this, userId: chatContext.currentUserId));
}

Future<void> markAsRead({required List<String> channelUrls}) async {
Expand Down Expand Up @@ -101,36 +118,37 @@ extension ChatChannel on Chat {
return result;
}

Future<int> getTotalUnreadMessageCount(
Future<UnreadMessageCount> getTotalUnreadMessageCount(
[GroupChannelTotalUnreadMessageCountParams? params]) async {
final result = await apiClient
.send<int>(UserTotalUnreadMessageCountGetRequest(this, params: params));
final result = await apiClient.send<UnreadMessageCount>(
UserTotalUnreadMessageCountGetRequest(this, params: params));
sbLog.i(StackTrace.current, 'return: $result');
return result;
}

Future<GroupChannelUnreadItemCount> getUnreadItemCount(List<UnreadItemKey> keys) async {
final result = await apiClient
.send<GroupChannelUnreadItemCount>(UserUnreadItemCountGetRequest(this, keys));
Future<GroupChannelUnreadItemCount> getUnreadItemCount(
List<UnreadItemKey> keys) async {
final result = await apiClient.send<GroupChannelUnreadItemCount>(
UserUnreadItemCountGetRequest(this, keys));
sbLog.i(StackTrace.current, 'keys: $keys, return: $result');
return result;
}

int get subscribedTotalUnreadMessageCount {
final result = chatContext.unreadCountInfo.all;
final result = chatContext.unreadMessageCountInfo.all;
sbLog.i(StackTrace.current, 'return: $result');
return result;
}

int get subscribedCustomTypeTotalUnreadMessageCount {
final result =
chatContext.unreadCountInfo.customTypes.values.reduce((a, b) => a + b);
chatContext.unreadMessageCountInfo.customTypes.values.reduce((a, b) => a + b);
sbLog.i(StackTrace.current, 'return: $result');
return result;
}

int? subscribedCustomTypeUnreadMessageCount(String customType) {
final result = chatContext.unreadCountInfo.customTypes[customType];
final result = chatContext.unreadMessageCountInfo.customTypes[customType];
sbLog.i(StackTrace.current, 'customType: $customType, return: $result');
return result;
}
Expand Down
36 changes: 36 additions & 0 deletions lib/src/internal/main/chat/chat_notifications.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2023 Sendbird, Inc. All rights reserved.

part of 'chat.dart';

extension ChatNotifications on Chat {
Future<GlobalNotificationChannelSetting>
getGlobalNotificationChannelSetting() async {
sbLog.i(StackTrace.current);
return await apiClient.send<GlobalNotificationChannelSetting>(
GlobalNotificationChannelSettingGetRequest(this));
}

Future<NotificationTemplateList> getNotificationTemplateListByToken(
NotificationTemplateListParams params, {
String? token,
}) async {
sbLog.i(StackTrace.current);
return await apiClient
.send<NotificationTemplateList>(NotificationTemplateListGetRequest(
this,
params,
token: token,
));
}

Future<NotificationTemplate> getNotificationTemplate({
required String key,
}) async {
sbLog.i(StackTrace.current);
return await apiClient
.send<NotificationTemplate>(NotificationTemplateGetRequest(
this,
key: key,
));
}
}
2 changes: 1 addition & 1 deletion lib/src/internal/main/chat_cache/cache_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class Cacheable {
String get key;
bool dirty = false;

void copyWith(others);
void copyWith(dynamic other);
}

extension Operation on Cacheable {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/internal/main/chat_cache/channel/meta_data_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class MetaDataCache<T> implements Cacheable, Evictable {
bool dirty = false;

@override
void copyWith(others) {
_channelType = others._channelType;
void copyWith(dynamic other) {
_channelType = other._channelType;
}

@override
Expand Down
9 changes: 5 additions & 4 deletions lib/src/internal/main/chat_context/chat_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:async';

import 'package:sendbird_chat_sdk/src/internal/main/model/reconnect_configuration.dart';
import 'package:sendbird_chat_sdk/src/internal/main/model/reconnect_task.dart';
import 'package:sendbird_chat_sdk/src/internal/main/model/unread_count_info.dart';
import 'package:sendbird_chat_sdk/src/internal/main/model/unread_message_count_info.dart';
import 'package:sendbird_chat_sdk/src/public/core/user/user.dart';
import 'package:sendbird_chat_sdk/src/public/main/chat/sendbird_chat_options.dart';
import 'package:sendbird_chat_sdk/src/public/main/model/info/app_info.dart';
Expand Down Expand Up @@ -69,8 +69,8 @@ class ChatContext {
}

// UnreadCountInfo
UnreadCountInfo unreadCountInfo =
UnreadCountInfo(all: 0, customTypes: {}, ts: 0);
UnreadMessageCountInfo unreadMessageCountInfo =
UnreadMessageCountInfo(all: 0, customTypes: {}, ts: 0);

void resetReconnectTask() {
final config = reconnectConfig;
Expand Down Expand Up @@ -102,6 +102,7 @@ class ChatContext {
wsHost = null;
apiHeaders.clear();

unreadCountInfo = UnreadCountInfo(all: 0, customTypes: {}, ts: 0);
unreadMessageCountInfo =
UnreadMessageCountInfo(all: 0, customTypes: {}, ts: 0);
}
}
Loading

0 comments on commit ccc12b8

Please sign in to comment.