Merge branches 'feature/new-ui' and 'llc-independence' of https://github.com/GetStream/stream-chat-flutter into llc-independence
Conflicts: packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 0.2.24+2
|
||||||
|
|
||||||
|
- Fix reconnection bug while using tokenProvider
|
||||||
|
|
||||||
## 0.2.24+1
|
## 0.2.24+1
|
||||||
|
|
||||||
- Stop ws reconnection after calling disconnect
|
- Stop ws reconnection after calling disconnect
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ import 'package:stream_chat/src/client.dart';
|
|||||||
|
|
||||||
/// Current package version
|
/// Current package version
|
||||||
/// Used in [Client] to build the `x-stream-client` header
|
/// Used in [Client] to build the `x-stream-client` header
|
||||||
const PACKAGE_VERSION = '0.2.24+1';
|
const PACKAGE_VERSION = '0.2.24+2';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: stream_chat
|
name: stream_chat
|
||||||
homepage: https://getstream.io/
|
homepage: https://getstream.io/
|
||||||
description: The official Dart client for Stream Chat, a service for building chat applications.
|
description: The official Dart client for Stream Chat, a service for building chat applications.
|
||||||
version: 0.2.24+1
|
version: 0.2.24+2
|
||||||
repository: https://github.com/GetStream/stream-chat-dart
|
repository: https://github.com/GetStream/stream-chat-dart
|
||||||
issue_tracker: https://github.com/GetStream/stream-chat-dart/issues
|
issue_tracker: https://github.com/GetStream/stream-chat-dart/issues
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'stream_chat_core.dart';
|
|||||||
/// [ChannelListCore] is a simplified class that allows fetching a list of channels while exposing UI builders.
|
/// [ChannelListCore] is a simplified class that allows fetching a list of channels while exposing UI builders.
|
||||||
/// A [ChannelListController] is used to reload and paginate data.
|
/// A [ChannelListController] is used to reload and paginate data.
|
||||||
///
|
///
|
||||||
|
///
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// class ChannelListPage extends StatelessWidget {
|
/// class ChannelListPage extends StatelessWidget {
|
||||||
/// @override
|
/// @override
|
||||||
@@ -50,20 +51,19 @@ import 'stream_chat_core.dart';
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
///
|
|
||||||
/// Make sure to have a [StreamChatCore] ancestor in order to provide the information about the channels.
|
/// Make sure to have a [StreamChatCore] ancestor in order to provide the information about the channels.
|
||||||
class ChannelListCore extends StatefulWidget {
|
class ChannelListCore extends StatefulWidget {
|
||||||
/// Instantiate a new ChannelListView
|
/// Instantiate a new ChannelListView
|
||||||
ChannelListCore({
|
ChannelListCore({
|
||||||
Key key,
|
Key key,
|
||||||
this.filter,
|
|
||||||
this.options,
|
|
||||||
this.sort,
|
|
||||||
this.pagination,
|
|
||||||
@required this.errorBuilder,
|
@required this.errorBuilder,
|
||||||
@required this.emptyBuilder,
|
@required this.emptyBuilder,
|
||||||
@required this.loadingBuilder,
|
@required this.loadingBuilder,
|
||||||
@required this.listBuilder,
|
@required this.listBuilder,
|
||||||
|
this.filter,
|
||||||
|
this.options,
|
||||||
|
this.sort,
|
||||||
|
this.pagination,
|
||||||
this.channelListController,
|
this.channelListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|||||||
@@ -27,25 +27,22 @@ import 'message_search_bloc.dart';
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
///
|
|
||||||
/// Make sure to have a [MessageSearchBloc] ancestor in order to provide the information about the messages.
|
/// Make sure to have a [MessageSearchBloc] ancestor in order to provide the information about the messages.
|
||||||
/// The widget uses a [ListView.separated] to render the list of messages.
|
/// The widget uses a [ListView.separated] to render the list of messages.
|
||||||
///
|
///
|
||||||
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
|
||||||
/// Modify it to change the widget appearance.
|
|
||||||
class MessageSearchListCore extends StatefulWidget {
|
class MessageSearchListCore extends StatefulWidget {
|
||||||
/// Instantiate a new MessageSearchListView
|
/// Instantiate a new MessageSearchListView
|
||||||
const MessageSearchListCore({
|
const MessageSearchListCore({
|
||||||
Key key,
|
Key key,
|
||||||
|
@required this.emptyBuilder,
|
||||||
|
@required this.errorBuilder,
|
||||||
|
@required this.loadingBuilder,
|
||||||
|
@required this.childBuilder,
|
||||||
this.messageQuery,
|
this.messageQuery,
|
||||||
this.filters,
|
this.filters,
|
||||||
this.sortOptions,
|
this.sortOptions,
|
||||||
this.paginationParams,
|
this.paginationParams,
|
||||||
this.messageFilters,
|
this.messageFilters,
|
||||||
@required this.emptyBuilder,
|
|
||||||
@required this.errorBuilder,
|
|
||||||
@required this.loadingBuilder,
|
|
||||||
@required this.childBuilder,
|
|
||||||
this.messageSearchListController,
|
this.messageSearchListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,14 @@ import 'package:stream_chat/stream_chat.dart';
|
|||||||
|
|
||||||
typedef EventHandler = void Function(Event event);
|
typedef EventHandler = void Function(Event event);
|
||||||
|
|
||||||
/// Widget used to provide information about the chat to the widget tree
|
/// Widget used to provide information about the chat to the widget tree.
|
||||||
|
/// This Widget is used to react to life cycle changes and system updates.
|
||||||
|
/// When the app goes into the background, the websocket connection is kept alive
|
||||||
|
/// for two minutes before being terminated.
|
||||||
///
|
///
|
||||||
|
/// Conversely, when app is resumed or restarted, a new connection is initiated.
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
/// class MyApp extends StatelessWidget {
|
/// class MyApp extends StatelessWidget {
|
||||||
/// final Client client;
|
/// final Client client;
|
||||||
///
|
///
|
||||||
@@ -17,7 +23,7 @@ typedef EventHandler = void Function(Event event);
|
|||||||
/// Widget build(BuildContext context) {
|
/// Widget build(BuildContext context) {
|
||||||
/// return MaterialApp(
|
/// return MaterialApp(
|
||||||
/// home: Container(
|
/// home: Container(
|
||||||
/// child: StreamChat(
|
/// child: StreamChatCore(
|
||||||
/// client: client,
|
/// client: client,
|
||||||
/// child: ChannelListPage(),
|
/// child: ChannelListPage(),
|
||||||
/// ),
|
/// ),
|
||||||
@@ -25,13 +31,14 @@ typedef EventHandler = void Function(Event event);
|
|||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// Use [StreamChatCore.of] to get the current [StreamChatCoreState] instance.
|
|
||||||
class StreamChatCore extends StatefulWidget {
|
class StreamChatCore extends StatefulWidget {
|
||||||
// ignore: public_member_api_docs
|
/// Instance of Stream Chat Client containing information about the current
|
||||||
|
/// application.
|
||||||
final Client client;
|
final Client client;
|
||||||
|
|
||||||
// ignore: public_member_api_docs
|
/// Widget descendant.
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
/// The amount of time that will pass before disconnecting the client in the background
|
/// The amount of time that will pass before disconnecting the client in the background
|
||||||
@@ -42,7 +49,10 @@ class StreamChatCore extends StatefulWidget {
|
|||||||
/// upon the [Event.type]
|
/// upon the [Event.type]
|
||||||
final EventHandler onBackgroundEventReceived;
|
final EventHandler onBackgroundEventReceived;
|
||||||
|
|
||||||
// ignore: public_member_api_docs
|
/// Constructor used for creating a new instance of [StreamChatCore].
|
||||||
|
///
|
||||||
|
/// [StreamChatCore] is a stateful widget which reacts to system events and updates
|
||||||
|
/// Stream's connection status accordingly.
|
||||||
StreamChatCore({
|
StreamChatCore({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.client,
|
@required this.client,
|
||||||
@@ -69,11 +79,12 @@ class StreamChatCore extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The current state of the StreamChat widget
|
/// State class associated with [StreamChatCore].
|
||||||
class StreamChatCoreState extends State<StreamChatCore>
|
class StreamChatCoreState extends State<StreamChatCore>
|
||||||
with WidgetsBindingObserver {
|
with WidgetsBindingObserver {
|
||||||
// ignore: public_member_api_docs
|
/// Initialized client used throughout the application.
|
||||||
Client get client => widget.client;
|
Client get client => widget.client;
|
||||||
|
|
||||||
Timer _disconnectTimer;
|
Timer _disconnectTimer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -47,25 +47,25 @@ import 'package:stream_chat_flutter_core/src/users_bloc.dart';
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// [UsersBloc] must be the ancestor of this widget. This is necessary since
|
||||||
|
/// [UserListCore] depends on functionality contained within [UsersBloc].
|
||||||
///
|
///
|
||||||
/// Make sure to have a [UsersBloc] ancestor in order to provide the information about the users.
|
|
||||||
/// The widget uses a [ListView.separated], [GridView.builder] to render the list, grid of channels.
|
/// The widget uses a [ListView.separated], [GridView.builder] to render the list, grid of channels.
|
||||||
///
|
/// The parameters [listBuilder], [loadingBuilder], [emptyBuilder] and [errorBuilder] must all be supplied
|
||||||
/// The widget components render the ui based on the first ancestor of type [StreamChatTheme].
|
/// and not null.
|
||||||
/// Modify it to change the widget appearance.
|
|
||||||
class UserListCore extends StatefulWidget {
|
class UserListCore extends StatefulWidget {
|
||||||
/// Instantiate a new UserListView
|
/// Instantiate a new [UserListCore]
|
||||||
const UserListCore({
|
const UserListCore({
|
||||||
Key key,
|
Key key,
|
||||||
|
@required this.errorBuilder,
|
||||||
|
@required this.emptyBuilder,
|
||||||
|
@required this.loadingBuilder,
|
||||||
|
@required this.listBuilder,
|
||||||
this.filter,
|
this.filter,
|
||||||
this.options,
|
this.options,
|
||||||
this.sort,
|
this.sort,
|
||||||
this.pagination,
|
this.pagination,
|
||||||
this.groupAlphabetically = false,
|
this.groupAlphabetically = false,
|
||||||
@required this.errorBuilder,
|
|
||||||
@required this.emptyBuilder,
|
|
||||||
@required this.loadingBuilder,
|
|
||||||
@required this.listBuilder,
|
|
||||||
this.userListController,
|
this.userListController,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@@ -138,9 +138,9 @@ class _UserListCoreState extends State<UserListCore>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final usersBloc = UsersBloc.of(context);
|
final _usersBloc = UsersBloc.of(context);
|
||||||
|
|
||||||
return _buildListView(usersBloc);
|
return _buildListView(_usersBloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isListAlreadySorted =>
|
bool get isListAlreadySorted =>
|
||||||
@@ -207,9 +207,9 @@ class _UserListCoreState extends State<UserListCore>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadData() {
|
void loadData() {
|
||||||
final usersBloc = UsersBloc.of(context);
|
final _usersBloc = UsersBloc.of(context);
|
||||||
|
|
||||||
usersBloc.queryUsers(
|
_usersBloc.queryUsers(
|
||||||
filter: widget.filter,
|
filter: widget.filter,
|
||||||
sort: widget.sort,
|
sort: widget.sort,
|
||||||
pagination: widget.pagination,
|
pagination: widget.pagination,
|
||||||
@@ -218,13 +218,13 @@ class _UserListCoreState extends State<UserListCore>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void paginateData() {
|
void paginateData() {
|
||||||
final usersBloc = UsersBloc.of(context);
|
final _usersBloc = UsersBloc.of(context);
|
||||||
|
|
||||||
usersBloc.queryUsers(
|
_usersBloc.queryUsers(
|
||||||
filter: widget.filter,
|
filter: widget.filter,
|
||||||
sort: widget.sort,
|
sort: widget.sort,
|
||||||
pagination: widget.pagination.copyWith(
|
pagination: widget.pagination.copyWith(
|
||||||
offset: usersBloc.users?.length ?? 0,
|
offset: _usersBloc.users?.length ?? 0,
|
||||||
),
|
),
|
||||||
options: widget.options,
|
options: widget.options,
|
||||||
);
|
);
|
||||||
@@ -249,7 +249,9 @@ class _UserListCoreState extends State<UserListCore>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: public_member_api_docs
|
/// Represents an item in a the user stream list.
|
||||||
|
/// Header items are prefixed with the key `HEADER` While users are prefixed with
|
||||||
|
/// `USER`.
|
||||||
abstract class ListItem {
|
abstract class ListItem {
|
||||||
// ignore: public_member_api_docs
|
// ignore: public_member_api_docs
|
||||||
String get key {
|
String get key {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:stream_chat/stream_chat.dart';
|
|||||||
|
|
||||||
import 'stream_chat_core.dart';
|
import 'stream_chat_core.dart';
|
||||||
|
|
||||||
/// Widget dedicated to the management of a users list with pagination
|
/// Widget dedicated to the management of a users list with pagination.
|
||||||
class UsersBloc extends StatefulWidget {
|
class UsersBloc extends StatefulWidget {
|
||||||
/// The widget child
|
/// The widget child
|
||||||
final Widget child;
|
final Widget child;
|
||||||
@@ -49,7 +49,9 @@ class UsersBlocState extends State<UsersBloc>
|
|||||||
/// The stream notifying the state of queryUsers call
|
/// The stream notifying the state of queryUsers call
|
||||||
Stream<bool> get queryUsersLoading => _queryUsersLoadingController.stream;
|
Stream<bool> get queryUsersLoading => _queryUsersLoadingController.stream;
|
||||||
|
|
||||||
/// Calls [Client.queryUsers] updating [queryUsersLoading] stream
|
/// The Query Users method allows you to search for users and see if they are
|
||||||
|
/// online/offline.
|
||||||
|
/// [API Reference](https://getstream.io/chat/docs/flutter-dart/query_users/?language=dart)
|
||||||
Future<void> queryUsers({
|
Future<void> queryUsers({
|
||||||
Map<String, dynamic> filter,
|
Map<String, dynamic> filter,
|
||||||
List<SortOption> sort,
|
List<SortOption> sort,
|
||||||
|
|||||||
Reference in New Issue
Block a user