diff --git a/Sources/dafl_project_flutter/lib/controller/controller.dart b/Sources/dafl_project_flutter/lib/controller/controller.dart index 1e697b4..3118055 100644 --- a/Sources/dafl_project_flutter/lib/controller/controller.dart +++ b/Sources/dafl_project_flutter/lib/controller/controller.dart @@ -29,7 +29,6 @@ class Controller { _socket.onDisconnect((data) => print('Socket.io server disconnected')); _socket.on('message', (data) => print(data)); _socket.on('user', (data) => print(data)); - sendStatusConnected(MyApp.controller.currentUser); } sendMessage(String message, User destinataire) { @@ -39,10 +38,9 @@ class Controller { }); } - sendStatusConnected(User user) { - _socket.emit('status', { - 'sender': user.usernameDafl, - }); + sendStatusConnected(User user, int isConnection) { + _socket + .emit('status', {'sender': user.usernameDafl, 'content': isConnection}); } Controller() { diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart index ded3eac..3374709 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart @@ -89,13 +89,13 @@ class _ConversationPageState extends State { void initState() { super.initState(); messageTextField.addListener(_checkIfNull); - MyApp.controller.sendStatusConnected(MyApp.controller.currentUser); + MyApp.controller.sendStatusConnected(MyApp.controller.currentUser, 1); dev.log("INITSATE"); } @override void dispose() { - MyApp.controller.sendStatusConnected(MyApp.controller.currentUser); + MyApp.controller.sendStatusConnected(MyApp.controller.currentUser, 0); super.dispose(); }