From 969eeff636e5d185ba20d1c00fb595121d9d24c3 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Sun, 3 Sep 2023 18:18:44 +0530 Subject: [PATCH 1/9] add ios chat window border Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/overlay.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index f2f3b8fb0..45fa46195 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -400,7 +400,8 @@ void initState() { Container( width: _width, height: _height, - child: widget.builder(context), + decoration: BoxDecoration(border: Border.all(color: MyTheme.border)), + child: widget.builder(context), ), ), ), From 9cce56caf87bb04ba2cb346321421c2690134692 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Mon, 4 Sep 2023 01:45:48 +0530 Subject: [PATCH 2/9] remember chat window last position Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/overlay.dart | 18 +++++++++++++----- flutter/lib/models/chat_model.dart | 9 ++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index 45fa46195..9b0b4e51e 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -16,7 +16,8 @@ class DraggableChatWindow extends StatelessWidget { this.position = Offset.zero, required this.width, required this.height, - required this.chatModel}) + required this.chatModel + }) : super(key: key); final Offset position; @@ -48,6 +49,7 @@ class DraggableChatWindow extends StatelessWidget { position: position, width: width, height: height, + chatModel: chatModel, builder: (context, onPanUpdate) { final child = Scaffold( @@ -242,6 +244,7 @@ class Draggable extends StatefulWidget { this.position = Offset.zero, required this.width, required this.height, + this.chatModel, required this.builder}) : super(key: key); @@ -250,6 +253,7 @@ class Draggable extends StatefulWidget { final Offset position; final double width; final double height; + final ChatModel? chatModel; final Widget Function(BuildContext, GestureDragUpdateCallback) builder; @override @@ -258,6 +262,7 @@ class Draggable extends StatefulWidget { class _DraggableState extends State { late Offset _position; + late ChatModel? _chatModel; bool _keyboardVisible = false; double _saveHeight = 0; double _lastBottomHeight = 0; @@ -266,6 +271,7 @@ class _DraggableState extends State { void initState() { super.initState(); _position = widget.position; + _chatModel = widget.chatModel??null; } void onPanUpdate(DragUpdateDetails d) { @@ -292,6 +298,7 @@ class _DraggableState extends State { setState(() { _position = Offset(x, y); }); + _chatModel?.setChatWindowPosition(_position); } checkScreenSize() {} @@ -351,14 +358,14 @@ class IOSDraggable extends StatefulWidget { const IOSDraggable({ Key? key, this.position = Offset.zero, - required this.chatModel, + this.chatModel, required this.width, required this.height, required this.builder}) : super(key: key); final Offset position; - final ChatModel chatModel; + final ChatModel? chatModel; final double width; final double height; final Widget Function(BuildContext) builder; @@ -369,7 +376,7 @@ class IOSDraggable extends StatefulWidget { class _IOSDraggableState extends State { late Offset _position; -late ChatModel _chatModel; +late ChatModel? _chatModel; late double _width; late double _height; @@ -377,7 +384,7 @@ late double _height; void initState() { super.initState(); _position = widget.position; - _chatModel = widget.chatModel; + _chatModel = widget.chatModel??null; _width = widget.width; _height = widget.height; } @@ -394,6 +401,7 @@ void initState() { setState(() { _position += details.delta; }); + _chatModel?.setChatWindowPosition(_position); }, child: Material( child: diff --git a/flutter/lib/models/chat_model.dart b/flutter/lib/models/chat_model.dart index bffd9d426..042f3852d 100644 --- a/flutter/lib/models/chat_model.dart +++ b/flutter/lib/models/chat_model.dart @@ -72,6 +72,13 @@ class ChatModel with ChangeNotifier { RxInt mobileUnreadSum = 0.obs; MessageKey? latestReceivedKey; + Offset chatWindowPosition = Offset(20, 80); + + void setChatWindowPosition(Offset position) { + chatWindowPosition = position; + notifyListeners(); + } + @override void dispose() { textController.dispose(); @@ -210,7 +217,7 @@ class ChatModel with ChangeNotifier { } }, child: DraggableChatWindow( - position: chatInitPos ?? Offset(20, 80), + position: chatInitPos ?? chatWindowPosition, width: 250, height: 350, chatModel: this)); From d6c23bb5f3c9f71f710a8650e579125e65a4bb99 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Mon, 4 Sep 2023 20:47:45 +0530 Subject: [PATCH 3/9] avoid chat window keyboard overlap ios Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/overlay.dart | 69 +++++++++++++++++++------ 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index 9b0b4e51e..89a4184db 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -16,8 +16,7 @@ class DraggableChatWindow extends StatelessWidget { this.position = Offset.zero, required this.width, required this.height, - required this.chatModel - }) + required this.chatModel}) : super(key: key); final Offset position; @@ -271,7 +270,7 @@ class _DraggableState extends State { void initState() { super.initState(); _position = widget.position; - _chatModel = widget.chatModel??null; + _chatModel = widget.chatModel; } void onPanUpdate(DragUpdateDetails d) { @@ -298,7 +297,7 @@ class _DraggableState extends State { setState(() { _position = Offset(x, y); }); - _chatModel?.setChatWindowPosition(_position); + _chatModel?.setChatWindowPosition(_position); } checkScreenSize() {} @@ -374,20 +373,56 @@ class IOSDraggable extends StatefulWidget { _IOSDraggableState createState() => _IOSDraggableState(); } -class _IOSDraggableState extends State { -late Offset _position; -late ChatModel? _chatModel; -late double _width; -late double _height; +class _IOSDraggableState extends State with WidgetsBindingObserver { + late Offset _position; + late ChatModel? _chatModel; + late double _width; + late double _height; + bool _keyboardVisible = false; + double _saveHeight = 0; + double _lastBottomHeight = 0; -@override -void initState() { - super.initState(); - _position = widget.position; - _chatModel = widget.chatModel??null; - _width = widget.width; - _height = widget.height; -} + @override + void initState() { + super.initState(); + _position = widget.position; + _chatModel = widget.chatModel; + _width = widget.width; + _height = widget.height; + + WidgetsBinding.instance?.addObserver(this); + } + + @override + void dispose() { + WidgetsBinding.instance?.removeObserver(this); + super.dispose(); + } + + @override + void didChangeMetrics() { + final currentVisible = MediaQuery.of(context).viewInsets.bottom != 0; + + if (!_keyboardVisible && currentVisible) { + _saveHeight = _position.dy; + } else if (_lastBottomHeight > 0 && !currentVisible) { + setState(() { + _position = Offset(_position.dx, _saveHeight); + }); + } else if (_keyboardVisible && currentVisible) { + final sumHeight = MediaQuery.of(context).viewInsets.bottom + _height; + final contextHeight = MediaQuery.of(context).size.height; + if (sumHeight + _position.dy > contextHeight) { + final y = contextHeight - sumHeight; + setState(() { + _position = Offset(_position.dx, y); + }); + } + } + + _keyboardVisible = currentVisible; + _lastBottomHeight = MediaQuery.of(context).viewInsets.bottom; + } @override Widget build(BuildContext context) { From 7242d03f568beec3819e0a1aa6235c8e21258780 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 5 Sep 2023 15:09:41 +0800 Subject: [PATCH 4/9] change target android sdk to 33 --- flutter/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/android/app/build.gradle b/flutter/android/app/build.gradle index 326689e5e..f4dc69e41 100644 --- a/flutter/android/app/build.gradle +++ b/flutter/android/app/build.gradle @@ -46,7 +46,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.carriez.flutter_hbb" minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } From f1c0f1d0a4c8ecb5d8190ebd44d422d826eddf6c Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 5 Sep 2023 17:44:49 +0800 Subject: [PATCH 5/9] prepare for https://github.com/rustdesk/rustdesk-server-pro/discussions/65 --- src/common.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common.rs b/src/common.rs index 36ca972b2..8477c9e62 100644 --- a/src/common.rs +++ b/src/common.rs @@ -779,12 +779,18 @@ pub fn get_sysinfo() -> serde_json::Value { os = format!("{os} - {}", system.os_version().unwrap_or_default()); } let hostname = hostname(); // sys.hostname() return localhost on android in my test - serde_json::json!({ + use serde_json::json; + let mut out = json!({ "cpu": format!("{cpu}{num_cpus}/{num_pcpus} cores"), "memory": format!("{memory}GB"), "os": os, "hostname": hostname, - }) + }); + #[cfg(not(any(target_os = "android", target_os = "ios")))] + { + out["username"] = json!(crate::platform::get_active_username()); + } + out } #[inline] From 048e97e1eecf4a9c03509ab00dcff99b7b0a332e Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Tue, 5 Sep 2023 17:40:11 +0530 Subject: [PATCH 6/9] use modified dashchat to fix ios chat window safe area Signed-off-by: Sahil Yeole --- flutter/pubspec.lock | 19 ++++++++++--------- flutter/pubspec.yaml | 4 +++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 960e28338..b6aca5429 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -300,11 +300,12 @@ packages: dash_chat_2: dependency: "direct main" description: - name: dash_chat_2 - sha256: e9e08b2a030d340d60f7adbeb977d3d6481db1f172b51440bfa02488b92fa19c - url: "https://pub.dev" - source: hosted - version: "0.0.17" + path: "." + ref: HEAD + resolved-ref: bd6b5b41254e57c5bcece202ebfb234de63e6487 + url: "https://github.com/rustdesk-org/Dash-Chat-2" + source: git + version: "0.0.18" debounce_throttle: dependency: "direct main" description: @@ -1398,10 +1399,10 @@ packages: dependency: transitive description: name: video_player - sha256: "59f7f31c919c59cbedd37c617317045f5f650dc0eeb568b0b0de9a36472bdb28" + sha256: d3910a8cefc0de8a432a4411dcf85030e885d8fef3ddea291f162253a05dbf01 url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.7.1" video_player_android: dependency: transitive description: @@ -1422,10 +1423,10 @@ packages: dependency: transitive description: name: video_player_platform_interface - sha256: "42bb75de5e9b79e1f20f1d95f688fac0f95beac4d89c6eb2cd421724d4432dae" + sha256: be72301bf2c0150ab35a8c34d66e5a99de525f6de1e8d27c0672b836fe48f73a url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "6.2.1" video_player_web: dependency: transitive description: diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index 691f86066..ba90bef3c 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -39,7 +39,9 @@ dependencies: package_info_plus: ^3.1.2 url_launcher: ^6.0.9 toggle_switch: ^2.1.0 - dash_chat_2: ^0.0.17 + dash_chat_2: + git: + url: https://github.com/rustdesk-org/Dash-Chat-2 draggable_float_widget: ^0.0.2 settings_ui: ^2.0.2 flutter_breadcrumb: ^1.0.1 From 71dbf0fab28c2b1cd4ac6e3b4dbf15b21c1be15a Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Tue, 5 Sep 2023 17:58:22 +0530 Subject: [PATCH 7/9] fix avoid chat window keyboard overlap ios Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/overlay.dart | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index 89a4184db..bae1f7fc0 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -389,28 +389,27 @@ class _IOSDraggableState extends State with WidgetsBindingObserver _chatModel = widget.chatModel; _width = widget.width; _height = widget.height; - - WidgetsBinding.instance?.addObserver(this); } - @override - void dispose() { - WidgetsBinding.instance?.removeObserver(this); - super.dispose(); - } - - @override - void didChangeMetrics() { - final currentVisible = MediaQuery.of(context).viewInsets.bottom != 0; + checkKeyboard() { + final bottomHeight = MediaQuery.of(context).viewInsets.bottom; + final currentVisible = bottomHeight != 0; + // save if (!_keyboardVisible && currentVisible) { _saveHeight = _position.dy; - } else if (_lastBottomHeight > 0 && !currentVisible) { + } + + // reset + if (_lastBottomHeight > 0 && bottomHeight == 0) { setState(() { _position = Offset(_position.dx, _saveHeight); }); - } else if (_keyboardVisible && currentVisible) { - final sumHeight = MediaQuery.of(context).viewInsets.bottom + _height; + } + + // onKeyboardVisible + if (_keyboardVisible && currentVisible) { + final sumHeight = bottomHeight + _height; final contextHeight = MediaQuery.of(context).size.height; if (sumHeight + _position.dy > contextHeight) { final y = contextHeight - sumHeight; @@ -421,11 +420,12 @@ class _IOSDraggableState extends State with WidgetsBindingObserver } _keyboardVisible = currentVisible; - _lastBottomHeight = MediaQuery.of(context).viewInsets.bottom; + _lastBottomHeight = bottomHeight; } @override Widget build(BuildContext context) { + checkKeyboard(); return Stack( children: [ Positioned( From 2ada9fbee393d7c345344dfb346f81a0c1cafd6c Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Tue, 5 Sep 2023 18:21:17 +0530 Subject: [PATCH 8/9] remove WidgetsBindingObserver ios Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/overlay.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index bae1f7fc0..b19034c68 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -373,7 +373,7 @@ class IOSDraggable extends StatefulWidget { _IOSDraggableState createState() => _IOSDraggableState(); } -class _IOSDraggableState extends State with WidgetsBindingObserver { +class _IOSDraggableState extends State { late Offset _position; late ChatModel? _chatModel; late double _width; From 12fbbbb5b33a8d4f5a15e2d68f3f84e3e8ac6702 Mon Sep 17 00:00:00 2001 From: "Miguel F. G" <116861809+flusheDData@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:22:08 +0200 Subject: [PATCH 9/9] Update es.rs New terms added --- src/lang/es.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lang/es.rs b/src/lang/es.rs index 7bb24ac53..35d776f1a 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -538,8 +538,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("pull_ab_failed_tip", "No se ha podido refrescar el directorio"), ("push_ab_failed_tip", "No se ha podido sincronizar el directorio con el servidor"), ("synced_peer_readded_tip", "Los dispositivos presentes en sesiones recientes se sincronizarán con el directorio."), - ("Change Color", ""), - ("Primary Color", ""), - ("HSV Color", ""), + ("Change Color", "Cambiar Color"), + ("Primary Color", "Color Primario"), + ("HSV Color", "Color HSV"), ].iter().cloned().collect(); }