Merge pull request #414 from GetStream/hotfix/channelsBlocQuery

fix: channels bloc does not perform the call if pagination ended
This commit is contained in:
Salvatore Giordano
2021-05-05 15:57:40 +02:00
committed by GitHub
5 changed files with 22 additions and 8 deletions
@@ -1,3 +1,7 @@
## 1.5.4
- Updated `stream_chat_core` dependency
## 1.5.3
- Updated `stream_chat_core` dependency
+2 -2
View File
@@ -1,7 +1,7 @@
name: stream_chat_flutter
homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
version: 1.5.3
version: 1.5.4
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -11,7 +11,7 @@ environment:
dependencies:
flutter:
sdk: flutter
stream_chat_flutter_core: ^1.5.2
stream_chat_flutter_core: ^1.5.3
photo_view: ^0.11.0
rxdart: ^0.25.0
scrollable_positioned_list: ^0.1.8
@@ -1,3 +1,7 @@
## 1.5.3
* Fix ChannelsBloc not performing calls if pagination ended
## 1.5.2
* Update llc dependency
@@ -95,7 +95,12 @@ class ChannelsBlocState extends State<ChannelsBloc>
}) async {
final client = StreamChatCore.of(context).client;
if (_paginationEnded || _queryChannelsLoadingController.value == true) {
final clear = paginationParams == null ||
paginationParams.offset == null ||
paginationParams.offset == 0;
if ((!clear && _paginationEnded) ||
_queryChannelsLoadingController.value == true) {
return;
}
@@ -104,9 +109,6 @@ class ChannelsBlocState extends State<ChannelsBloc>
}
try {
final clear = paginationParams == null ||
paginationParams.offset == null ||
paginationParams.offset == 0;
final oldChannels = List<Channel>.from(channels ?? []);
var newChannels = <Channel>[];
await for (final channels in client.queryChannels(
@@ -148,7 +150,11 @@ class ChannelsBlocState extends State<ChannelsBloc>
final client = StreamChatCore.of(context).client;
if (!widget.lockChannelsOrder) {
_subscriptions.add(client.on(EventType.messageNew).listen((e) {
_subscriptions.add(client
.on(
EventType.messageNew,
)
.listen((e) {
final newChannels = List<Channel>.from(channels ?? []);
final index = newChannels.indexWhere((c) => c.cid == e.cid);
if (index != -1) {
@@ -1,7 +1,7 @@
name: stream_chat_flutter_core
homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK Core. Build your own chat experience using Dart and Flutter.
version: 1.5.2
version: 1.5.3
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues