diff --git a/CHANGELOG.md b/CHANGELOG.md index 54f9e223..002a8e11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ +## [3.0.12] - Apr 25, 2021 +* Fixed to apply option to `SendbirdSdk` properly +* Fixed `sendFileMessage` progress inconsistency +* Improved stability + ## [3.0.11] - Apr 22, 2021 +* Added `nicknameStartWith` filter in `ApplicationListQuery` * Updated pubspec and README * Fixed typo diff --git a/README.md b/README.md index c17d29d7..e7276a02 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ This section shows you the prerequisites you need to check for using Sendbird Ch The minimum requirements for Chat SDK for Flutter are: - Xcode or Android studio -- Dart 2.10.4 -- Flutter 1.22.x or higher +- Dart 2.10.4 or above +- Flutter 1.22.0 or higher ## Getting started diff --git a/example/main.dart b/example/main.dart index 0d943597..13b29d90 100644 --- a/example/main.dart +++ b/example/main.dart @@ -1,13 +1,14 @@ import 'package:sendbird_sdk/sendbird_sdk.dart'; void main(List arguments) async { - // This example uses the Google Books API to search for books about http. - // https://developers.google.com/books/docs/overview - + // create sendbird sdk instance with application id final sendbird = SendbirdSdk(appId: 'YOUR-APP-ID'); try { + // connect sendbird server with user id final user = await sendbird.connect('UNIQUE-USER-ID'); + + // generate group channel parameters final params = GroupChannelParams() ..userIds = [user.userId] ..operatorUserIds = [user.userId] @@ -18,6 +19,7 @@ void main(List arguments) async { // create group channel final channel = await GroupChannel.createChannel(params); + // send user message to the group channel channel.sendUserMessageWithText('Hello World', onCompleted: (message, error) { // message has been sent successfully diff --git a/lib/sdk/internal/sendbird_sdk_internal.dart b/lib/sdk/internal/sendbird_sdk_internal.dart index e7ef069b..66c70ac2 100644 --- a/lib/sdk/internal/sendbird_sdk_internal.dart +++ b/lib/sdk/internal/sendbird_sdk_internal.dart @@ -24,9 +24,8 @@ import 'package:sendbird_sdk/utils/async/async_queue.dart'; import 'package:sendbird_sdk/utils/logger.dart'; import 'package:sendbird_sdk/utils/parsers.dart'; -const sdk_version = '3.0.11'; +const sdk_version = '3.0.12'; const platform = 'flutter'; -const platform_version = '1.22.5'; /// Internal implementation for main class. Do not directly access this class. class SendbirdSdkInternal with WidgetsBindingObserver { @@ -206,11 +205,11 @@ class SendbirdSdkInternal with WidgetsBindingObserver { _onWebSocketError, ); + _sessionManager.setAccessToken(accessToken); + apiHost = reconnect ? _state.apiHost : apiHost ?? _getDefaultApiHost(); wsHost = reconnect ? _state.wsHost : wsHost ?? _getDefaultWsHost(); - _sessionManager.setAccessToken(accessToken); - _state ..reconnecting = reconnect ..wsHost = wsHost @@ -224,7 +223,7 @@ class SendbirdSdkInternal with WidgetsBindingObserver { var params = { 'p': platform, - 'pv': platform_version, + 'pv': Platform.version.split(' ').first, 'o': Platform.operatingSystem, // os 'ov': Platform.operatingSystemVersion, // os version 'sv': sdk_version, diff --git a/lib/sdk/sendbird_sdk_api.dart b/lib/sdk/sendbird_sdk_api.dart index 638d82f7..0061d79d 100644 --- a/lib/sdk/sendbird_sdk_api.dart +++ b/lib/sdk/sendbird_sdk_api.dart @@ -38,13 +38,12 @@ class SendbirdSdk { }) { if (_instance != null && (appId == null || appId == _instance._int?.state?.appId)) { - _instance.setOptions(options); return _instance; } // initialize with different app id, so logout and // reinitialize internal obj - _instance._int?.logout(); + _instance = SendbirdSdk._instanceFunction(); _instance._int = SendbirdSdkInternal( appId: appId, apiToken: apiToken, diff --git a/lib/services/network/http_client.dart b/lib/services/network/http_client.dart index c8b3d3e0..ff11cb12 100644 --- a/lib/services/network/http_client.dart +++ b/lib/services/network/http_client.dart @@ -189,12 +189,14 @@ class HttpClient { body.forEach((key, value) { if (value is FileInfo) { - request.files.add(http.MultipartFile.fromBytes( + final part = http.MultipartFile( key, - value.file.readAsBytesSync(), + value.file.openRead(), + value.file.lengthSync(), filename: value.name, contentType: MediaType.parse(value.mimeType), - )); + ); + request.files.add(part); } else if (value is List) { request.fields[key] = value.join(','); } else if (value is List) { diff --git a/pubspec.yaml b/pubspec.yaml index 85891ed1..29caf4fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: sendbird_sdk description: The Flutter SDK for Sendbird Chat brings modern messenger chat features to your iOS and Android deployments.. -version: 3.0.11 +version: 3.0.12 homepage: https://www.sendbird.com repository: https://www.github.com/sendbird/sendbird-sdk-flutter documentation: https://sendbird.com/docs/chat/v3/flutter/getting-started/about-chat-sdk