diff --git a/flutter/assets/message_24dp_5F6368.svg b/flutter/assets/message_24dp_5F6368.svg new file mode 100644 index 000000000..5347a3d2d --- /dev/null +++ b/flutter/assets/message_24dp_5F6368.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index e7b4d4d76..d92636301 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -479,8 +479,8 @@ class _RemoteToolbarState extends State { setFullscreen: _setFullscreen, )); toolbarItems.add(_KeyboardMenu(id: widget.id, ffi: widget.ffi)); + toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi)); if (!isWeb) { - toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi)); toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi)); } if (!isWeb) toolbarItems.add(_RecordMenu()); @@ -1781,34 +1781,49 @@ class _ChatMenuState extends State<_ChatMenu> { @override Widget build(BuildContext context) { - return _IconSubmenuButton( - tooltip: 'Chat', - key: chatButtonKey, - svg: 'assets/chat.svg', - ffi: widget.ffi, - color: _ToolbarTheme.blueColor, - hoverColor: _ToolbarTheme.hoverBlueColor, - menuChildrenGetter: () => [textChat(), voiceCall()]); + if (isWeb) { + return buildTextChatButton(); + } else { + return _IconSubmenuButton( + tooltip: 'Chat', + key: chatButtonKey, + svg: 'assets/chat.svg', + ffi: widget.ffi, + color: _ToolbarTheme.blueColor, + hoverColor: _ToolbarTheme.hoverBlueColor, + menuChildrenGetter: () => [textChat(), voiceCall()]); + } + } + + buildTextChatButton() { + return _IconMenuButton( + assetName: 'assets/message_24dp_5F6368.svg', + tooltip: 'Text chat', + key: chatButtonKey, + onPressed: _textChatOnPressed, + color: _ToolbarTheme.blueColor, + hoverColor: _ToolbarTheme.hoverBlueColor, + ); } textChat() { return MenuButton( child: Text(translate('Text chat')), ffi: widget.ffi, - onPressed: () { - RenderBox? renderBox = - chatButtonKey.currentContext?.findRenderObject() as RenderBox?; + onPressed: _textChatOnPressed); + } - Offset? initPos; - if (renderBox != null) { - final pos = renderBox.localToGlobal(Offset.zero); - initPos = Offset(pos.dx, pos.dy + _ToolbarTheme.dividerHeight); - } - - widget.ffi.chatModel.changeCurrentKey( - MessageKey(widget.ffi.id, ChatModel.clientModeID)); - widget.ffi.chatModel.toggleChatOverlay(chatInitPos: initPos); - }); + _textChatOnPressed() { + RenderBox? renderBox = + chatButtonKey.currentContext?.findRenderObject() as RenderBox?; + Offset? initPos; + if (renderBox != null) { + final pos = renderBox.localToGlobal(Offset.zero); + initPos = Offset(pos.dx, pos.dy + _ToolbarTheme.dividerHeight); + } + widget.ffi.chatModel + .changeCurrentKey(MessageKey(widget.ffi.id, ChatModel.clientModeID)); + widget.ffi.chatModel.toggleChatOverlay(chatInitPos: initPos); } voiceCall() { diff --git a/flutter/lib/models/chat_model.dart b/flutter/lib/models/chat_model.dart index 778c94357..d79c9f070 100644 --- a/flutter/lib/models/chat_model.dart +++ b/flutter/lib/models/chat_model.dart @@ -235,13 +235,14 @@ class ChatModel with ChangeNotifier { } } - _isChatOverlayHide() => ((!isDesktop && chatIconOverlayEntry == null) || - chatWindowOverlayEntry == null); + _isChatOverlayHide() => + ((!(isDesktop || isWebDesktop) && chatIconOverlayEntry == null) || + chatWindowOverlayEntry == null); toggleChatOverlay({Offset? chatInitPos}) { if (_isChatOverlayHide()) { gFFI.invokeMethod("enable_soft_keyboard", true); - if (!isDesktop) { + if (!(isDesktop || isWebDesktop)) { showChatIconOverlay(); } showChatWindowOverlay(chatInitPos: chatInitPos); diff --git a/flutter/lib/web/bridge.dart b/flutter/lib/web/bridge.dart index 6e02328b4..321fdcd5a 100644 --- a/flutter/lib/web/bridge.dart +++ b/flutter/lib/web/bridge.dart @@ -468,7 +468,8 @@ class RustdeskImpl { Future sessionSendChat( {required UuidValue sessionId, required String text, dynamic hint}) { - throw UnimplementedError(); + return Future( + () => js.context.callMethod('setByName', ['send_chat', text])); } Future sessionPeerOption( @@ -1188,7 +1189,8 @@ class RustdeskImpl { Future sessionSendNote( {required UuidValue sessionId, required String note, dynamic hint}) { - return Future(() => js.context.callMethod('setByName', ['send_note', note])); + return Future( + () => js.context.callMethod('setByName', ['send_note', note])); } Future sessionAlternativeCodecs(