This commit is contained in:
Salvatore Giordano
2021-11-03 13:12:39 +01:00
parent 55e4c1ebd5
commit 63e5eb0a24
3 changed files with 7 additions and 31 deletions
-22
View File
@@ -4,25 +4,3 @@ import 'package:stream_chat/src/client/client.dart';
/// Used in [StreamChatClient] to build the `x-stream-client` header
// ignore: constant_identifier_names
const PACKAGE_VERSION = '3.2.0';
/// Possible packages
enum Package {
/// The Low Level Client
llc,
/// The Core package
core,
/// The UI package
ui,
}
///
extension XPackage on Package {
///
String get name => {
Package.llc: 'llc',
Package.core: 'core',
Package.ui: 'ui',
}[this]!;
}
@@ -115,7 +115,7 @@ class StreamChatState extends State<StreamChat> {
builder: (context) {
StreamChatClient.additionalHeaders = {
'X-Stream-Client':
'${StreamChatClient.defaultUserAgent}-${Package.ui}',
'${StreamChatClient.defaultUserAgent}-ui',
};
return widget.child ?? const Offstage();
},
@@ -90,20 +90,18 @@ class StreamChatCore extends StatefulWidget {
/// State class associated with [StreamChatCore].
class StreamChatCoreState extends State<StreamChatCore>
with WidgetsBindingObserver {
/// Constructor used for creating a new instance of [StreamChatCoreState].
StreamChatCoreState() {
StreamChatClient.additionalHeaders = {
'X-Stream-Client': '${StreamChatClient.defaultUserAgent}-${Package.ui}',
};
}
/// Initialized client used throughout the application.
StreamChatClient get client => widget.client;
Timer? _disconnectTimer;
@override
Widget build(BuildContext context) => widget.child;
Widget build(BuildContext context) {
StreamChatClient.additionalHeaders = {
'X-Stream-Client': '${StreamChatClient.defaultUserAgent}-ui',
};
return widget.child;
}
// coverage:ignore-start