Merge branch 'main' into develop

This commit is contained in:
Salvatore Giordano
2021-07-29 12:08:51 +02:00
10 changed files with 24 additions and 24 deletions
@@ -50,7 +50,7 @@ class _ChannelList extends State<ChannelList> {
@override
Widget build(BuildContext context) {
final user = StreamChat.of(context).user;
final user = StreamChat.of(context).currentUser;
return WillPopScope(
onWillPop: () async {
if (_isSearchActive) {
@@ -167,7 +167,7 @@ class _ChannelList extends State<ChannelList> {
user: channel.state!.members
.where((m) =>
m.userId !=
channel.client.state.user!.id)
channel.client.state.currentUser!.id)
.first
.user,
),
@@ -63,7 +63,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
@override
Widget build(BuildContext context) {
final user = StreamChat.of(context).user;
final user = StreamChat.of(context).currentUser;
if (user == null) {
return Offstage();
}
@@ -66,7 +66,7 @@ class _ChannelPageState extends State<ChannelPage> {
var channel = StreamChannel.of(context).channel;
if (channel.memberCount == 2 && channel.isDistinct) {
final currentUser = StreamChat.of(context).user;
final currentUser = StreamChat.of(context).currentUser;
final otherUser = channel.state!.members.firstWhereOrNull(
(element) => element.user!.id != currentUser!.id,
);
@@ -58,7 +58,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
'owner',
].contains(channel.state!.members
.firstWhereOrNull(
(m) => m.userId == channel.client.state.user!.id)
(m) => m.userId == channel.client.state.currentUser!.id)
?.role))
_buildDeleteListTile(),
],
@@ -385,7 +385,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
context,
MaterialPageRoute(
builder: (context) => _SharedGroupsScreen(
StreamChat.of(context).user, widget.user)));
StreamChat.of(context).currentUser, widget.user)));
},
),
],
@@ -603,7 +603,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
String? title;
if (extraData['name'] == null) {
final otherMembers = members.where(
(member) => member.userId != StreamChat.of(context).user!.id);
(member) => member.userId != StreamChat.of(context).currentUser!.id);
if (otherMembers.isNotEmpty) {
final maxWidth = constraints.maxWidth;
final maxChars = maxWidth / textStyle.fontSize!;
@@ -134,7 +134,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
id: Uuid().v4(),
extraData: {
'members': [
client.state.user!.id,
client.state.currentUser!.id,
..._selectedUsers.map((e) => e.id),
],
'name': groupName,
@@ -87,7 +87,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
}
var userMember = snapshot.data!.firstWhereOrNull(
(e) => e.user!.id == StreamChat.of(context).user!.id,
(e) => e.user!.id == StreamChat.of(context).currentUser!.id,
);
var isOwner = userMember?.role == 'owner';
@@ -211,7 +211,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
child: InkWell(
onTap: () {
final userMember = groupMembers.firstWhereOrNull(
(e) => e.user!.id == StreamChat.of(context).user!.id,
(e) => e.user!.id == StreamChat.of(context).currentUser!.id,
);
_showUserInfoModal(member.user, userMember?.role == 'owner');
},
@@ -684,7 +684,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
);
if (res == true) {
final channel = StreamChannel.of(context).channel;
await channel.removeMembers([StreamChat.of(context).user!.id]);
await channel.removeMembers([StreamChat.of(context).currentUser!.id]);
Navigator.pop(context);
}
},
@@ -738,7 +738,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
if (_searchController!.text.isNotEmpty)
Filter.autoComplete('name', _userNameQuery),
Filter.notIn('id', [
StreamChat.of(context).user!.id,
StreamChat.of(context).currentUser!.id,
...channel.state!.members
.map<String?>(((e) => e.userId))
.whereType<String>(),
@@ -902,7 +902,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
),
),
),
if (StreamChat.of(context).user!.id != user.id)
if (StreamChat.of(context).currentUser!.id != user.id)
_buildModalListTile(
context,
StreamSvgIcon.user(
@@ -918,7 +918,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
var c = client.channel('messaging', extraData: {
'members': [
user.id,
StreamChat.of(context).user!.id,
StreamChat.of(context).currentUser!.id,
],
});
@@ -938,7 +938,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
);
},
),
if (StreamChat.of(context).user!.id != user.id)
if (StreamChat.of(context).currentUser!.id != user.id)
_buildModalListTile(
context,
StreamSvgIcon.message(
@@ -954,7 +954,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
var c = client.channel('messaging', extraData: {
'members': [
user.id,
StreamChat.of(context).user!.id,
StreamChat.of(context).currentUser!.id,
],
});
@@ -984,7 +984,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
// // TODO: Add make owner implementation (Remaining from backend)
// }),
if (!channel.isDistinct &&
StreamChat.of(context).user!.id != user.id &&
StreamChat.of(context).currentUser!.id != user.id &&
isUserAdmin)
_buildModalListTile(
context,
@@ -1116,7 +1116,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
var client = StreamChat.of(context);
if (extraData['name'] == null) {
final otherMembers =
members!.where((member) => member.user!.id != client.user!.id);
members!.where((member) => member.user!.id != client.currentUser!.id);
if (otherMembers.isNotEmpty) {
final maxWidth = width;
final maxChars = maxWidth / maxFontSize!;
+1 -1
View File
@@ -133,7 +133,7 @@ class _MyAppState extends State<MyApp>
)!
];
},
initialRoute: _initData!.client.state.user == null
initialRoute: _initData!.client.state.currentUser == null
? Routes.CHOOSE_USER
: Routes.HOME,
),
@@ -71,7 +71,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
filter: Filter.raw(value: {
'members': [
..._selectedUsers.map((e) => e.id),
chatState.user!.id,
chatState.currentUser!.id,
],
'distinct': true,
}),
@@ -91,7 +91,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
extraData: {
'members': [
..._selectedUsers.map((e) => e.id),
chatState.user!.id,
chatState.currentUser!.id,
],
},
);
@@ -308,7 +308,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
if (_userNameQuery.isNotEmpty)
Filter.autoComplete('name', _userNameQuery),
Filter.notEqual(
'id', StreamChat.of(context).user!.id),
'id', StreamChat.of(context).currentUser!.id),
]),
sort: [
SortOption(
@@ -248,7 +248,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
filter: Filter.and([
if (_userNameQuery.isNotEmpty)
Filter.autoComplete('name', _userNameQuery),
Filter.notEqual('id', StreamChat.of(context).user!.id),
Filter.notEqual('id', StreamChat.of(context).currentUser!.id),
]),
sort: [
SortOption(
@@ -7,7 +7,7 @@ import 'channel_page.dart';
class UserMentionsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final user = StreamChat.of(context).user!;
final user = StreamChat.of(context).currentUser!;
return MessageSearchBloc(
child: MessageSearchListView(
filters: Filter.in_('members', [user.id]),