refactor(llc, core, ui): Deprecate .user, .userStream in favor of .currentUser, .currentUserStream

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-07-26 14:57:29 +05:30
committed by xsahil03x
parent 171074368f
commit f7b9511adb
55 changed files with 230 additions and 170 deletions
@@ -116,7 +116,7 @@ class MessageListCoreState extends State<MessageListCore> {
bool get _isThreadConversation => widget.parentMessage != null;
OwnUser? get _currentUser => _streamChannel!.channel.client.state.user;
OwnUser? get _currentUser => _streamChannel!.channel.client.state.currentUser;
var _messages = <Message>[];
@@ -98,10 +98,20 @@ class StreamChatCoreState extends State<StreamChatCore>
Widget build(BuildContext context) => widget.child;
/// The current user
User? get user => client.state.user;
@Deprecated('Use `.currentUser` instead, Will be removed in future releases')
User? get user => client.state.currentUser;
/// The current user as a stream
Stream<User?> get userStream => client.state.userStream;
@Deprecated(
'Use `.currentUserStream` instead, Will be removed in future releases',
)
Stream<User?> get userStream => client.state.currentUserStream;
/// The current user
User? get currentUser => client.state.currentUser;
/// The current user as a stream
Stream<User?> get currentUserStream => client.state.currentUserStream;
StreamSubscription<ConnectivityResult>? _connectivitySubscription;
@@ -126,7 +136,7 @@ class StreamChatCoreState extends State<StreamChatCore>
if (!_isInForeground) return;
if (_isConnectionAvailable) {
if (client.wsConnectionStatus == ConnectionStatus.disconnected &&
user != null) {
currentUser != null) {
client.openConnection();
}
} else {
@@ -163,7 +173,7 @@ class StreamChatCoreState extends State<StreamChatCore>
AppLifecycleState.resumed,
AppLifecycleState.inactive,
].contains(state);
if (user != null) {
if (currentUser != null) {
if (_isInForeground) {
_onForeground();
} else {