upgrade dependencies

This commit is contained in:
Salvatore Giordano
2021-05-12 17:02:35 +02:00
parent 9612bb1786
commit 6d1db8d4bf
10 changed files with 112 additions and 151 deletions
@@ -34,16 +34,14 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
super.initState(); super.initState();
final messageSearchBloc = MessageSearchBloc.of(context); final messageSearchBloc = MessageSearchBloc.of(context);
messageSearchBloc.search( messageSearchBloc.search(
filter: { filter: Filter.in_(
'cid': { 'cid',
r'$in': [StreamChannel.of(context).channel.cid] [StreamChannel.of(context).channel.cid],
} ),
}, messageFilter: Filter.in_(
messageFilter: { 'attachments.type',
'attachments.type': { ['file'],
r'$in': ['file'], ),
},
},
sort: widget.sortOptions, sort: widget.sortOptions,
pagination: widget.paginationParams, pagination: widget.paginationParams,
); );
@@ -142,16 +140,14 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
return LazyLoadScrollView( return LazyLoadScrollView(
onEndOfPage: () => messageSearchBloc.search( onEndOfPage: () => messageSearchBloc.search(
filter: { filter: Filter.in_(
'cid': { 'cid',
r'$in': [StreamChannel.of(context).channel.cid] [StreamChannel.of(context).channel.cid],
} ),
}, messageFilter: Filter.in_(
messageFilter: { 'attachments.type',
'attachments.type': { ['file'],
r'$in': ['file'] ),
},
},
sort: widget.sortOptions, sort: widget.sortOptions,
pagination: widget.paginationParams.copyWith( pagination: widget.paginationParams.copyWith(
offset: messageSearchBloc.messageResponses?.length ?? 0, offset: messageSearchBloc.messageResponses?.length ?? 0,
@@ -20,7 +20,10 @@ class ChannelMediaDisplayScreen extends StatefulWidget {
final ShowMessageCallback onShowMessage; final ShowMessageCallback onShowMessage;
final MessageTheme messageTheme;
const ChannelMediaDisplayScreen({ const ChannelMediaDisplayScreen({
@required this.messageTheme,
this.sortOptions, this.sortOptions,
this.paginationParams, this.paginationParams,
this.emptyBuilder, this.emptyBuilder,
@@ -40,16 +43,14 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
super.initState(); super.initState();
final messageSearchBloc = MessageSearchBloc.of(context); final messageSearchBloc = MessageSearchBloc.of(context);
messageSearchBloc.search( messageSearchBloc.search(
filter: { filter: Filter.in_(
'cid': { 'cid',
r'$in': [StreamChannel.of(context).channel.cid], [StreamChannel.of(context).channel.cid],
} ),
}, messageFilter: Filter.in_(
messageFilter: { 'attachments.type',
'attachments.type': { ['image', 'video'],
r'$in': ['image', 'video'] ),
},
},
sort: widget.sortOptions, sort: widget.sortOptions,
pagination: widget.paginationParams, pagination: widget.paginationParams,
); );
@@ -165,16 +166,14 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
return LazyLoadScrollView( return LazyLoadScrollView(
onEndOfPage: () => messageSearchBloc.search( onEndOfPage: () => messageSearchBloc.search(
filter: { filter: Filter.in_(
'cid': { 'cid',
r'$in': [StreamChannel.of(context).channel.cid] [StreamChannel.of(context).channel.cid],
} ),
}, messageFilter: Filter.in_(
messageFilter: { 'attachments.type',
'attachments.type': { ['image', 'video'],
r'$in': ['image', 'video'] ),
},
},
sort: widget.sortOptions, sort: widget.sortOptions,
pagination: widget.paginationParams.copyWith( pagination: widget.paginationParams.copyWith(
offset: messageSearchBloc.messageResponses?.length ?? 0, offset: messageSearchBloc.messageResponses?.length ?? 0,
@@ -199,7 +198,6 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
media.map((e) => e.attachment).toList(), media.map((e) => e.attachment).toList(),
startIndex: position, startIndex: position,
message: media[position].message, message: media[position].message,
sentAt: media[position].message.createdAt,
userName: media[position].message.user.name, userName: media[position].message.user.name,
onShowMessage: widget.onShowMessage, onShowMessage: widget.onShowMessage,
), ),
@@ -217,6 +215,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
MediaQuery.of(context).size.width * 0.8, MediaQuery.of(context).size.width * 0.8,
MediaQuery.of(context).size.height * 0.3, MediaQuery.of(context).size.height * 0.3,
), ),
messageTheme: widget.messageTheme,
), ),
) )
: VideoPlayer(media[position].videoPlayer), : VideoPlayer(media[position].videoPlayer),
@@ -13,7 +13,13 @@ class ChatInfoScreen extends StatefulWidget {
/// User in consideration /// User in consideration
final User user; final User user;
const ChatInfoScreen({Key key, this.user}) : super(key: key); final MessageTheme messageTheme;
const ChatInfoScreen({
Key key,
@required this.messageTheme,
this.user,
}) : super(key: key);
@override @override
_ChatInfoScreenState createState() => _ChatInfoScreenState(); _ChatInfoScreenState createState() => _ChatInfoScreenState();
@@ -217,6 +223,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
channel: channel, channel: channel,
child: MessageSearchBloc( child: MessageSearchBloc(
child: ChannelMediaDisplayScreen( child: ChannelMediaDisplayScreen(
messageTheme: widget.messageTheme,
sortOptions: [ sortOptions: [
SortOption( SortOption(
'created_at', 'created_at',
@@ -445,20 +452,10 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
), ),
body: StreamBuilder<List<Channel>>( body: StreamBuilder<List<Channel>>(
stream: chat.client.queryChannels( stream: chat.client.queryChannels(
filter: { filter: Filter.and([
r'$and': [ Filter.in_('members', [widget.otherUser.id]),
{ Filter.in_('members', [widget.mainUser.id]),
'members': { ]),
r'$in': [widget.otherUser.id],
},
},
{
'members': {
r'$in': [widget.mainUser.id],
},
}
],
},
), ),
builder: (context, snapshot) { builder: (context, snapshot) {
if (!snapshot.hasData) { if (!snapshot.hasData) {
@@ -14,6 +14,13 @@ import 'main.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
class GroupInfoScreen extends StatefulWidget { class GroupInfoScreen extends StatefulWidget {
final MessageTheme messageTheme;
const GroupInfoScreen({
Key key,
@required this.messageTheme,
}) : super(key: key);
@override @override
_GroupInfoScreenState createState() => _GroupInfoScreenState(); _GroupInfoScreenState createState() => _GroupInfoScreenState();
} }
@@ -502,6 +509,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
channel: channel, channel: channel,
child: MessageSearchBloc( child: MessageSearchBloc(
child: ChannelMediaDisplayScreen( child: ChannelMediaDisplayScreen(
messageTheme: widget.messageTheme,
sortOptions: [ sortOptions: [
SortOption( SortOption(
'created_at', 'created_at',
@@ -657,18 +665,16 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
pagination: PaginationParams( pagination: PaginationParams(
limit: 25, limit: 25,
), ),
filter: { filter: Filter.and(
if (_searchController.text.isNotEmpty) [
'name': { if (_searchController.text.isNotEmpty)
r'$autocomplete': _userNameQuery, Filter.autoComplete('name', _userNameQuery),
}, Filter.notIn('id', [
'id': {
r'$nin': [
StreamChat.of(context).user.id, StreamChat.of(context).user.id,
...channel.state.members.map((e) => e.userId), ...channel.state.members.map((e) => e.userId),
], ]),
}, ],
}, ),
sort: [ sort: [
SortOption( SortOption(
'name', 'name',
@@ -848,6 +854,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
channel: c, channel: c,
child: ChatInfoScreen( child: ChatInfoScreen(
messageTheme: widget.messageTheme,
user: user, user: user,
), ),
), ),
+18 -22
View File
@@ -498,16 +498,12 @@ class UserMentionPage extends StatelessWidget {
final user = StreamChat.of(context).user; final user = StreamChat.of(context).user;
return MessageSearchBloc( return MessageSearchBloc(
child: MessageSearchListView( child: MessageSearchListView(
filters: { filters: Filter.in_('members', [user.id]),
'members': { messageFilters: Filter.custom(
r'$in': [user.id], operator: 'contains',
}, key: 'mentioned_users.id',
}, value: user.id,
messageFilters: { ),
'mentioned_users.id': {
r'$contains': user.id,
},
},
sortOptions: [ sortOptions: [
SortOption( SortOption(
'created_at', 'created_at',
@@ -651,11 +647,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
? MessageSearchListView( ? MessageSearchListView(
showErrorTile: true, showErrorTile: true,
messageQuery: _channelQuery, messageQuery: _channelQuery,
filters: { filters: Filter.in_('members', [user.id]),
'members': {
r'$in': [user.id]
},
},
sortOptions: [ sortOptions: [
SortOption( SortOption(
'created_at', 'created_at',
@@ -720,11 +712,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
Navigator.pushNamed(context, Routes.NEW_CHAT); Navigator.pushNamed(context, Routes.NEW_CHAT);
}, },
swipeToAction: true, swipeToAction: true,
filter: { filter: Filter.in_('members', [user.id]),
'members': {
r'$in': [user.id],
},
},
options: { options: {
'presence': true, 'presence': true,
}, },
@@ -741,6 +729,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
channel: channel, channel: channel,
child: ChatInfoScreen( child: ChatInfoScreen(
messageTheme: StreamChatTheme.of(context)
.ownMessageTheme,
user: channel.state.members user: channel.state.members
.where((m) => .where((m) =>
m.userId != m.userId !=
@@ -757,7 +747,10 @@ class _ChannelListPageState extends State<ChannelListPage> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
channel: channel, channel: channel,
child: GroupInfoScreen(), child: GroupInfoScreen(
messageTheme: StreamChatTheme.of(context)
.ownMessageTheme,
),
), ),
), ),
); );
@@ -843,6 +836,7 @@ class _ChannelPageState extends State<ChannelPage> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
child: ChatInfoScreen( child: ChatInfoScreen(
messageTheme: StreamChatTheme.of(context).ownMessageTheme,
user: otherUser.user, user: otherUser.user,
), ),
channel: channel, channel: channel,
@@ -859,7 +853,9 @@ class _ChannelPageState extends State<ChannelPage> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
child: GroupInfoScreen(), child: GroupInfoScreen(
messageTheme: StreamChatTheme.of(context).ownMessageTheme,
),
channel: channel, channel: channel,
), ),
), ),
@@ -70,13 +70,13 @@ class _NewChatScreenState extends State<NewChatScreen> {
'state': false, 'state': false,
'watch': false, 'watch': false,
}, },
filter: { filter: Filter.and([
'members': [ Filter.equal('members', [
..._selectedUsers.map((e) => e.id), ..._selectedUsers.map((e) => e.id),
chatState.user.id, chatState.user.id,
], ]),
'distinct': true, Filter.equal('distinct', true),
}, ]),
messageLimit: 0, messageLimit: 0,
paginationParams: PaginationParams( paginationParams: PaginationParams(
limit: 1, limit: 1,
@@ -308,15 +308,12 @@ class _NewChatScreenState extends State<NewChatScreen> {
pagination: PaginationParams( pagination: PaginationParams(
limit: 25, limit: 25,
), ),
filter: { filter: Filter.and([
if (_userNameQuery.isNotEmpty) if (_userNameQuery.isNotEmpty)
'name': { Filter.autoComplete('name', _userNameQuery),
r'$autocomplete': _userNameQuery, Filter.notEqual(
}, 'id', StreamChat.of(context).user.id),
'id': { ]),
r'$ne': StreamChat.of(context).user.id,
},
},
sort: [ sort: [
SortOption( SortOption(
'name', 'name',
@@ -244,15 +244,11 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
pagination: PaginationParams( pagination: PaginationParams(
limit: 25, limit: 25,
), ),
filter: { filter: Filter.and([
if (_userNameQuery.isNotEmpty) if (_userNameQuery.isNotEmpty)
'name': { Filter.autoComplete('name', _userNameQuery),
r'$autocomplete': _userNameQuery, Filter.notEqual('id', StreamChat.of(context).user.id),
}, ]),
'id': {
r'$ne': StreamChat.of(context).user.id,
}
},
sort: [ sort: [
SortOption( SortOption(
'name', 'name',
@@ -74,16 +74,19 @@ class AppRoutes {
case Routes.CHAT_INFO_SCREEN: case Routes.CHAT_INFO_SCREEN:
return MaterialPageRoute( return MaterialPageRoute(
settings: const RouteSettings(name: Routes.CHAT_INFO_SCREEN), settings: const RouteSettings(name: Routes.CHAT_INFO_SCREEN),
builder: (_) { builder: (context) {
return ChatInfoScreen( return ChatInfoScreen(
user: args, user: args,
messageTheme: StreamChatTheme.of(context).ownMessageTheme,
); );
}); });
case Routes.GROUP_INFO_SCREEN: case Routes.GROUP_INFO_SCREEN:
return MaterialPageRoute( return MaterialPageRoute(
settings: const RouteSettings(name: Routes.GROUP_INFO_SCREEN), settings: const RouteSettings(name: Routes.GROUP_INFO_SCREEN),
builder: (_) { builder: (context) {
return GroupInfoScreen(); return GroupInfoScreen(
messageTheme: StreamChatTheme.of(context).ownMessageTheme,
);
}); });
// Default case, should not reach here. // Default case, should not reach here.
default: default:
+9 -9
View File
@@ -7,7 +7,7 @@ environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.2.2 <3.0.0"
dependencies: dependencies:
flutter_app_badger: ^1.1.2 flutter_app_badger: ^1.2.0
flutter: flutter:
sdk: flutter sdk: flutter
stream_chat_flutter: stream_chat_flutter:
@@ -20,13 +20,13 @@ dependencies:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: develop
path: packages/stream_chat_persistence path: packages/stream_chat_persistence
flutter_local_notifications: ^2.0.2 flutter_local_notifications: ^5.0.0+4
flutter_svg: ^0.19.3 flutter_svg: ^0.22.0
flutter_secure_storage: ^3.3.5 flutter_secure_storage: ^4.2.0
yaml: ^2.2.1 yaml: ^3.1.0
uuid: ^2.2.2 uuid: ^3.0.4
streaming_shared_preferences: ^1.0.2 streaming_shared_preferences: ^2.0.0
lottie: ^0.7.0+1 lottie: ^1.0.1
dependency_overrides: dependency_overrides:
stream_chat: stream_chat:
@@ -41,7 +41,7 @@ dependency_overrides:
path: packages/stream_chat_flutter_core path: packages/stream_chat_flutter_core
dev_dependencies: dev_dependencies:
flutter_launcher_icons: ^0.8.1 flutter_launcher_icons: ^0.9.0
test: any test: any
flutter: flutter:
@@ -1,30 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:stream_chat_v1/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}