fix offline user connection, add tests

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-06-18 16:10:34 +05:30
parent 0fcea3f546
commit 675bffe7b9
3 changed files with 129 additions and 1 deletions
@@ -289,7 +289,7 @@ class StreamChatClient {
final event = await openConnection();
return event;
} catch (e, stk) {
if (e is StreamChatNetworkError && e.isRetriable) {
if (e is StreamWebSocketError && e.isRetriable) {
final event = await _chatPersistenceClient?.getConnectionInfo();
if (event != null) return event;
}
@@ -45,6 +45,9 @@ class StreamWebSocketError extends StreamChatError {
/// Response body. please refer to [ErrorResponse].
final ErrorResponse? data;
///
bool get isRetriable => data == null;
@override
List<Object?> get props => [...super.props, code];