From 8a083f40b0a560f18d673751c1ac54cd428aef25 Mon Sep 17 00:00:00 2001 From: csf Date: Mon, 6 Mar 2023 23:37:43 +0900 Subject: [PATCH 1/3] fix mobile change theme failure --- flutter/lib/common.dart | 2 +- src/lang/cn.rs | 2 +- src/lang/tw.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index dc91e9414..3d6f62efc 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -375,7 +375,7 @@ class MyTheme { static void changeDarkMode(ThemeMode mode) async { Get.changeThemeMode(mode); - if (desktopType == DesktopType.main) { + if (desktopType == DesktopType.main || isAndroid || isIOS) { if (mode == ThemeMode.system) { await bind.mainSetLocalOption(key: kCommConfKeyTheme, value: ''); } else { diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 3f4f6d25c..b5f71e588 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -349,7 +349,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Security", "安全"), ("Theme", "主题"), ("Dark Theme", "暗黑主题"), - ("Light Theme", ""), + ("Light Theme", "明亮主题"), ("Dark", "黑暗"), ("Light", "明亮"), ("Follow System", "跟随系统"), diff --git a/src/lang/tw.rs b/src/lang/tw.rs index d0f12cdfa..3fb2297e3 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -349,7 +349,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Security", "安全"), ("Theme", "主題"), ("Dark Theme", "暗黑主題"), - ("Light Theme", ""), + ("Light Theme", "明亮主題"), ("Dark", "黑暗"), ("Light", "明亮"), ("Follow System", "跟隨系統"), From 9f69cf3d6edc76d15a7c82672c0c3245a35ce469 Mon Sep 17 00:00:00 2001 From: csf Date: Tue, 7 Mar 2023 11:08:41 +0900 Subject: [PATCH 2/3] fix mobile server event stream --- flutter/lib/consts.dart | 3 +++ src/flutter.rs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart index 95e4d17e7..e2a3c6f0b 100644 --- a/flutter/lib/consts.dart +++ b/flutter/lib/consts.dart @@ -14,7 +14,10 @@ const String kPeerPlatformAndroid = "Android"; /// [kAppTypeMain] used by 'Desktop Main Page' , 'Mobile (Client and Server)', "Install Page" const String kAppTypeMain = "main"; + +/// [kAppTypeConnectionManager] only for 'Desktop CM Page' const String kAppTypeConnectionManager = "cm"; + const String kAppTypeDesktopRemote = "remote"; const String kAppTypeDesktopFileTransfer = "file transfer"; const String kAppTypeDesktopPortForward = "port forward"; diff --git a/src/flutter.rs b/src/flutter.rs index a39b992bf..354e418eb 100644 --- a/src/flutter.rs +++ b/src/flutter.rs @@ -26,8 +26,14 @@ use std::{ sync::{Arc, RwLock}, }; +/// tag "main" for [Desktop Main Page] and [Mobile (Client and Server)] (the mobile don't need multiple windows, only one global event stream is needed) +/// tag "cm" only for [Desktop CM Page] pub(super) const APP_TYPE_MAIN: &str = "main"; +#[cfg(not(any(target_os = "android", target_os = "ios")))] pub(super) const APP_TYPE_CM: &str = "cm"; +#[cfg(any(target_os = "android", target_os = "ios"))] +pub(super) const APP_TYPE_CM: &str = "main"; + pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote"; pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer"; pub(super) const APP_TYPE_DESKTOP_PORT_FORWARD: &str = "port forward"; From 93d196c2f89929e52c97c992375c459a434a7e45 Mon Sep 17 00:00:00 2001 From: csf Date: Tue, 7 Mar 2023 11:21:23 +0900 Subject: [PATCH 3/3] mobile save config when disable input --- flutter/lib/models/server_model.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flutter/lib/models/server_model.dart b/flutter/lib/models/server_model.dart index 7ee23ec40..90059e47f 100644 --- a/flutter/lib/models/server_model.dart +++ b/flutter/lib/models/server_model.dart @@ -263,8 +263,11 @@ class ServerModel with ChangeNotifier { toggleInput() { if (_inputOk) { parent.target?.invokeMethod("stop_input"); + bind.mainSetOption(key: "enable-keyboard", value: 'N'); } else { if (parent.target != null) { + /// the result of toggle-on depends on user actions in the settings page. + /// handle result, see [ServerModel.changeStatue] showInputWarnAlert(parent.target!); } }