fixes #413: channels bloc does not perform the call if pagination is ended
This commit is contained in:
@@ -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,13 @@ 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,
|
||||
EventType.notificationAddedToChannel,
|
||||
EventType.notificationMessageNew,
|
||||
)
|
||||
.listen((e) {
|
||||
final newChannels = List<Channel>.from(channels ?? []);
|
||||
final index = newChannels.indexWhere((c) => c.cid == e.cid);
|
||||
if (index != -1) {
|
||||
|
||||
Reference in New Issue
Block a user