Skip to content

Commit

Permalink
4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sf-tyler-jeong committed Jun 23, 2023
1 parent 2fa3479 commit 8f5e7c4
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 169 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v4.0.2 (Jun 23, 2023)
- Improved stability.

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

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Find out more about Sendbird Chat for Flutter on [the documentation](https://st.
## Requirements

The minimum requirements for the Chat SDK for Flutter are:
- Dart 2.17.0 or later
- Flutter 2.11.0 or later
- Dart 2.19.0 or later
- Flutter 3.7.0 or later

> **Note**: Sendbird server supports Transport Layer Security (TLS) from version 1.0 up to 1.3. For example, in the server regions where TLS 1.3 isn’t available, lower versions, sequentially from 1.2 to 1.0, will be supported for secure data transmission.
Expand All @@ -48,7 +48,7 @@ Before installing Sendbird Chat SDK, you need to create a Sendbird application o

```yaml
dependencies:
sendbird_chat_sdk: ^4.0.0
sendbird_chat_sdk: ^4.0.2
```
- Run `flutter pub get` command in your project directory.
Expand Down
26 changes: 0 additions & 26 deletions analysis_options.yaml

This file was deleted.

72 changes: 34 additions & 38 deletions lib/src/internal/main/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ part 'chat_event_handler.dart';
part 'chat_push.dart';
part 'chat_user.dart';

const sdkVersion = '4.0.1';
const sdkVersion = '4.0.2';

// Internal implementation for main class. Do not directly access this class.
class Chat with WidgetsBindingObserver {
Expand Down Expand Up @@ -170,43 +170,39 @@ class Chat with WidgetsBindingObserver {

if (!isTest) {
Connectivity().onConnectivityChanged.asBroadcastStream(
onCancel: (controller) => {
_connectivityResult = ConnectivityResult.none,
controller.pause(),
},
onListen: (subscription) {
subscription.onData((data) async {
switch (data) {
case ConnectivityResult.none:
break;
case ConnectivityResult.mobile:
if (_connectivityResult == ConnectivityResult.none &&
chatContext.sessionKey != null) {
await connectionManager.reconnect(reset: true);
}
break;
case ConnectivityResult.wifi:
if (_connectivityResult == ConnectivityResult.none &&
chatContext.sessionKey != null) {
await connectionManager.reconnect(reset: true);
}
break;
case ConnectivityResult.bluetooth:
case ConnectivityResult.ethernet:
if (_connectivityResult == ConnectivityResult.none &&
chatContext.sessionKey != null) {
await connectionManager.reconnect(reset: true);
}
break;
case ConnectivityResult.vpn:
break;
default:
break;
}
_connectivityResult = data;
});
},
);
onCancel: (controller) => {
_connectivityResult = ConnectivityResult.none,
controller.pause(),
},
onListen: (subscription) {
subscription.onData((data) async {
switch (data) {
case ConnectivityResult.none:
sbLog.d(StackTrace.current, 'ConnectivityResult.none');
channelCache.markAsDirtyAll(); // Check
break;
case ConnectivityResult.mobile:
case ConnectivityResult.wifi:
case ConnectivityResult.ethernet:
case ConnectivityResult.vpn:
case ConnectivityResult.other:
sbLog.d(
StackTrace.current, '${data.toString()} => reconnect()');
if (_connectivityResult == ConnectivityResult.none &&
chatContext.sessionKey != null) {
await connectionManager.reconnect(reset: true);
}
break;
case ConnectivityResult.bluetooth:
sbLog.d(StackTrace.current, 'ConnectivityResult.bluetooth');
break;
default:
sbLog.d(StackTrace.current, data.toString());
break;
}
_connectivityResult = data;
});
});
}
}

Expand Down
10 changes: 7 additions & 3 deletions lib/src/internal/main/chat_manager/command_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ class CommandManager {
}

Future<void> processCommand(Command cmd) async {
sbLog.d(StackTrace.current,
'\n-[cmd] ${cmd.cmd}\n-[payload] ${jsonEncoder.convert(cmd.payload)}');
if (cmd.payload['cmd'] == null || cmd.payload['cmd'] != 'PONG') {
sbLog.d(StackTrace.current,
'\n-[cmd] ${cmd.cmd}\n-[payload] ${jsonEncoder.convert(cmd.payload)}');
}

final unreadCountPayload = cmd.payload['unread_cnt'];
if (unreadCountPayload != null) {
Expand Down Expand Up @@ -180,7 +182,9 @@ class CommandManager {
} else if (cmd.isVote) {
await _processVote(cmd);
} else {
sbLog.i(StackTrace.current, 'Pass command: ${cmd.cmd}');
if (cmd.cmd != 'PONG') {
sbLog.i(StackTrace.current, 'Pass command: ${cmd.cmd}');
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/src/internal/main/logger/sendbird_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class SendbirdLogger {
Logger logger;

static final _instance = SendbirdLogger._();
SendbirdLogger._() : logger = Logger(level: Level.nothing);
SendbirdLogger._() : logger = Logger(level: Level.nothing) {
_setLogLevel(Level.nothing);
}
factory SendbirdLogger() => _instance;

void setLogLevel(LogLevel level) {
Expand Down
1 change: 1 addition & 0 deletions lib/src/internal/main/utils/async/async_queue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class AsyncQueue<T> {
}
} catch (e) {
sbLog.e(StackTrace.current, 'e: $e');
rethrow;
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions lib/src/internal/network/websocket/websocket_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ class WebSocketClient {
}

void send(String data) {
if (!_isConnected) {
throw WebSocketFailedException();
}

try {
if (_isConnected) {
_webSocketChannel?.sink.add(data);
}
_webSocketChannel?.sink.add(data);
} catch (e) {
sbLog.e(StackTrace.current, 'e: $e');
throw WebSocketFailedException(message: e.toString());
Expand Down
3 changes: 3 additions & 0 deletions lib/src/public/core/channel/base_channel/base_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,8 @@ abstract class BaseChannel implements Cacheable {
customType = others.customType;
isFrozen = others.isFrozen;
isEphemeral = others.isEphemeral;

fromCache = others.fromCache;
dirty = others.dirty;
}
}
Loading

0 comments on commit 8f5e7c4

Please sign in to comment.