Skip to content

Commit

Permalink
Add 4.0.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
sf-tyler-jeong committed Sep 15, 2023
1 parent b7f55ba commit 4dd6e21
Show file tree
Hide file tree
Showing 15 changed files with 539 additions and 228 deletions.
91 changes: 47 additions & 44 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,116 @@
## v4.0.12 (Sep 15, 2023)

### Improvements
- Fixed the bug regarding parent FileMessage type
- Updated regarding statistics

## v4.0.11 (Sep 12, 2023)

### Improvements
- Fixed the bug regarding the url encoding of `userId`.
- Fixed the bug regarding the url encoding of `userId`

## v4.0.10 (Aug 31, 2023)

### Improvements
- Fixed the bug regarding the `FeedChannel` caching.
- Fixed the bug regarding the `FeedChannel` caching

## v4.0.9 (Aug 30, 2023)

### Improvements
- Fixed the bug regarding the `hasNext` in `BaseMessageCollection`.
- Fixed the bug when the `reverse` is `true` in `MessageListParams` regarding `BaseMessageCollection`.
- Improved stability.
- Fixed the bug regarding the `hasNext` in `BaseMessageCollection`
- Fixed the bug when the `reverse` is `true` in `MessageListParams` regarding `BaseMessageCollection`
- Improved stability

## v4.0.8 (Aug 22, 2023)

### Features
- Replaced `Map<String, String> templateVariables` with `Map<String, dynamic> templateVariables` in `NotificationData`.
- Added `tags` in `NotificationData`.
- Replaced `Map<String, String> templateVariables` with `Map<String, dynamic> templateVariables` in `NotificationData`
- Added `tags` in `NotificationData`

### Improvements
- Improved stability.
- Improved stability

## v4.0.7 (Aug 18, 2023)

### Features
- Added `notificationData` in `BaseMessage`.
- Added `notificationData` in `BaseMessage`

### Improvements
- Fixed the bug regarding `unreadMessageCount` in `FeedChannel`.
- Fixed the bug regarding `unreadMessageCount` in `FeedChannel`

## v4.0.6 (Aug 16, 2023)

### Features

#### Notification
- Added `isTemplateLabelEnabled`, `isCategoryFilterEnabled` and `notificationCategories` in `FeedChannel`.
- Added `authenticateFeed()`, `refreshNotificationCollections()` in `SendbirdChat`.
- Added `isTemplateLabelEnabled`, `isCategoryFilterEnabled` and `notificationCategories` in `FeedChannel`
- Added `authenticateFeed()`, `refreshNotificationCollections()` in `SendbirdChat`

### Improvements
- Improved stability.
- Improved stability

## v4.0.5 (Jul 14, 2023)

### Features
- Added `SendbirdStatistics` for internal use.
- Added `SendbirdStatistics` for internal use

### Improvements
- Improved stability.
- Improved stability

## v4.0.4 (Jul 3, 2023)

### Improvements
- Fixed the bug regarding `resendFileMessage()`.
- Fixed the bug regarding connectivity events.
- Fixed the bug regarding `resendFileMessage()`
- Fixed the bug regarding connectivity events

## v4.0.3 (Jun 30, 2023)

### Features

#### FeedChannel
- Added `FeedChannelListQuery`
- Added `FeedChannel`.
- Added `feed` in `ChannelType`.
- Added `getMyFeedChannelChangeLogs()` with `FeedChannelChangeLogsParams` in SendbirdChat.
- Added `FeedChannel`
- Added `feed` in `ChannelType`
- Added `getMyFeedChannelChangeLogs()` with `FeedChannelChangeLogsParams` in SendbirdChat
- Added `getTotalUnreadMessageCountWithFeedChannel()
` in SendbirdChat.
- Added `FeedChannelHandler`.
- Added `onTotalUnreadMessageCountChanged()` in `UserEventHandler` and `UnreadMessageCount`.
` 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`.
- 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`.
- 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.
- 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`.
- Added `NotificationInfo`
- Added `notificationInfo` in `AppInfo`

### Improvements
- Improved stability.
- Improved stability

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

## v4.0.1 (Jun 14, 2023)
- Improved stability.
- Improved stability

