Skip to content

Commit

Permalink
Fixed minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
intoxicated committed Apr 29, 2021
1 parent 91ff5e9 commit d41b00e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions example/main.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'package:sendbird_sdk/sendbird_sdk.dart';

void main(List<String> 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]
Expand All @@ -18,6 +19,7 @@ void main(List<String> 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
Expand Down
9 changes: 4 additions & 5 deletions lib/sdk/internal/sendbird_sdk_internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions lib/sdk/sendbird_sdk_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions lib/services/network/http_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>) {
request.fields[key] = value.join(',');
} else if (value is List) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d41b00e

Please sign in to comment.