diff --git a/packages/stream_chat_v1/lib/channel_list.dart b/packages/stream_chat_v1/lib/channel_list.dart index c31fabb..e054518 100644 --- a/packages/stream_chat_v1/lib/channel_list.dart +++ b/packages/stream_chat_v1/lib/channel_list.dart @@ -50,7 +50,7 @@ class _ChannelList extends State { @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 { user: channel.state!.members .where((m) => m.userId != - channel.client.state.user!.id) + channel.client.state.currentUser!.id) .first .user, ), diff --git a/packages/stream_chat_v1/lib/channel_list_page.dart b/packages/stream_chat_v1/lib/channel_list_page.dart index 5379062..76df0fb 100644 --- a/packages/stream_chat_v1/lib/channel_list_page.dart +++ b/packages/stream_chat_v1/lib/channel_list_page.dart @@ -63,7 +63,7 @@ class _ChannelListPageState extends State { @override Widget build(BuildContext context) { - final user = StreamChat.of(context).user; + final user = StreamChat.of(context).currentUser; if (user == null) { return Offstage(); } diff --git a/packages/stream_chat_v1/lib/channel_page.dart b/packages/stream_chat_v1/lib/channel_page.dart index 571a54d..e67c493 100644 --- a/packages/stream_chat_v1/lib/channel_page.dart +++ b/packages/stream_chat_v1/lib/channel_page.dart @@ -66,7 +66,7 @@ class _ChannelPageState extends State { 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, ); diff --git a/packages/stream_chat_v1/lib/chat_info_screen.dart b/packages/stream_chat_v1/lib/chat_info_screen.dart index 6c6bb1e..0f7a8a9 100644 --- a/packages/stream_chat_v1/lib/chat_info_screen.dart +++ b/packages/stream_chat_v1/lib/chat_info_screen.dart @@ -58,7 +58,7 @@ class _ChatInfoScreenState extends State { '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 { 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!; diff --git a/packages/stream_chat_v1/lib/group_chat_details_screen.dart b/packages/stream_chat_v1/lib/group_chat_details_screen.dart index a2f51ed..b61bf66 100644 --- a/packages/stream_chat_v1/lib/group_chat_details_screen.dart +++ b/packages/stream_chat_v1/lib/group_chat_details_screen.dart @@ -134,7 +134,7 @@ class _GroupChatDetailsScreenState extends State { id: Uuid().v4(), extraData: { 'members': [ - client.state.user!.id, + client.state.currentUser!.id, ..._selectedUsers.map((e) => e.id), ], 'name': groupName, diff --git a/packages/stream_chat_v1/lib/group_info_screen.dart b/packages/stream_chat_v1/lib/group_info_screen.dart index 4193213..02957b4 100644 --- a/packages/stream_chat_v1/lib/group_info_screen.dart +++ b/packages/stream_chat_v1/lib/group_info_screen.dart @@ -87,7 +87,7 @@ class _GroupInfoScreenState extends State { } 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 { 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'); }, @@ -686,7 +686,7 @@ class _GroupInfoScreenState extends State { ); 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); } }, @@ -740,7 +740,7 @@ class _GroupInfoScreenState extends State { 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(((e) => e.userId)) .whereType(), @@ -904,7 +904,7 @@ class _GroupInfoScreenState extends State { ), ), ), - if (StreamChat.of(context).user!.id != user.id) + if (StreamChat.of(context).currentUser!.id != user.id) _buildModalListTile( context, StreamSvgIcon.user( @@ -920,7 +920,7 @@ class _GroupInfoScreenState extends State { var c = client.channel('messaging', extraData: { 'members': [ user.id, - StreamChat.of(context).user!.id, + StreamChat.of(context).currentUser!.id, ], }); @@ -940,7 +940,7 @@ class _GroupInfoScreenState extends State { ); }, ), - if (StreamChat.of(context).user!.id != user.id) + if (StreamChat.of(context).currentUser!.id != user.id) _buildModalListTile( context, StreamSvgIcon.message( @@ -956,7 +956,7 @@ class _GroupInfoScreenState extends State { var c = client.channel('messaging', extraData: { 'members': [ user.id, - StreamChat.of(context).user!.id, + StreamChat.of(context).currentUser!.id, ], }); @@ -986,7 +986,7 @@ class _GroupInfoScreenState extends State { // // 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, @@ -1117,7 +1117,7 @@ class _GroupInfoScreenState extends State { 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!; diff --git a/packages/stream_chat_v1/lib/main.dart b/packages/stream_chat_v1/lib/main.dart index bdbee24..b25c857 100644 --- a/packages/stream_chat_v1/lib/main.dart +++ b/packages/stream_chat_v1/lib/main.dart @@ -133,7 +133,7 @@ class _MyAppState extends State )! ]; }, - initialRoute: _initData!.client.state.user == null + initialRoute: _initData!.client.state.currentUser == null ? Routes.CHOOSE_USER : Routes.HOME, ), diff --git a/packages/stream_chat_v1/lib/new_chat_screen.dart b/packages/stream_chat_v1/lib/new_chat_screen.dart index 41a1ded..7315c71 100644 --- a/packages/stream_chat_v1/lib/new_chat_screen.dart +++ b/packages/stream_chat_v1/lib/new_chat_screen.dart @@ -71,7 +71,7 @@ class _NewChatScreenState extends State { 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 { extraData: { 'members': [ ..._selectedUsers.map((e) => e.id), - chatState.user!.id, + chatState.currentUser!.id, ], }, ); @@ -308,7 +308,7 @@ class _NewChatScreenState extends State { if (_userNameQuery.isNotEmpty) Filter.autoComplete('name', _userNameQuery), Filter.notEqual( - 'id', StreamChat.of(context).user!.id), + 'id', StreamChat.of(context).currentUser!.id), ]), sort: [ SortOption( diff --git a/packages/stream_chat_v1/lib/new_group_chat_screen.dart b/packages/stream_chat_v1/lib/new_group_chat_screen.dart index 414606f..1b21ec5 100644 --- a/packages/stream_chat_v1/lib/new_group_chat_screen.dart +++ b/packages/stream_chat_v1/lib/new_group_chat_screen.dart @@ -248,7 +248,7 @@ class _NewGroupChatScreenState extends State { 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( diff --git a/packages/stream_chat_v1/lib/user_mentions_page.dart b/packages/stream_chat_v1/lib/user_mentions_page.dart index d02bd1c..0128787 100644 --- a/packages/stream_chat_v1/lib/user_mentions_page.dart +++ b/packages/stream_chat_v1/lib/user_mentions_page.dart @@ -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]),