fix reconnection event
This commit is contained in:
@@ -425,7 +425,8 @@ class StreamChatClient {
|
|||||||
online: status == ConnectionStatus.connected,
|
online: status == ConnectionStatus.connected,
|
||||||
));
|
));
|
||||||
|
|
||||||
if (currentState == ConnectionStatus.connected) {
|
if (currentState == ConnectionStatus.connected &&
|
||||||
|
previousState != ConnectionStatus.connected) {
|
||||||
// connection recovered
|
// connection recovered
|
||||||
final cids = state.channels.keys.toList(growable: false);
|
final cids = state.channels.keys.toList(growable: false);
|
||||||
if (cids.isNotEmpty) {
|
if (cids.isNotEmpty) {
|
||||||
@@ -437,12 +438,10 @@ class StreamChatClient {
|
|||||||
await sync(cids: cids, lastSyncAt: _lastSyncedAt);
|
await sync(cids: cids, lastSyncAt: _lastSyncedAt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (previousState != ConnectionStatus.connected) {
|
handleEvent(Event(
|
||||||
handleEvent(Event(
|
type: EventType.connectionRecovered,
|
||||||
type: EventType.connectionRecovered,
|
online: true,
|
||||||
online: true,
|
));
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user