Merge branch 'develop' into dependabot/pub/packages/stream_chat_flutter/share_plus-8.0.0

This commit is contained in:
Maciej Brażewicz
2023-11-30 15:38:35 +01:00
committed by GitHub
57 changed files with 532 additions and 262 deletions
+7
View File
@@ -1,3 +1,10 @@
# 6.10.0
🐞 Fixed
- [[#1753]](https://github.com/GetStream/stream-chat-flutter/issues/1753) Fixed Unhandled null
check operator exception when user is removed from a channel.
## 6.9.0
🐞 Fixed
@@ -1658,7 +1658,7 @@ class ClientState {
)
.listen((event) async {
final isCurrentUser = event.user!.id == currentUser!.id;
if (isCurrentUser) {
if (isCurrentUser && event.channel != null) {
final eventChannel = event.channel!;
await _client.chatPersistenceClient
?.deleteChannels([eventChannel.cid]);
@@ -7,8 +7,8 @@ class StreamHttpClientOptions {
/// Instantiates a new [StreamHttpClientOptions]
const StreamHttpClientOptions({
String? baseUrl,
this.connectTimeout = const Duration(seconds: 6),
this.receiveTimeout = const Duration(seconds: 6),
this.connectTimeout = const Duration(seconds: 30),
this.receiveTimeout = const Duration(seconds: 30),
this.queryParameters = const {},
this.headers = const {},
}) : baseUrl = baseUrl ?? _defaultBaseURL;
@@ -16,10 +16,10 @@ class StreamHttpClientOptions {
/// base url to use with client.
final String baseUrl;
/// connect timeout, default to 6s
/// connect timeout, default to 30s
final Duration connectTimeout;
/// received timeout, default to 6s
/// received timeout, default to 30s
final Duration receiveTimeout;
/// Common query parameters.
+1 -1
View File
@@ -3,4 +3,4 @@ import 'package:stream_chat/src/client/client.dart';
/// Current package version
/// Used in [StreamChatClient] to build the `x-stream-client` header
// ignore: constant_identifier_names
const PACKAGE_VERSION = '6.9.0';
const PACKAGE_VERSION = '6.10.0';
+1 -1
View File
@@ -1,7 +1,7 @@
name: stream_chat
homepage: https://getstream.io/
description: The official Dart client for Stream Chat, a service for building chat applications.
version: 6.9.0
version: 6.10.0
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -5,8 +5,8 @@ void main() {
test('should return the all default set params', () {
const options = StreamHttpClientOptions();
expect(options.baseUrl, 'https://chat.stream-io-api.com');
expect(options.connectTimeout, const Duration(seconds: 6));
expect(options.receiveTimeout, const Duration(seconds: 6));
expect(options.connectTimeout, const Duration(seconds: 30));
expect(options.receiveTimeout, const Duration(seconds: 30));
expect(options.queryParameters, const {});
expect(options.headers, const {});
});
@@ -164,7 +164,8 @@ void main() {
expect(
e.message,
"The connection errored: Dio can't establish a new connection"
' after it was closed.',
' after it was closed. This indicates an error which most likely'
' cannot be solved by the library.',
);
}
});
@@ -1,3 +1,10 @@
# 6.12.0
🐞 Fixed
- [[#1759]](https://github.com/GetStream/stream-chat-flutter/issues/1759) Fixed
The Reaction Picker is not being removed when I set showReactionPicker to false.
# 6.11.0
🐞 Fixed
@@ -0,0 +1,47 @@
// ignore_for_file: public_member_api_docs
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_chat_flutter_example/debug/error_dialog.dart';
class DebugAddUser extends StatelessWidget {
const DebugAddUser({
super.key,
required this.client,
required this.channel,
});
final StreamChatClient client;
final Channel channel;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8),
child: TextField(
decoration: const InputDecoration(
labelText: 'Add User',
hintText: 'User Id',
isDense: true,
border: OutlineInputBorder(),
),
onSubmitted: (value) async {
final userId = value.trim();
try {
debugPrint('[addUser] userId: $userId');
final result = await client.addChannelMembers(
channel.id!,
channel.type,
[userId],
);
debugPrint('[addUser] result: $result');
} catch (e) {
debugPrint('[addUser] failed: $e');
showErrorDialog(context, e, 'Add User');
}
},
),
);
}
}
@@ -0,0 +1,47 @@
// ignore_for_file: public_member_api_docs
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_chat_flutter_example/debug/error_dialog.dart';
class DebugRemoveUser extends StatelessWidget {
const DebugRemoveUser({
super.key,
required this.client,
required this.channel,
});
final StreamChatClient client;
final Channel channel;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8),
child: TextField(
decoration: const InputDecoration(
labelText: 'Remove User',
hintText: 'User Id',
isDense: true,
border: OutlineInputBorder(),
),
onSubmitted: (value) async {
final userId = value.trim();
try {
debugPrint('[removeUser] userId: $userId');
final result = await client.removeChannelMembers(
channel.id!,
channel.type,
[userId],
);
debugPrint('[removeUser] result: $result');
} catch (e) {
debugPrint('[removeUser] failed: $e');
showErrorDialog(context, e, 'Remove User');
}
},
),
);
}
}
@@ -4,9 +4,11 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_chat_flutter_example/debug/actions/add_user.dart';
import 'package:stream_chat_flutter_example/debug/actions/ban_user.dart';
import 'package:stream_chat_flutter_example/debug/actions/mute_user.dart';
import 'package:stream_chat_flutter_example/debug/actions/remove_shadow_ban.dart';
import 'package:stream_chat_flutter_example/debug/actions/remove_user.dart';
import 'package:stream_chat_flutter_example/debug/actions/shadow_ban.dart';
import 'package:stream_chat_flutter_example/debug/actions/unban_user.dart';
import 'package:stream_chat_flutter_example/debug/actions/unmute_user.dart';
@@ -82,6 +84,10 @@ class _DebugChannelPageState extends State<DebugChannelPage> {
DebugShadowBan(client: _channel.client),
const SizedBox(height: 8),
DebugRemoveShadowBan(client: _channel.client),
const SizedBox(height: 8),
DebugAddUser(client: _channel.client, channel: _channel),
const SizedBox(height: 8),
DebugRemoveUser(client: _channel.client, channel: _channel),
],
),
),
@@ -60,7 +60,9 @@ class StreamMessageWidget extends StatefulWidget {
bool? showReactionPicker,
@Deprecated('Use `showReactionPicker` instead')
bool showReactionPickerIndicator = true,
@internal this.showReactionPickerTail = false,
@internal
@Deprecated('Use `showReactionPicker` instead')
this.showReactionPickerTail,
this.showUserAvatar = DisplayWidget.show,
this.showSendingIndicator = true,
this.showThreadReplyIndicator = false,
@@ -483,7 +485,8 @@ class StreamMessageWidget extends StatefulWidget {
/// Whether or not to show the reaction picker tail
/// {@endtemplate}
@internal
final bool showReactionPickerTail;
@Deprecated('Use `showReactionPicker` instead')
final bool? showReactionPickerTail;
/// {@template onShowMessage}
/// Callback when show message is tapped
@@ -743,8 +746,6 @@ class StreamMessageWidget extends StatefulWidget {
showReactionPicker: showReactionPicker ??
showReactionPickerIndicator ??
this.showReactionPicker,
showReactionPickerTail:
showReactionPickerTail ?? this.showReactionPickerTail,
onShowMessage: onShowMessage ?? this.onShowMessage,
showUsername: showUsername ?? this.showUsername,
showTimestamp: showTimestamp ?? this.showTimestamp,
@@ -1002,7 +1003,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
messageWidget: widget,
showBottomRow: showBottomRow,
showPinHighlight: widget.showPinHighlight,
showReactionPickerTail: widget.showReactionPickerTail,
showReactionPickerTail: widget.showReactionPicker,
showReactions: showReactions,
onReactionsTap: () {
widget.onReactionsTap != null
@@ -1217,7 +1218,8 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
translateUserAvatar: false,
showSendingIndicator: false,
padding: EdgeInsets.zero,
// Show the tail if the reaction picker is visible.
// Show both the tail if the picker is shown.
showReactionPicker: widget.showReactionPicker,
showReactionPickerTail: widget.showReactionPicker,
showPinHighlight: false,
showUserAvatar:
@@ -1258,6 +1260,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
return StreamChannel(
channel: channel,
child: MessageActionsModal(
showReactionPicker: widget.showReactionPicker,
messageWidget: widget.copyWith(
key: const Key('MessageWidget'),
message: widget.message.copyWith(
@@ -1271,9 +1274,6 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
translateUserAvatar: false,
showSendingIndicator: false,
padding: EdgeInsets.zero,
// Show both the tail if the picker is shown.
showReactionPicker: widget.showReactionPicker,
showReactionPickerTail: widget.showReactionPicker,
showPinHighlight: false,
showUserAvatar: widget.message.user!.id ==
channel.client.state.currentUser!.id
+3 -3
View File
@@ -1,7 +1,7 @@
name: stream_chat_flutter
homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
version: 6.11.0
version: 6.12.0
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -19,7 +19,7 @@ dependencies:
diacritic: ^0.1.4
dio: ^5.3.2
ezanimation: ^0.6.0
file_picker: ^5.3.3
file_picker: ">=5.3.3 <7.0.0"
file_selector: ^1.0.0
flutter:
sdk: flutter
@@ -38,7 +38,7 @@ dependencies:
rxdart: ^0.27.7
share_plus: ">=7.1.0 <9.0.0"
shimmer: ^3.0.0
stream_chat_flutter_core: ^6.10.0
stream_chat_flutter_core: ^6.11.0
synchronized: ^3.1.0
thumblr: ^0.0.4
url_launcher: ^6.1.12
@@ -64,6 +64,101 @@ void main() {
},
);
testWidgets(
'it should show the reaction picker',
(WidgetTester tester) async {
final client = MockClient();
final clientState = MockClientState();
final channel = MockChannel(
ownCapabilities: ['send-message', 'send-reaction'],
);
when(() => client.state).thenReturn(clientState);
when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id'));
final themeData = ThemeData();
final streamTheme = StreamChatThemeData.fromTheme(themeData);
await tester.pumpWidget(
MaterialApp(
theme: themeData,
home: StreamChat(
streamChatThemeData: streamTheme,
client: client,
child: SizedBox(
child: StreamChannel(
channel: channel,
child: MessageActionsModal(
message: Message(
text: 'test',
user: User(
id: 'user-id',
),
state: MessageState.sent,
),
messageWidget: const Text(
'test',
key: Key('MessageWidget'),
),
messageTheme: streamTheme.ownMessageTheme,
),
),
),
),
),
);
await tester.pumpAndSettle();
expect(find.byType(StreamReactionPicker), findsOneWidget);
},
);
testWidgets(
'it should not show the reaction picker',
(WidgetTester tester) async {
final client = MockClient();
final clientState = MockClientState();
final channel = MockChannel();
when(() => client.state).thenReturn(clientState);
when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id'));
final themeData = ThemeData();
final streamTheme = StreamChatThemeData.fromTheme(themeData);
await tester.pumpWidget(
MaterialApp(
theme: themeData,
home: StreamChat(
streamChatThemeData: streamTheme,
client: client,
child: SizedBox(
child: StreamChannel(
channel: channel,
child: MessageActionsModal(
showReactionPicker: false,
message: Message(
text: 'test',
user: User(
id: 'user-id',
),
state: MessageState.sent,
),
messageWidget: const Text(
'test',
key: Key('MessageWidget'),
),
messageTheme: streamTheme.ownMessageTheme,
),
),
),
),
),
);
await tester.pumpAndSettle();
expect(find.byType(StreamReactionPicker), findsNothing);
},
);
testWidgets(
'it should show some actions',
(WidgetTester tester) async {
@@ -14,6 +14,13 @@ class MockClient extends Mock implements StreamChatClient {
class MockClientState extends Mock implements ClientState {}
class MockChannel extends Mock implements Channel {
MockChannel({
this.ownCapabilities = const ['send-message'],
});
@override
final List<String> ownCapabilities;
@override
Future<bool> get initialized async => true;
@@ -22,9 +29,6 @@ class MockChannel extends Mock implements Channel {
Future<void> keyStroke([String? parentId]) async {
return;
}
@override
List<String> get ownCapabilities => ['send-message'];
}
class MockChannelState extends Mock implements ChannelClientState {
@@ -1,3 +1,9 @@
## 6.11.0
🐞 Fixed
- Fixed video attachment uploading. [#1754](https://github.com/GetStream/stream-chat-flutter/pull/1754)
## 6.10.0
- Added mixin support to `StreamChannelListEventHandler`.
@@ -1,7 +1,7 @@
name: stream_chat_flutter_core
homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK Core. Build your own chat experience using Dart and Flutter.
version: 6.10.0
version: 6.11.0
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -11,13 +11,13 @@ environment:
dependencies:
collection: ^1.17.1
connectivity_plus: ^4.0.2
connectivity_plus: ">=4.0.2 <6.0.0"
flutter:
sdk: flutter
freezed_annotation: ^2.4.1
meta: ^1.9.1
rxdart: ^0.27.7
stream_chat: ^6.9.0
stream_chat: ^6.10.0
dev_dependencies:
build_runner: ^2.4.6
@@ -1,3 +1,7 @@
## 5.12.0
* Updated `stream_chat_flutter` dependency to [`6.12.0`](https://pub.dev/packages/stream_chat_flutter/changelog).
## 5.11.0
* Updated `stream_chat_flutter` dependency to [`6.11.0`](https://pub.dev/packages/stream_chat_flutter/changelog).
@@ -1,6 +1,6 @@
name: stream_chat_localizations
description: The Official localizations for Stream Chat Flutter, a service for building chat applications
version: 5.11.0
version: 5.12.0
homepage: https://github.com/GetStream/stream-chat-flutter
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -14,7 +14,7 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
stream_chat_flutter: ^6.11.0
stream_chat_flutter: ^6.12.0
dev_dependencies:
flutter_test:
@@ -1,3 +1,7 @@
## 6.10.0
- Updated `stream_chat` dependency to [`6.10.0`](https://pub.dev/packages/stream_chat/changelog).
## 6.9.0
- Updated `stream_chat` dependency to [`6.9.0`](https://pub.dev/packages/stream_chat/changelog).
@@ -1,7 +1,7 @@
name: stream_chat_persistence
homepage: https://github.com/GetStream/stream-chat-flutter
description: Official Stream Chat Persistence library. Build your own chat experience using Dart and Flutter.
version: 6.9.0
version: 6.10.0
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -18,7 +18,7 @@ dependencies:
path: ^1.8.3
path_provider: ^2.1.0
sqlite3_flutter_libs: ^0.5.15
stream_chat: ^6.9.0
stream_chat: ^6.10.0
dev_dependencies:
build_runner: ^2.4.6