fix(llc): update currentUser after successful connection

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-07-27 20:23:28 +05:30
committed by xsahil03x
parent 39449e5700
commit f6cf835b4e
2 changed files with 4 additions and 8 deletions
@@ -325,8 +325,8 @@ class StreamChatClient {
_chatPersistenceClient = _originalChatPersistenceClient; _chatPersistenceClient = _originalChatPersistenceClient;
await _chatPersistenceClient!.connect(ownUser.id); await _chatPersistenceClient!.connect(ownUser.id);
} }
final res = await openConnection(); final connectedUser = await openConnection();
return res; return state.currentUser = connectedUser;
} catch (e, stk) { } catch (e, stk) {
if (e is StreamWebSocketError && e.isRetriable) { if (e is StreamWebSocketError && e.isRetriable) {
final event = await _chatPersistenceClient?.getConnectionInfo(); final event = await _chatPersistenceClient?.getConnectionInfo();
@@ -23,16 +23,12 @@ void main() async {
/// ///
/// Please see the following for more information: /// Please see the following for more information:
/// https://getstream.io/chat/docs/ios_user_setup_and_tokens/ /// https://getstream.io/chat/docs/ios_user_setup_and_tokens/
await client.connectUser( final res = await client.connectUser(
User(id: 'super-band-9', language: 'fr'), User(id: 'super-band-9'),
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.' 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.'
'0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', '0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A',
); );
client.on().listen((e) {
print('e.user.language ${e.me?.language}');
});
final channel = client.channel('messaging', id: 'godevs'); final channel = client.channel('messaging', id: 'godevs');
await channel.watch(); await channel.watch();