fix channels query
This commit is contained in:
@@ -51,7 +51,7 @@ class MyApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.light(),
|
theme: ThemeData.light(),
|
||||||
darkTheme: ThemeData.dark(),
|
darkTheme: ThemeData.dark(),
|
||||||
themeMode: ThemeMode.dark,
|
themeMode: ThemeMode.system,
|
||||||
home: Container(
|
home: Container(
|
||||||
child: StreamChat(
|
child: StreamChat(
|
||||||
client: client,
|
client: client,
|
||||||
@@ -99,6 +99,7 @@ class ChannelPage extends StatelessWidget {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
MessageListView(
|
MessageListView(
|
||||||
|
showVideoFullScreen: false,
|
||||||
threadBuilder: (_, parentMessage) {
|
threadBuilder: (_, parentMessage) {
|
||||||
return ThreadPage(
|
return ThreadPage(
|
||||||
parent: parentMessage,
|
parent: parentMessage,
|
||||||
|
|||||||
@@ -326,7 +326,8 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
|
|
||||||
void _listenChannelPagination(ChannelsBlocState channelsProvider) {
|
void _listenChannelPagination(ChannelsBlocState channelsProvider) {
|
||||||
if (_scrollController.position.maxScrollExtent ==
|
if (_scrollController.position.maxScrollExtent ==
|
||||||
_scrollController.offset) {
|
_scrollController.offset &&
|
||||||
|
_scrollController.offset != 0) {
|
||||||
channelsProvider.queryChannels(
|
channelsProvider.queryChannels(
|
||||||
filter: widget.filter,
|
filter: widget.filter,
|
||||||
sortOptions: widget.sort,
|
sortOptions: widget.sort,
|
||||||
@@ -342,11 +343,11 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
final channelsProvider = ChannelsBloc.of(context);
|
final channelsBloc = ChannelsBloc.of(context);
|
||||||
|
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
channelsProvider.queryChannels(
|
channelsBloc.queryChannels(
|
||||||
filter: widget.filter,
|
filter: widget.filter,
|
||||||
sortOptions: widget.sort,
|
sortOptions: widget.sort,
|
||||||
paginationParams: widget.pagination,
|
paginationParams: widget.pagination,
|
||||||
@@ -354,7 +355,11 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
);
|
);
|
||||||
|
|
||||||
_scrollController.addListener(() {
|
_scrollController.addListener(() {
|
||||||
_listenChannelPagination(channelsProvider);
|
channelsBloc.queryChannelsLoading.first.then((loading) {
|
||||||
|
if (!loading) {
|
||||||
|
_listenChannelPagination(channelsBloc);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,14 +194,16 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
|
|||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
if (state == AppLifecycleState.paused) {
|
if (state == AppLifecycleState.paused) {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
_newMessageSubscription =
|
if (client.pushNotificationsEnabled) {
|
||||||
client.on(EventType.messageNew).listen((event) {
|
_newMessageSubscription =
|
||||||
client.androidNotificationHandler({
|
client.on(EventType.messageNew).listen((event) {
|
||||||
'data': {
|
client.androidNotificationHandler({
|
||||||
'message_id': event.message.id,
|
'data': {
|
||||||
},
|
'message_id': event.message.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
_disconnectTimer = Timer(Duration(minutes: 1), () {
|
_disconnectTimer = Timer(Duration(minutes: 1), () {
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
@@ -214,7 +216,9 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
|
|||||||
_disconnectTimer.cancel();
|
_disconnectTimer.cancel();
|
||||||
} else {
|
} else {
|
||||||
if (client.wsConnectionStatus.value == ConnectionStatus.disconnected) {
|
if (client.wsConnectionStatus.value == ConnectionStatus.disconnected) {
|
||||||
NotificationService.handleIosMessageQueue(client);
|
if (client.pushNotificationsEnabled) {
|
||||||
|
NotificationService.handleIosMessageQueue(client);
|
||||||
|
}
|
||||||
client.connect();
|
client.connect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user