## v4.0.0 (May 31, 2023)
> To see detailed changes, please refer to the [migration guide](https://sendbird.com/docs/chat/v4/flutter/getting-started/migration-guide).
> To see detailed changes, please refer to the [migration guide](https://sendbird.com/docs/chat/v4/flutter/getting-started/migration-guide)
### Features
- Added `GroupChannelCollection`, `GroupChannelContext` and `GroupChannelCollectionHandler`.
- Added `MessageCollection`, `MessageContext` and `MessageCollectionHandler`.
- Added `enum CollectionEventSource`.
- Added `GroupChannelCollection`, `GroupChannelContext` and `GroupChannelCollectionHandler`
- Added `MessageCollection`, `MessageContext` and `MessageCollectionHandler`
- Added `enum CollectionEventSource`

## v3 Changelog
Please refer to [this page](https://github.com/sendbird/sendbird-chat-sdk-flutter/blob/v3/CHANGELOG.md).
Please refer to [this page](https://github.com/sendbird/sendbird-chat-sdk-flutter/blob/v3/CHANGELOG.md)
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.11
sendbird_chat_sdk: ^4.0.12
```
- Run `flutter pub get` command in your project directory.
Expand Down
5 changes: 3 additions & 2 deletions 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.0.11';
const sdkVersion = '4.0.12';

// Internal implementation for main class. Do not directly access this class.
class Chat with WidgetsBindingObserver {
Expand Down Expand Up @@ -117,13 +117,14 @@ class Chat with WidgetsBindingObserver {
sessionManager = SessionManager(chat: this);
commandManager = CommandManager(chat: this);
eventManager = EventManager(sessionManager: sessionManager);
statManager = StatManager(chat: this);
apiClient = ApiClient(
chatContext: chatContext,
sessionManager: sessionManager,
statManager: statManager,
); // HttpClient
eventDispatcher = EventDispatcher(chat: this);
collectionManager = CollectionManager(chat: this);
statManager = StatManager(chat: this);

_listenConnectivityChangedEvent();
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/internal/main/chat_manager/command_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ class CommandManager {
}
}

// System
Future<void> _processSystemEvent(Command cmd) async {
final event = ChannelEvent.fromJsonWithChat(_chat, cmd.payload);

Expand Down
37 changes: 34 additions & 3 deletions lib/src/internal/main/chat_manager/connection_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,29 +158,60 @@ class ConnectionManager {

runZonedGuarded(() {
sbLog.d(StackTrace.current, 'webSocketClient?.connect()');

chat.statManager.startWsConnectStat(hostUrl: url);
webSocketClient.connect(url);
}, (e, s) async {
sbLog.e(StackTrace.current, 'e: $e');

changeState(DisconnectedState(chat: chat));
if (chat.chatContext.loginCompleter != null &&
!chat.chatContext.loginCompleter!.isCompleted) {
if (e is SendbirdException) {
chat.statManager.endWsConnectStat(
hostUrl: url,
success: false,
errorCode: e.code,
errorDescription: e.message,
);

chat.chatContext.loginCompleter?.completeError(e);
} else {
chat.chatContext.loginCompleter
?.completeError(WebSocketFailedException(message: e.toString()));
final exception = WebSocketFailedException(message: e.toString());

chat.statManager.endWsConnectStat(
hostUrl: url,
success: false,
errorCode: exception.code,
errorDescription: exception.message,
);

chat.chatContext.loginCompleter?.completeError(exception);
}
}
});

final user = await chat.chatContext.loginCompleter!.future
.timeout(Duration(seconds: chat.chatContext.options.connectionTimeout),
onTimeout: () async {
final e = LoginTimeoutException();

chat.statManager.endWsConnectStat(
hostUrl: url,
success: false,
errorCode: e.code,
errorDescription: e.name,
);

await doDisconnect(logout: true);
throw LoginTimeoutException();
throw e;
});

// After 'LOGI' received
chat.statManager.endWsConnectStat(
hostUrl: url,
success: true,
);
return user;
}

Expand Down
85 changes: 85 additions & 0 deletions lib/src/internal/main/stats/api_result_stat.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2023 Sendbird, Inc. All rights reserved.

import 'package:sendbird_chat_sdk/src/internal/main/logger/sendbird_logger.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/default_stat.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_type.dart';

class ApiResultStat extends DefaultStat {
final String endpoint; // endpoint
final String method; // 'GET|POST|PUT|DELETE'
final bool success; // success or not
final int latency; // roundtrip latency
final int? errorCode; // error code if exist
final String? errorDescription; // detailed error message

ApiResultStat({
required int ts,
required this.endpoint,
required this.method,
required this.success,
required this.latency,
this.errorCode,
this.errorDescription,
}) : super(StatType.apiResult, ts);

@override
Map<String, dynamic> toJson() {
final json = <String, dynamic>{
'endpoint': endpoint,
'method': method,
'success': success,
'latency': latency,
'error_code': errorCode,
'error_description': errorDescription,
};
final result = super.toJson();
result['data'] = json;
return result;
}

// {
// 'stat_type' : 'api:result',
// 'ts': int, // timestamp for log creation,
// 'data' : {
// 'endpoint': String,
// 'method': String,
// 'success': bool,
// 'latency': int,
// 'error_code': int?,
// 'error_description': String?,
// },
// }
static ApiResultStat? fromJson({
required int ts,
required Map<String, dynamic> data,
}) {
try {
final String? endpoint = data['endpoint'] as String?;
final String? method = data['method'] as String?;
final bool? success = data['success'] as bool?;
final int? latency = data['latency'] as int?;
final int? errorCode = data['error_code'] as int?;
final String? errorDescription = data['error_description'] as String?;

if (endpoint == null ||
method == null ||
success == null ||
latency == null) {
return null;
}

return ApiResultStat(
ts: ts,
endpoint: endpoint,
method: method,
success: success,
latency: latency,
errorCode: errorCode,
errorDescription: errorDescription,
);
} catch (e) {
sbLog.d(StackTrace.current, 'e: ${e.toString()}');
}
return null;
}
}
4 changes: 4 additions & 0 deletions lib/src/internal/main/stats/default_stat_prefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import 'dart:convert';

import 'package:collection/collection.dart';
import 'package:sendbird_chat_sdk/src/internal/main/logger/sendbird_logger.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/api_result_stat.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/default_stat.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/notification_stat.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_type.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/stat_utils.dart';
import 'package:sendbird_chat_sdk/src/internal/main/stats/ws_connect_stat.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:uuid/uuid.dart';

Expand Down Expand Up @@ -79,7 +81,9 @@ class DefaultStatPrefs {
if (statType != null) {
switch (statType) {
case StatType.apiResult:
return ApiResultStat.fromJson(ts: ts, data: data);
case StatType.wsConnect:
return WsConnectStat.fromJson(ts: ts, data: data);
case StatType.featureLocalCache:
return null;
case StatType.notificationStats:
Expand Down
Loading

0 comments on commit 4dd6e21

Please sign in to comment.