Skip to content

Commit 6e75992

Browse files
Merge pull request #135 from sendbird/v4.2.31
Add 4.2.31.
2 parents 5c36a4f + eb38f9c commit 6e75992

File tree

11 files changed

+38
-16
lines changed

11 files changed

+38
-16
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v4.2.31 (Feb 25, 2025)
2+
3+
### Improvements
4+
- Fixed a bug where `requestId` is null if websocket is disconnected while sending a `FileMessage`
5+
16
## v4.2.30 (Dec 5, 2024)
27

38
### Improvements

README.md

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

5151
```yaml
5252
dependencies:
53-
sendbird_chat_sdk: ^4.2.30
53+
sendbird_chat_sdk: ^4.2.31
5454
```
5555
5656
- Run `flutter pub get` command in your project directory.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ part 'chat_notifications.dart';
6262
part 'chat_push.dart';
6363
part 'chat_user.dart';
6464

65-
const sdkVersion = '4.2.30';
65+
const sdkVersion = '4.2.31';
6666

6767
// Internal implementation for main class. Do not directly access this class.
6868
class Chat with WidgetsBindingObserver {

lib/src/internal/main/chat_manager/command_manager.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,9 @@ class CommandManager {
9999
_completerMap.forEach((key, value) {
100100
if (e != null) {
101101
value.completeError(e);
102-
} else {
103-
value.complete();
104102
}
105103
});
106-
_completerMap.removeWhere((key, value) => true);
104+
_completerMap.clear();
107105
}
108106

109107
Future<Command?> sendCommand(Command cmd) async {

lib/src/internal/main/chat_manager/connection_manager.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ class ConnectionManager {
260260
reconnectTimer = null;
261261
}
262262

263-
await webSocketClient.close();
263+
// Check
264+
if (!isDisconnected()) {
265+
await webSocketClient.close();
266+
}
264267

265268
final disconnectedUserId = chat.chatContext.currentUserId ?? '';
266269

@@ -466,10 +469,13 @@ class ConnectionManager {
466469
}
467470

468471
String get _sbUserAgentHeader {
469-
final uikitVersion = chat.extensions[Chat.extensionKeyUiKit];
470472
const core = '/c$sdkVersion';
473+
474+
final uikitVersion = chat.extensions[Chat.extensionKeyUiKit];
471475
final uikit = uikitVersion != null ? '/u$uikitVersion' : '';
476+
472477
final os = '/o${kIsWeb ? 'web' : Platform.operatingSystem}';
478+
473479
return '${Chat.platform}$core$uikit$os';
474480
}
475481

@@ -480,11 +486,14 @@ class ConnectionManager {
480486
// '2.19.0 (stable) (Mon Jan 23 11:29:09 2023 -0800) on "android_arm64"'
481487
final platformVersion = kIsWeb ? '' : Platform.version.split(' ').first;
482488

489+
final uikitVersion = chat.extensions[Chat.extensionKeyUiKit];
490+
final uikitInfo = 'uikit-chat/$deviceOsPlatform/${uikitVersion ?? ''}';
491+
483492
return 'main_sdk_info=$mainSdkInfo'
484493
'&device_os_platform=$deviceOsPlatform'
485494
'&os_version=$osVersion'
486-
'&platform_version=$platformVersion';
487-
// '&extension_sdk_info='; // 'uikit/android/3.3.2,live/android/1.0.0-beta' // TODO: SendbirdChat.addSendbirdExtensions()
495+
'&platform_version=$platformVersion'
496+
'&extension_sdk_info=$uikitInfo';
488497
}
489498

490499
String get _sendbirdHeader {

lib/src/internal/main/chat_manager/db_manager.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class DBManager {
6767
return false;
6868
}
6969

70+
if (_isInitialized) {
71+
return true;
72+
}
73+
7074
try {
7175
if (_chat.isTest) {
7276
// https://github.com/isar/isar#unit-tests

lib/src/internal/network/http/http_client/http_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class HttpClient {
372372
body = jsonDecode(response.body.toString());
373373
} catch (e) {
374374
sbLog.e(StackTrace.current, 'e: $e');
375-
throw MalformedDataException();
375+
return false; // throw MalformedDataException();
376376
}
377377

378378
if (response.statusCode >= 400 && response.statusCode < 500) {

lib/src/internal/network/http/http_client/request/channel/message/channel_file_message_send_request.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ChannelFileMessageSendRequest extends ApiRequest {
2626
bool markAsRead = false,
2727
bool? requireAuth,
2828
List<String>? additionalMentionedUserIds,
29+
String? requestId,
2930
}) : super(chat: chat) {
3031
url = '${channelType.urlString}/$channelUrl/messages';
3132

@@ -40,6 +41,7 @@ class ChannelFileMessageSendRequest extends ApiRequest {
4041
'file_name': params.fileInfo.fileName,
4142
'file_type': params.fileInfo.mimeType,
4243
'url': params.fileInfo.fileUrl,
44+
'req_id': requestId,
4345
};
4446

4547
body.addAll(params.toJson());

lib/src/internal/network/websocket/websocket_client.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,14 @@ class WebSocketClient {
129129
_onDoneCompleter = null;
130130
_onDone();
131131
return false;
132-
}).timeout(const Duration(milliseconds: 500), onTimeout: () {
133-
_onDoneCompleter = null;
134-
_onDone();
135-
return false;
136-
});
132+
}).timeout(
133+
const Duration(milliseconds: 500), // Check
134+
onTimeout: () {
135+
_onDoneCompleter = null;
136+
_onDone();
137+
return false;
138+
},
139+
);
137140
return result ?? false;
138141
} catch (e) {
139142
sbLog.e(StackTrace.current, 'e: $e');

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ extension BaseChannelMessage on BaseChannel {
438438
params: params,
439439
thumbnails: uploadResponse?.thumbnails,
440440
requireAuth: uploadResponse?.requireAuth,
441+
requestId: pendingFileMessage.requestId,
441442
);
442443
final message = await chat.apiClient.send<FileMessage>(request);
443444

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sendbird_chat_sdk
22
description: With Sendbird Chat for Flutter, you can easily build an in-app chat with all the essential messaging features.
3-
version: 4.2.30
3+
version: 4.2.31
44
homepage: https://sendbird.com
55
repository: https://github.com/sendbird/sendbird-chat-sdk-flutter
66
documentation: https://sendbird.com/docs/chat/sdk/v4/flutter/getting-started/send-first-message

0 commit comments

Comments
 (0)