From 80870a8390944147c6b5479c51bfa8cea6005668 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Mon, 22 Jul 2024 11:26:06 +0200 Subject: [PATCH] release: changes for 8.0 release (#1984) * changes for 8.0 release * added guide for migration to v8 * correct link for v8 migration guide * check correctly for no connectivity * fix tests accounting for connectivity plus --- README.md | 25 +----- .../08-migrations/migration_guide_8_0.mdx | 57 ++++++++++++++ .../ios/Flutter/AppFrameworkInfo.plist | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 8 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../lib/src/gallery/gallery_footer.dart | 2 + .../lib/src/gallery/gallery_header.dart | 2 + .../lib/src/stream_chat.dart | 77 ++++++++----------- packages/stream_chat_flutter/pubspec.yaml | 4 +- .../test/src/avatars/group_avatar_test.dart | 2 +- .../edit_message_sheet_test.dart | 2 +- .../bottom_sheets/error_alert_sheet_test.dart | 2 +- .../test/src/gallery/gallery_footer_test.dart | 2 +- .../test/src/gallery/gallery_header_test.dart | 2 +- .../message_widget/deleted_message_test.dart | 6 +- .../src/message_widget/message_text_test.dart | 2 +- .../test/src/misc/reaction_bubble_test.dart | 10 +-- .../test/src/misc/system_message_test.dart | 4 +- .../lib/src/stream_chat_core.dart | 8 +- .../stream_chat_flutter_core/pubspec.yaml | 2 +- .../test/stream_chat_core_test.dart | 22 +++--- 21 files changed, 137 insertions(+), 106 deletions(-) create mode 100644 docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_8_0.mdx diff --git a/README.md b/README.md index 496cba777..1ed64d7b5 100644 --- a/README.md +++ b/README.md @@ -16,28 +16,9 @@ This repository contains code for our [Dart](https://dart.dev/) and [Flutter](ht Stream allows developers to rapidly deploy scalable feeds and chat messaging with an industry leading 99.999% uptime SLA guarantee. -**V4 Migration Guide** - -> [!WARNING] -> Flutter `> = v3.16.x` uses material 3 by default which breaks the UI of some of the components. -> If you want to use these versions, you need to set the `useMaterial3` parameter to `false` -> in the `ThemeData`. -> -> eg. -> -> ```dart -> MaterialApp( -> theme: ThemeData( -> useMaterial3: false, -> ), -> ... -> ); -> ``` -> -> `StreamChat` widget overrides the `useMaterial3` parameter to `false` by default -> so if you are using `StreamChat` widget, you **don't** need to set it manually. - -For upgrading from V6 to V7, please refer to the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_7_0/) +**V8 Migration Guide** + +For upgrading from V7 to V8, please refer to the [V8 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_8_0/) ## Sample apps and demos Our team maintains a dedicated repository for full fledged sample applications and demos. Consider checking out [GetStream/flutter-samples](https://github.com/GetStream/flutter-samples) to learn more or get started by looking at our latest [Stream Chat demo](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). diff --git a/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_8_0.mdx b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_8_0.mdx new file mode 100644 index 000000000..e8f97bfc3 --- /dev/null +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_8_0.mdx @@ -0,0 +1,57 @@ +--- +id: migration_guide_8_0 +title: v8.0 +slug: /guides/migration_guide_8_0/ +--- + +This guide enumerates and better explains the SDK changes introduced in v8. + +If you find any bugs or have any questions, please file an [issue on our GitHub repository](https://github.com/GetStream/stream-chat-flutter/issues). We want to support you as much as we can with this migration. + +Code examples: + +- See our [Stream Chat Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) for an up-to-date guide using the latest Stream Chat version. +- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our full fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). + +Our documentation has also been updated to support v8, so all guides and examples will have updated code. + +### Dependencies + +To migrate to v8.0.0, update your `pubspec.yaml` with the correct Stream chat package you're using: + +```yaml +dependencies: + stream_chat_flutter: ^8.0.0 # full UI, core and client packages + stream_chat: ^8.0.0 # client package +``` + +--- + +## Important notes + +- The package from recent versions has been restricted to Flutter 3.19+ as we generally aim to support +the latest and the previous version of Flutter when possible. + +- The `attachmentBuilders` parameter in the `StreamMessageListView` now only expect custom attachments +and does not need the default attachment builders. You can also use `StreamAttachmentWidgetBuilder.defaultBuilders` +to add the default builders if necessary. + +## Breaking changes + +Version 8.0 has two main breaking changes. + +### Removal of the `useMaterial3` flag + +In v7, we introduced a temporary `useMaterial3` flag that allows users to optionally use Material3 styling in Stream components. +This was necessary at the time for various reasons. + +However, this flag is now removed and Material3 will be the default styling for all components. + +### Connectivity stream changes + +While this is a not directly a user-facing change, it is added here for completeness of the list. + +The `StreamChat` widget has a `connectivityStream` parameter to allow testing of various scenarios. +Due to changes in the relevant package, it was necessary to change the type of the stream from +`Stream?` to `Stream>?`. + diff --git a/packages/stream_chat_flutter/example/ios/Flutter/AppFrameworkInfo.plist b/packages/stream_chat_flutter/example/ios/Flutter/AppFrameworkInfo.plist index 4f8d4d245..8c6e56146 100644 --- a/packages/stream_chat_flutter/example/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/stream_chat_flutter/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj index 8022e694b..d298573ce 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -155,7 +155,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -342,7 +342,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -428,7 +428,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -477,7 +477,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index b52b2e698..e67b2808a 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { context: context, removeTop: true, child: BottomAppBar( + surfaceTintColor: + widget.backgroundColor ?? galleryFooterThemeData.backgroundColor, color: widget.backgroundColor ?? galleryFooterThemeData.backgroundColor, child: Row( diff --git a/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart b/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart index ac8b811d9..024537861 100644 --- a/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart +++ b/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart @@ -95,6 +95,8 @@ class StreamGalleryHeader extends StatelessWidget onPressed: onBackPressed, ) : const SizedBox(), + surfaceTintColor: + backgroundColor ?? galleryHeaderThemeData.backgroundColor, backgroundColor: backgroundColor ?? galleryHeaderThemeData.backgroundColor, actions: [ diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index 6365bb8ba..cb3547270 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -39,7 +39,6 @@ class StreamChat extends StatefulWidget { this.onBackgroundEventReceived, this.backgroundKeepAlive = const Duration(minutes: 1), this.connectivityStream, - this.useMaterial3 = false, }); /// Client to do chat operations with @@ -66,11 +65,7 @@ class StreamChat extends StatefulWidget { /// Stream of connectivity result /// Visible for testing @visibleForTesting - final Stream? connectivityStream; - - /// Whether to use material 3 or not (default is false) - /// See our [docs](https://getstream.io/chat/docs/sdk/flutter/stream_chat_flutter/stream_chat_and_theming) - final bool useMaterial3; + final Stream>? connectivityStream; @override StreamChatState createState() => StreamChatState(); @@ -112,46 +107,40 @@ class StreamChatState extends State { @override Widget build(BuildContext context) { final theme = _getTheme(context, widget.streamChatThemeData); - return Theme( - data: Theme.of(context).copyWith( - // ignore: deprecated_member_use - useMaterial3: widget.useMaterial3, - ), - child: Portal( - child: StreamChatConfiguration( - data: streamChatConfigData, - child: StreamChatTheme( - data: theme, - child: Builder( - builder: (context) { - final materialTheme = Theme.of(context); - final streamTheme = StreamChatTheme.of(context); - return Theme( - data: materialTheme.copyWith( - primaryIconTheme: streamTheme.primaryIconTheme, - colorScheme: materialTheme.colorScheme.copyWith( - secondary: streamTheme.colorTheme.accentPrimary, - ), + return Portal( + child: StreamChatConfiguration( + data: streamChatConfigData, + child: StreamChatTheme( + data: theme, + child: Builder( + builder: (context) { + final materialTheme = Theme.of(context); + final streamTheme = StreamChatTheme.of(context); + return Theme( + data: materialTheme.copyWith( + primaryIconTheme: streamTheme.primaryIconTheme, + colorScheme: materialTheme.colorScheme.copyWith( + secondary: streamTheme.colorTheme.accentPrimary, ), - child: StreamChatCore( - client: client, - onBackgroundEventReceived: widget.onBackgroundEventReceived, - backgroundKeepAlive: widget.backgroundKeepAlive, - connectivityStream: widget.connectivityStream, - child: Builder( - builder: (context) { - StreamChatClient.additionalHeaders = { - 'X-Stream-Client': - '${StreamChatClient.defaultUserAgent}-' - 'ui-${StreamChatClient.packageVersion}', - }; - return widget.child ?? const Offstage(); - }, - ), + ), + child: StreamChatCore( + client: client, + onBackgroundEventReceived: widget.onBackgroundEventReceived, + backgroundKeepAlive: widget.backgroundKeepAlive, + connectivityStream: widget.connectivityStream, + child: Builder( + builder: (context) { + StreamChatClient.additionalHeaders = { + 'X-Stream-Client': + '${StreamChatClient.defaultUserAgent}-' + 'ui-${StreamChatClient.packageVersion}', + }; + return widget.child ?? const Offstage(); + }, ), - ); - }, - ), + ), + ); + }, ), ), ), diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index dc54f3626..f024e46f3 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: image_size_getter: ^2.1.3 jiffy: ^6.2.1 just_audio: ^0.9.38 - lottie: ">=2.6.0 <4.0.0" + lottie: ^3.1.2 media_kit: ^1.1.10+1 media_kit_video: ^1.2.4 meta: ^1.9.1 @@ -39,7 +39,7 @@ dependencies: photo_manager: ^3.2.0 photo_view: ^0.15.0 rxdart: ^0.27.7 - share_plus: ">=8.0.2 <10.0.0" + share_plus: ^8.0.3 shimmer: ^3.0.0 stream_chat_flutter_core: ^7.3.0 synchronized: ^3.1.0+1 diff --git a/packages/stream_chat_flutter/test/src/avatars/group_avatar_test.dart b/packages/stream_chat_flutter/test/src/avatars/group_avatar_test.dart index 9082f6a43..5dae8417c 100644 --- a/packages/stream_chat_flutter/test/src/avatars/group_avatar_test.dart +++ b/packages/stream_chat_flutter/test/src/avatars/group_avatar_test.dart @@ -50,7 +50,7 @@ void main() { .instance.defaultBinaryMessenger .handlePlatformMessage( methodChannel.name, - methodChannel.codec.encodeSuccessEnvelope('wifi'), + methodChannel.codec.encodeSuccessEnvelope(['wifi']), (_) {}, ); } catch (e) { diff --git a/packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart b/packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart index 247bb5acd..af455a4a4 100644 --- a/packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart +++ b/packages/stream_chat_flutter/test/src/bottom_sheets/edit_message_sheet_test.dart @@ -21,7 +21,7 @@ void main() { .instance.defaultBinaryMessenger .handlePlatformMessage( methodChannel.name, - methodChannel.codec.encodeSuccessEnvelope('wifi'), + methodChannel.codec.encodeSuccessEnvelope(['wifi']), (_) {}, ); } catch (e) { diff --git a/packages/stream_chat_flutter/test/src/bottom_sheets/error_alert_sheet_test.dart b/packages/stream_chat_flutter/test/src/bottom_sheets/error_alert_sheet_test.dart index ffb5f1958..8ed886982 100644 --- a/packages/stream_chat_flutter/test/src/bottom_sheets/error_alert_sheet_test.dart +++ b/packages/stream_chat_flutter/test/src/bottom_sheets/error_alert_sheet_test.dart @@ -21,7 +21,7 @@ void main() { .instance.defaultBinaryMessenger .handlePlatformMessage( methodChannel.name, - methodChannel.codec.encodeSuccessEnvelope('wifi'), + methodChannel.codec.encodeSuccessEnvelope(['wifi']), (_) {}, ); } catch (e) { diff --git a/packages/stream_chat_flutter/test/src/gallery/gallery_footer_test.dart b/packages/stream_chat_flutter/test/src/gallery/gallery_footer_test.dart index c5f8edaf1..807d5dbdc 100644 --- a/packages/stream_chat_flutter/test/src/gallery/gallery_footer_test.dart +++ b/packages/stream_chat_flutter/test/src/gallery/gallery_footer_test.dart @@ -49,7 +49,7 @@ void main() { .instance.defaultBinaryMessenger .handlePlatformMessage( methodChannel.name, - methodChannel.codec.encodeSuccessEnvelope('wifi'), + methodChannel.codec.encodeSuccessEnvelope(['wifi']), (_) {}, ); } catch (e) { diff --git a/packages/stream_chat_flutter/test/src/gallery/gallery_header_test.dart b/packages/stream_chat_flutter/test/src/gallery/gallery_header_test.dart index a0f33e66f..758e8dfde 100644 --- a/packages/stream_chat_flutter/test/src/gallery/gallery_header_test.dart +++ b/packages/stream_chat_flutter/test/src/gallery/gallery_header_test.dart @@ -49,7 +49,7 @@ void main() { .instance.defaultBinaryMessenger .handlePlatformMessage( methodChannel.name, - methodChannel.codec.encodeSuccessEnvelope('wifi'), + methodChannel.codec.encodeSuccessEnvelope(['wifi']), (_) {}, ); } catch (e) { diff --git a/packages/stream_chat_flutter/test/src/message_widget/deleted_message_test.dart b/packages/stream_chat_flutter/test/src/message_widget/deleted_message_test.dart index 7af15894a..9f18c56c6 100644 --- a/packages/stream_chat_flutter/test/src/message_widget/deleted_message_test.dart +++ b/packages/stream_chat_flutter/test/src/message_widget/deleted_message_test.dart @@ -75,7 +75,7 @@ void main() { StreamChat( streamChatThemeData: theme, client: client, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: StreamChannel( showLoading: false, channel: channel, @@ -136,7 +136,7 @@ void main() { home: StreamChat( streamChatThemeData: theme, client: client, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: StreamChannel( showLoading: false, channel: channel, @@ -194,7 +194,7 @@ void main() { home: StreamChat( streamChatThemeData: theme, client: client, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: StreamChannel( showLoading: false, channel: channel, diff --git a/packages/stream_chat_flutter/test/src/message_widget/message_text_test.dart b/packages/stream_chat_flutter/test/src/message_widget/message_text_test.dart index 7a5055bdd..d33b24f70 100644 --- a/packages/stream_chat_flutter/test/src/message_widget/message_text_test.dart +++ b/packages/stream_chat_flutter/test/src/message_widget/message_text_test.dart @@ -221,7 +221,7 @@ cool.'''; home: SimpleFrame( child: StreamChat( client: client, - connectivityStream: Stream.value(ConnectivityResult.wifi), + connectivityStream: Stream.value([ConnectivityResult.wifi]), child: StreamChannel( channel: channel, child: Scaffold( diff --git a/packages/stream_chat_flutter/test/src/misc/reaction_bubble_test.dart b/packages/stream_chat_flutter/test/src/misc/reaction_bubble_test.dart index 7592eefd5..55adbea44 100644 --- a/packages/stream_chat_flutter/test/src/misc/reaction_bubble_test.dart +++ b/packages/stream_chat_flutter/test/src/misc/reaction_bubble_test.dart @@ -25,7 +25,7 @@ void main() { StreamChat( client: client, streamChatThemeData: theme, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: Scaffold( body: Center( child: StreamReactionBubble( @@ -68,7 +68,7 @@ void main() { StreamChat( client: client, streamChatThemeData: StreamChatThemeData.fromTheme(themeData), - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: ColoredBox( color: Colors.black, child: StreamReactionBubble( @@ -105,7 +105,7 @@ void main() { StreamChat( client: client, streamChatThemeData: StreamChatThemeData.fromTheme(themeData), - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: ColoredBox( color: Colors.black, child: StreamReactionBubble( @@ -150,7 +150,7 @@ void main() { StreamChat( client: client, streamChatThemeData: StreamChatThemeData.fromTheme(themeData), - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: ColoredBox( color: Colors.black, child: StreamReactionBubble( @@ -195,7 +195,7 @@ void main() { await tester.pumpWidgetBuilder( StreamChat( client: client, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), streamChatThemeData: StreamChatThemeData.fromTheme(themeData), child: Scaffold( body: Center( diff --git a/packages/stream_chat_flutter/test/src/misc/system_message_test.dart b/packages/stream_chat_flutter/test/src/misc/system_message_test.dart index 7878ed676..73537c657 100644 --- a/packages/stream_chat_flutter/test/src/misc/system_message_test.dart +++ b/packages/stream_chat_flutter/test/src/misc/system_message_test.dart @@ -91,7 +91,7 @@ void main() { await tester.pumpWidgetBuilder( StreamChat( client: client, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: StreamChannel( showLoading: false, channel: channel, @@ -146,7 +146,7 @@ void main() { await tester.pumpWidgetBuilder( StreamChat( client: client, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: StreamChannel( showLoading: false, channel: channel, diff --git a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart index 36fbe63ca..33004696b 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_chat_core.dart @@ -65,7 +65,7 @@ class StreamChatCore extends StatefulWidget { /// Stream of connectivity result /// Visible for testing @visibleForTesting - final Stream? connectivityStream; + final Stream>? connectivityStream; @override StreamChatCoreState createState() => StreamChatCoreState(); @@ -108,7 +108,7 @@ class StreamChatCoreState extends State /// The current user as a stream Stream get currentUserStream => client.state.currentUserStream; - StreamSubscription? _connectivitySubscription; + StreamSubscription>? _connectivitySubscription; var _isInForeground = true; var _isConnectionAvailable = true; @@ -121,13 +121,13 @@ class StreamChatCoreState extends State } void _subscribeToConnectivityChange([ - Stream? connectivityStream, + Stream>? connectivityStream, ]) { if (_connectivitySubscription == null) { connectivityStream ??= Connectivity().onConnectivityChanged; _connectivitySubscription = connectivityStream.distinct().listen((result) { - _isConnectionAvailable = result != ConnectivityResult.none; + _isConnectionAvailable = !result.contains(ConnectivityResult.none); if (!_isInForeground) return; if (_isConnectionAvailable) { if (client.wsConnectionStatus == ConnectionStatus.disconnected && diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 430196269..a35a3fe8f 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -11,7 +11,7 @@ environment: dependencies: collection: ^1.17.2 - connectivity_plus: ">=4.0.2 <6.0.0" + connectivity_plus: ^6.0.3 flutter: sdk: flutter freezed_annotation: ^2.4.1 diff --git a/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart b/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart index 7dd433be5..494412616 100644 --- a/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_chat_core_test.dart @@ -102,7 +102,7 @@ void main() { client: mockClient, onBackgroundEventReceived: mockOnBackgroundEventReceived, backgroundKeepAlive: backgroundKeepAlive, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: const Offstage(key: childKey), ); @@ -197,7 +197,7 @@ void main() { final streamChatCore = StreamChatCore( key: streamChatCoreKey, client: mockClient, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: const Offstage(key: childKey), ); @@ -261,7 +261,7 @@ void main() { final streamChatCore = StreamChatCore( key: streamChatCoreKey, client: mockClient, - connectivityStream: Stream.value(ConnectivityResult.none), + connectivityStream: Stream.value([ConnectivityResult.none]), child: const Offstage(key: childKey), ); @@ -346,7 +346,7 @@ void main() { final streamChatCore = StreamChatCore( key: streamChatCoreKey, client: mockClient, - connectivityStream: Stream.value(ConnectivityResult.mobile), + connectivityStream: Stream.value([ConnectivityResult.mobile]), child: const Offstage(key: childKey), ); @@ -402,7 +402,7 @@ void main() { final streamChatCore = StreamChatCore( key: streamChatCoreKey, client: mockClient, - connectivityStream: Stream.value(ConnectivityResult.none), + connectivityStream: Stream.value([ConnectivityResult.none]), child: const Offstage(key: childKey), ); @@ -478,7 +478,7 @@ void main() { const streamChatCoreKey = Key('streamChatCore'); const childKey = Key('child'); final _connectivityController = - BehaviorSubject.seeded(ConnectivityResult.none); + BehaviorSubject.seeded([ConnectivityResult.none]); final event = Event(); when(mockClient.on).thenAnswer((_) => Stream.value(event)); @@ -504,7 +504,7 @@ void main() { expect(find.byKey(streamChatCoreKey), findsOneWidget); expect(find.byKey(childKey), findsOneWidget); - _connectivityController.add(ConnectivityResult.mobile); + _connectivityController.add([ConnectivityResult.mobile]); await Future.delayed(const Duration(seconds: 1)); @@ -523,7 +523,7 @@ void main() { const streamChatCoreKey = Key('streamChatCore'); const childKey = Key('child'); final _connectivityController = - BehaviorSubject.seeded(ConnectivityResult.mobile); + BehaviorSubject.seeded([ConnectivityResult.mobile]); final streamChatCore = StreamChatCore( key: streamChatCoreKey, client: mockClient, @@ -548,7 +548,7 @@ void main() { when(() => mockClient.wsConnectionStatus) .thenReturn(ConnectionStatus.connected); - _connectivityController.add(ConnectivityResult.none); + _connectivityController.add([ConnectivityResult.none]); await Future.delayed(const Duration(seconds: 1)); @@ -567,7 +567,7 @@ void main() { const streamChatCoreKey = Key('streamChatCore'); const childKey = Key('child'); final _connectivityController = - BehaviorSubject.seeded(ConnectivityResult.none); + BehaviorSubject.seeded([ConnectivityResult.none]); final event = Event(); when(mockClient.on).thenAnswer((_) => Stream.value(event)); @@ -603,7 +603,7 @@ void main() { await Future.delayed(const Duration(seconds: 1)); - _connectivityController.add(ConnectivityResult.mobile); + _connectivityController.add([ConnectivityResult.mobile]); await Future.delayed(const Duration(seconds: 1));