fix(llc, core): fix message pagination parameters
This commit is contained in:
@@ -322,7 +322,7 @@ class _PagedValueListViewState<K, V> extends State<PagedValueListView<K, V>> {
|
||||
index == newPageRequestTriggerIndex;
|
||||
if (nextPageKey != null && isBuildingTriggerIndexItem) {
|
||||
// Schedules the request for the end of this frame.
|
||||
WidgetsBinding.instance?.addPostFrameCallback((_) async {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
if (error == null) {
|
||||
await _controller.loadMore(nextPageKey);
|
||||
}
|
||||
@@ -678,7 +678,7 @@ class _PagedValueGridViewState<K, V> extends State<PagedValueGridView<K, V>> {
|
||||
index == newPageRequestTriggerIndex;
|
||||
if (nextPageKey != null && isBuildingTriggerIndexItem) {
|
||||
// Schedules the request for the end of this frame.
|
||||
WidgetsBinding.instance?.addPostFrameCallback((_) async {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
if (error == null) {
|
||||
await _controller.loadMore(nextPageKey);
|
||||
}
|
||||
|
||||
@@ -220,21 +220,20 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
/// Loads channel at specific message
|
||||
Future<void> loadChannelAtMessage(
|
||||
String? messageId, {
|
||||
int before = 20,
|
||||
int after = 20,
|
||||
@Deprecated('before is deprecated, use limit instead') int before = 20,
|
||||
@Deprecated('before is deprecated, use limit instead') int after = 20,
|
||||
int limit = 20,
|
||||
bool preferOffline = false,
|
||||
}) =>
|
||||
_queryAtMessage(
|
||||
messageId: messageId,
|
||||
before: before,
|
||||
after: after,
|
||||
limit: limit,
|
||||
preferOffline: preferOffline,
|
||||
);
|
||||
|
||||
Future<ChannelState?> _queryAtMessage({
|
||||
String? messageId,
|
||||
int before = 20,
|
||||
int after = 20,
|
||||
int limit = 20,
|
||||
bool preferOffline = false,
|
||||
}) async {
|
||||
if (channel.state == null) return null;
|
||||
@@ -244,7 +243,7 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
if (messageId == null) {
|
||||
await channel.query(
|
||||
messagesPagination: PaginationParams(
|
||||
limit: before,
|
||||
limit: limit,
|
||||
),
|
||||
preferOffline: preferOffline,
|
||||
);
|
||||
@@ -254,8 +253,7 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
|
||||
return queryAroundMessage(
|
||||
messageId,
|
||||
before: before,
|
||||
after: after,
|
||||
limit: limit,
|
||||
preferOffline: preferOffline,
|
||||
);
|
||||
}
|
||||
@@ -263,15 +261,15 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
///
|
||||
Future<ChannelState> queryAroundMessage(
|
||||
String messageId, {
|
||||
int before = 20,
|
||||
int after = 20,
|
||||
@Deprecated('before is deprecated, use limit instead') int before = 20,
|
||||
@Deprecated('after is deprecated, use limit instead') int after = 20,
|
||||
int limit = 20,
|
||||
bool preferOffline = false,
|
||||
}) =>
|
||||
channel.query(
|
||||
messagesPagination: PaginationParams(
|
||||
idAround: messageId,
|
||||
before: before,
|
||||
after: after,
|
||||
limit: limit,
|
||||
),
|
||||
preferOffline: preferOffline,
|
||||
);
|
||||
@@ -338,7 +336,7 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
}
|
||||
|
||||
/// Reloads the channel with latest message
|
||||
Future<void> reloadChannel() => _queryAtMessage(before: 30);
|
||||
Future<void> reloadChannel() => _queryAtMessage(limit: 30);
|
||||
|
||||
late List<Future<bool>> _futures;
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class StreamChatCoreState extends State<StreamChatCore>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance?.addObserver(this);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_subscribeToConnectivityChange(widget.connectivityStream);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ class StreamChatCoreState extends State<StreamChatCore>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance?.removeObserver(this);
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_unsubscribeFromConnectivityChange();
|
||||
_eventSubscription?.cancel();
|
||||
_disconnectTimer?.cancel();
|
||||
|
||||
Reference in New Issue
Block a user