| 
									
										
										
										
											2022-07-14 17:44:37 +08:00
										 |  |  | import 'dart:async'; | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  | import 'dart:convert'; | 
					
						
							| 
									
										
										
										
											2022-06-13 21:07:26 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  | import 'package:flutter_hbb/common/widgets/setting_widgets.dart'; | 
					
						
							| 
									
										
										
										
											2024-07-15 18:53:14 +08:00
										 |  |  | import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart'; | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  | import 'package:get/get.dart'; | 
					
						
							| 
									
										
										
										
											2022-06-13 21:07:26 +08:00
										 |  |  | import 'package:provider/provider.dart'; | 
					
						
							|  |  |  | import 'package:settings_ui/settings_ui.dart'; | 
					
						
							|  |  |  | import 'package:url_launcher/url_launcher.dart'; | 
					
						
							| 
									
										
										
										
											2023-09-08 11:29:47 +08:00
										 |  |  | import 'package:url_launcher/url_launcher_string.dart'; | 
					
						
							| 
									
										
										
										
											2022-06-13 21:07:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-24 23:33:00 +08:00
										 |  |  | import '../../common.dart'; | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  | import '../../common/widgets/dialog.dart'; | 
					
						
							| 
									
										
										
										
											2023-01-08 23:30:34 +09:00
										 |  |  | import '../../common/widgets/login.dart'; | 
					
						
							| 
									
										
										
										
											2023-02-28 00:41:09 +09:00
										 |  |  | import '../../consts.dart'; | 
					
						
							| 
									
										
										
										
											2022-05-24 23:33:00 +08:00
										 |  |  | import '../../models/model.dart'; | 
					
						
							| 
									
										
										
										
											2022-08-05 20:29:43 +08:00
										 |  |  | import '../../models/platform_model.dart'; | 
					
						
							| 
									
										
										
										
											2022-06-13 21:07:26 +08:00
										 |  |  | import '../widgets/dialog.dart'; | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | import 'home_page.dart'; | 
					
						
							| 
									
										
										
										
											2022-04-15 17:50:15 +08:00
										 |  |  | import 'scan_page.dart'; | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  | class SettingsPage extends StatefulWidget implements PageShape { | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |   @override | 
					
						
							| 
									
										
										
										
											2022-03-23 15:28:21 +08:00
										 |  |  |   final title = translate("Settings"); | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   final icon = Icon(Icons.settings); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |   final appBarActions = bind.isDisableSettings() ? [] : [ScanButton()]; | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  |   @override | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |   State<SettingsPage> createState() => _SettingsState(); | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  | const url = 'https://rustdesk.com/'; | 
					
						
							| 
									
										
										
										
											2022-07-14 17:44:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-13 18:30:29 +08:00
										 |  |  | enum KeepScreenOn { | 
					
						
							|  |  |  |   never, | 
					
						
							|  |  |  |   duringControlled, | 
					
						
							|  |  |  |   serviceOn, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | String _keepScreenOnToOption(KeepScreenOn value) { | 
					
						
							|  |  |  |   switch (value) { | 
					
						
							|  |  |  |     case KeepScreenOn.never: | 
					
						
							|  |  |  |       return 'never'; | 
					
						
							|  |  |  |     case KeepScreenOn.duringControlled: | 
					
						
							|  |  |  |       return 'during-controlled'; | 
					
						
							|  |  |  |     case KeepScreenOn.serviceOn: | 
					
						
							|  |  |  |       return 'service-on'; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | KeepScreenOn optionToKeepScreenOn(String value) { | 
					
						
							|  |  |  |   switch (value) { | 
					
						
							|  |  |  |     case 'never': | 
					
						
							|  |  |  |       return KeepScreenOn.never; | 
					
						
							|  |  |  |     case 'service-on': | 
					
						
							|  |  |  |       return KeepScreenOn.serviceOn; | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |       return KeepScreenOn.duringControlled; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  | class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver { | 
					
						
							| 
									
										
										
										
											2024-06-07 11:04:18 +08:00
										 |  |  |   final _hasIgnoreBattery = | 
					
						
							|  |  |  |       false; //androidVersion >= 26; // remove because not work on every device
 | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |   var _ignoreBatteryOpt = false; | 
					
						
							|  |  |  |   var _enableStartOnBoot = false; | 
					
						
							| 
									
										
										
										
											2024-06-07 11:04:18 +08:00
										 |  |  |   var _floatingWindowDisabled = false; | 
					
						
							| 
									
										
										
										
											2024-06-13 18:30:29 +08:00
										 |  |  |   var _keepScreenOn = KeepScreenOn.duringControlled; // relay on floating window
 | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |   var _enableAbr = false; | 
					
						
							|  |  |  |   var _denyLANDiscovery = false; | 
					
						
							|  |  |  |   var _onlyWhiteList = false; | 
					
						
							|  |  |  |   var _enableDirectIPAccess = false; | 
					
						
							|  |  |  |   var _enableRecordSession = false; | 
					
						
							| 
									
										
										
										
											2024-05-13 12:39:04 +08:00
										 |  |  |   var _enableHardwareCodec = false; | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |   var _autoRecordIncomingSession = false; | 
					
						
							| 
									
										
										
										
											2023-09-13 13:45:40 +08:00
										 |  |  |   var _allowAutoDisconnect = false; | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |   var _localIP = ""; | 
					
						
							|  |  |  |   var _directAccessPort = ""; | 
					
						
							| 
									
										
										
										
											2023-04-19 14:39:22 +08:00
										 |  |  |   var _fingerprint = ""; | 
					
						
							| 
									
										
										
										
											2023-06-19 15:06:40 +08:00
										 |  |  |   var _buildDate = ""; | 
					
						
							| 
									
										
										
										
											2023-09-13 13:45:40 +08:00
										 |  |  |   var _autoDisconnectTimeout = ""; | 
					
						
							| 
									
										
										
										
											2024-07-15 18:53:14 +08:00
										 |  |  |   var _hideServer = false; | 
					
						
							|  |  |  |   var _hideProxy = false; | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |   var _hideNetwork = false; | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-25 10:45:51 +08:00
										 |  |  |   _SettingsState() { | 
					
						
							| 
									
										
										
										
											2024-06-18 08:29:10 +08:00
										 |  |  |     _enableAbr = option2bool( | 
					
						
							|  |  |  |         kOptionEnableAbr, bind.mainGetOptionSync(key: kOptionEnableAbr)); | 
					
						
							|  |  |  |     _denyLANDiscovery = !option2bool(kOptionEnableLanDiscovery, | 
					
						
							|  |  |  |         bind.mainGetOptionSync(key: kOptionEnableLanDiscovery)); | 
					
						
							| 
									
										
										
										
											2024-07-22 17:00:29 +08:00
										 |  |  |     _onlyWhiteList = whitelistNotEmpty(); | 
					
						
							| 
									
										
										
										
											2024-06-18 08:29:10 +08:00
										 |  |  |     _enableDirectIPAccess = option2bool( | 
					
						
							|  |  |  |         kOptionDirectServer, bind.mainGetOptionSync(key: kOptionDirectServer)); | 
					
						
							|  |  |  |     _enableRecordSession = option2bool(kOptionEnableRecordSession, | 
					
						
							|  |  |  |         bind.mainGetOptionSync(key: kOptionEnableRecordSession)); | 
					
						
							|  |  |  |     _enableHardwareCodec = option2bool(kOptionEnableHwcodec, | 
					
						
							|  |  |  |         bind.mainGetOptionSync(key: kOptionEnableHwcodec)); | 
					
						
							|  |  |  |     _autoRecordIncomingSession = option2bool(kOptionAllowAutoRecordIncoming, | 
					
						
							|  |  |  |         bind.mainGetOptionSync(key: kOptionAllowAutoRecordIncoming)); | 
					
						
							|  |  |  |     _localIP = bind.mainGetOptionSync(key: 'local-ip-addr'); | 
					
						
							|  |  |  |     _directAccessPort = bind.mainGetOptionSync(key: kOptionDirectAccessPort); | 
					
						
							|  |  |  |     _allowAutoDisconnect = option2bool(kOptionAllowAutoDisconnect, | 
					
						
							|  |  |  |         bind.mainGetOptionSync(key: kOptionAllowAutoDisconnect)); | 
					
						
							|  |  |  |     _autoDisconnectTimeout = | 
					
						
							|  |  |  |         bind.mainGetOptionSync(key: kOptionAutoDisconnectTimeout); | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |     _hideServer = | 
					
						
							|  |  |  |         bind.mainGetBuildinOption(key: kOptionHideServerSetting) == 'Y'; | 
					
						
							|  |  |  |     _hideProxy = bind.mainGetBuildinOption(key: kOptionHideProxySetting) == 'Y'; | 
					
						
							|  |  |  |     _hideNetwork = | 
					
						
							|  |  |  |         bind.mainGetBuildinOption(key: kOptionHideNetworkSetting) == 'Y'; | 
					
						
							| 
									
										
										
										
											2024-07-25 10:45:51 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void initState() { | 
					
						
							|  |  |  |     super.initState(); | 
					
						
							|  |  |  |     WidgetsBinding.instance.addObserver(this); | 
					
						
							| 
									
										
										
										
											2024-06-18 08:29:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-24 14:00:49 +08:00
										 |  |  |     WidgetsBinding.instance.addPostFrameCallback((_) async { | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |       var update = false; | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |       if (_hasIgnoreBattery) { | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |         if (await checkAndUpdateIgnoreBatteryStatus()) { | 
					
						
							|  |  |  |           update = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 22:26:47 +09:00
										 |  |  |       if (await checkAndUpdateStartOnBoot()) { | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |         update = true; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // start on boot depends on ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS and SYSTEM_ALERT_WINDOW
 | 
					
						
							|  |  |  |       var enableStartOnBoot = | 
					
						
							|  |  |  |           await gFFI.invokeMethod(AndroidChannel.kGetStartOnBootOpt); | 
					
						
							|  |  |  |       if (enableStartOnBoot) { | 
					
						
							| 
									
										
										
										
											2023-02-28 22:26:47 +09:00
										 |  |  |         if (!await canStartOnBoot()) { | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |           enableStartOnBoot = false; | 
					
						
							|  |  |  |           gFFI.invokeMethod(AndroidChannel.kSetStartOnBootOpt, false); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |       if (enableStartOnBoot != _enableStartOnBoot) { | 
					
						
							|  |  |  |         update = true; | 
					
						
							|  |  |  |         _enableStartOnBoot = enableStartOnBoot; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-07 11:04:18 +08:00
										 |  |  |       var floatingWindowDisabled = | 
					
						
							|  |  |  |           bind.mainGetLocalOption(key: kOptionDisableFloatingWindow) == "Y" || | 
					
						
							|  |  |  |               !await AndroidPermissionManager.check(kSystemAlertWindow); | 
					
						
							|  |  |  |       if (floatingWindowDisabled != _floatingWindowDisabled) { | 
					
						
							|  |  |  |         update = true; | 
					
						
							|  |  |  |         _floatingWindowDisabled = floatingWindowDisabled; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-13 18:30:29 +08:00
										 |  |  |       final keepScreenOn = _floatingWindowDisabled | 
					
						
							|  |  |  |           ? KeepScreenOn.never | 
					
						
							|  |  |  |           : optionToKeepScreenOn( | 
					
						
							|  |  |  |               bind.mainGetLocalOption(key: kOptionKeepScreenOn)); | 
					
						
							|  |  |  |       if (keepScreenOn != _keepScreenOn) { | 
					
						
							|  |  |  |         update = true; | 
					
						
							|  |  |  |         _keepScreenOn = keepScreenOn; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 14:39:22 +08:00
										 |  |  |       final fingerprint = await bind.mainGetFingerprint(); | 
					
						
							|  |  |  |       if (_fingerprint != fingerprint) { | 
					
						
							|  |  |  |         update = true; | 
					
						
							|  |  |  |         _fingerprint = fingerprint; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-19 15:06:40 +08:00
										 |  |  |       final buildDate = await bind.mainGetBuildDate(); | 
					
						
							|  |  |  |       if (_buildDate != buildDate) { | 
					
						
							|  |  |  |         update = true; | 
					
						
							|  |  |  |         _buildDate = buildDate; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |       if (update) { | 
					
						
							|  |  |  |         setState(() {}); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-07-24 14:00:49 +08:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void dispose() { | 
					
						
							|  |  |  |     WidgetsBinding.instance.removeObserver(this); | 
					
						
							|  |  |  |     super.dispose(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void didChangeAppLifecycleState(AppLifecycleState state) { | 
					
						
							|  |  |  |     if (state == AppLifecycleState.resumed) { | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |       () async { | 
					
						
							| 
									
										
										
										
											2023-02-28 22:26:47 +09:00
										 |  |  |         final ibs = await checkAndUpdateIgnoreBatteryStatus(); | 
					
						
							|  |  |  |         final sob = await checkAndUpdateStartOnBoot(); | 
					
						
							|  |  |  |         if (ibs || sob) { | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |           setState(() {}); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }(); | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |   Future<bool> checkAndUpdateIgnoreBatteryStatus() async { | 
					
						
							| 
									
										
										
										
											2023-02-28 21:02:42 +09:00
										 |  |  |     final res = await AndroidPermissionManager.check( | 
					
						
							|  |  |  |         kRequestIgnoreBatteryOptimizations); | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |     if (_ignoreBatteryOpt != res) { | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |       _ignoreBatteryOpt = res; | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |       return true; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       return false; | 
					
						
							| 
									
										
										
										
											2022-07-14 17:44:37 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 22:26:47 +09:00
										 |  |  |   Future<bool> checkAndUpdateStartOnBoot() async { | 
					
						
							|  |  |  |     if (!await canStartOnBoot() && _enableStartOnBoot) { | 
					
						
							|  |  |  |       _enableStartOnBoot = false; | 
					
						
							|  |  |  |       debugPrint( | 
					
						
							|  |  |  |           "checkAndUpdateStartOnBoot and set _enableStartOnBoot -> false"); | 
					
						
							|  |  |  |       gFFI.invokeMethod(AndroidChannel.kSetStartOnBootOpt, false); | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |       return true; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  |     Provider.of<FfiModel>(context); | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |     final outgoingOnly = bind.isOutgoingOnly(); | 
					
						
							| 
									
										
										
										
											2024-04-19 12:44:52 +08:00
										 |  |  |     final customClientSection = CustomSettingsSection( | 
					
						
							|  |  |  |         child: Column( | 
					
						
							|  |  |  |       children: [ | 
					
						
							|  |  |  |         if (bind.isCustomClient()) | 
					
						
							|  |  |  |           Align( | 
					
						
							|  |  |  |             alignment: Alignment.center, | 
					
						
							|  |  |  |             child: loadPowered(context), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         Align( | 
					
						
							|  |  |  |           alignment: Alignment.center, | 
					
						
							|  |  |  |           child: loadLogo(), | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |     )); | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |     final List<AbstractSettingsTile> enhancementsTiles = []; | 
					
						
							|  |  |  |     final List<AbstractSettingsTile> shareScreenTiles = [ | 
					
						
							| 
									
										
										
										
											2024-01-19 15:35:58 +08:00
										 |  |  |       SettingsTile.switchTile( | 
					
						
							|  |  |  |         title: Text(translate('enable-2fa-title')), | 
					
						
							|  |  |  |         initialValue: bind.mainHasValid2FaSync(), | 
					
						
							|  |  |  |         onToggle: (_) async { | 
					
						
							|  |  |  |           update() async { | 
					
						
							|  |  |  |             setState(() {}); | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2024-02-12 21:39:19 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-19 15:35:58 +08:00
										 |  |  |           change2fa(callback: update); | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ), | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  |       SettingsTile.switchTile( | 
					
						
							| 
									
										
										
										
											2023-11-06 20:12:01 +08:00
										 |  |  |         title: Text(translate('Deny LAN discovery')), | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  |         initialValue: _denyLANDiscovery, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |         onToggle: isOptionFixed(kOptionEnableLanDiscovery) | 
					
						
							|  |  |  |             ? null | 
					
						
							|  |  |  |             : (v) async { | 
					
						
							|  |  |  |                 await bind.mainSetOption( | 
					
						
							|  |  |  |                     key: kOptionEnableLanDiscovery, | 
					
						
							|  |  |  |                     value: bool2option(kOptionEnableLanDiscovery, !v)); | 
					
						
							|  |  |  |                 final newValue = !option2bool(kOptionEnableLanDiscovery, | 
					
						
							|  |  |  |                     await bind.mainGetOption(key: kOptionEnableLanDiscovery)); | 
					
						
							|  |  |  |                 setState(() { | 
					
						
							|  |  |  |                   _denyLANDiscovery = newValue; | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  |       ), | 
					
						
							|  |  |  |       SettingsTile.switchTile( | 
					
						
							|  |  |  |         title: Row(children: [ | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |           Expanded(child: Text(translate('Use IP Whitelisting'))), | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  |           Offstage( | 
					
						
							|  |  |  |                   offstage: !_onlyWhiteList, | 
					
						
							|  |  |  |                   child: const Icon(Icons.warning_amber_rounded, | 
					
						
							|  |  |  |                       color: Color.fromARGB(255, 255, 204, 0))) | 
					
						
							|  |  |  |               .marginOnly(left: 5) | 
					
						
							|  |  |  |         ]), | 
					
						
							|  |  |  |         initialValue: _onlyWhiteList, | 
					
						
							|  |  |  |         onToggle: (_) async { | 
					
						
							| 
									
										
										
										
											2024-05-18 23:13:54 +08:00
										 |  |  |           update() async { | 
					
						
							| 
									
										
										
										
											2024-07-22 17:00:29 +08:00
										 |  |  |             final onlyWhiteList = whitelistNotEmpty(); | 
					
						
							| 
									
										
										
										
											2024-05-18 23:13:54 +08:00
										 |  |  |             if (onlyWhiteList != _onlyWhiteList) { | 
					
						
							|  |  |  |               setState(() { | 
					
						
							|  |  |  |                 _onlyWhiteList = onlyWhiteList; | 
					
						
							|  |  |  |               }); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           changeWhiteList(callback: update); | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |       ), | 
					
						
							|  |  |  |       SettingsTile.switchTile( | 
					
						
							| 
									
										
										
										
											2023-08-07 14:20:20 +02:00
										 |  |  |         title: Text('${translate('Adaptive bitrate')} (beta)'), | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |         initialValue: _enableAbr, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |         onToggle: isOptionFixed(kOptionEnableAbr) | 
					
						
							|  |  |  |             ? null | 
					
						
							|  |  |  |             : (v) async { | 
					
						
							| 
									
										
										
										
											2024-06-10 11:01:39 +08:00
										 |  |  |                 await mainSetBoolOption(kOptionEnableAbr, v); | 
					
						
							|  |  |  |                 final newValue = await mainGetBoolOption(kOptionEnableAbr); | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 setState(() { | 
					
						
							|  |  |  |                   _enableAbr = newValue; | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |       ), | 
					
						
							| 
									
										
										
										
											2022-10-25 10:16:11 +09:00
										 |  |  |       SettingsTile.switchTile( | 
					
						
							| 
									
										
										
										
											2023-11-06 20:12:01 +08:00
										 |  |  |         title: Text(translate('Enable recording session')), | 
					
						
							| 
									
										
										
										
											2022-10-25 10:16:11 +09:00
										 |  |  |         initialValue: _enableRecordSession, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |         onToggle: isOptionFixed(kOptionEnableRecordSession) | 
					
						
							|  |  |  |             ? null | 
					
						
							|  |  |  |             : (v) async { | 
					
						
							| 
									
										
										
										
											2024-06-10 11:01:39 +08:00
										 |  |  |                 await mainSetBoolOption(kOptionEnableRecordSession, v); | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 final newValue = | 
					
						
							| 
									
										
										
										
											2024-06-10 11:01:39 +08:00
										 |  |  |                     await mainGetBoolOption(kOptionEnableRecordSession); | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 setState(() { | 
					
						
							|  |  |  |                   _enableRecordSession = newValue; | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
										
										
											2022-10-25 10:16:11 +09:00
										 |  |  |       ), | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |       SettingsTile.switchTile( | 
					
						
							|  |  |  |         title: Row( | 
					
						
							|  |  |  |             mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |             crossAxisAlignment: CrossAxisAlignment.center, | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               Expanded( | 
					
						
							|  |  |  |                   child: Column( | 
					
						
							|  |  |  |                       crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                       children: [ | 
					
						
							|  |  |  |                     Text(translate("Direct IP Access")), | 
					
						
							|  |  |  |                     Offstage( | 
					
						
							|  |  |  |                         offstage: !_enableDirectIPAccess, | 
					
						
							|  |  |  |                         child: Text( | 
					
						
							|  |  |  |                           '${translate("Local Address")}: $_localIP${_directAccessPort.isEmpty ? "" : ":$_directAccessPort"}', | 
					
						
							|  |  |  |                           style: Theme.of(context).textTheme.bodySmall, | 
					
						
							|  |  |  |                         )), | 
					
						
							|  |  |  |                   ])), | 
					
						
							|  |  |  |               Offstage( | 
					
						
							|  |  |  |                   offstage: !_enableDirectIPAccess, | 
					
						
							|  |  |  |                   child: IconButton( | 
					
						
							|  |  |  |                       padding: EdgeInsets.zero, | 
					
						
							|  |  |  |                       icon: Icon( | 
					
						
							|  |  |  |                         Icons.edit, | 
					
						
							|  |  |  |                         size: 20, | 
					
						
							|  |  |  |                       ), | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                       onPressed: isOptionFixed(kOptionDirectAccessPort) | 
					
						
							|  |  |  |                           ? null | 
					
						
							|  |  |  |                           : () async { | 
					
						
							|  |  |  |                               final port = await changeDirectAccessPort( | 
					
						
							|  |  |  |                                   _localIP, _directAccessPort); | 
					
						
							|  |  |  |                               setState(() { | 
					
						
							|  |  |  |                                 _directAccessPort = port; | 
					
						
							|  |  |  |                               }); | 
					
						
							|  |  |  |                             })) | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |             ]), | 
					
						
							|  |  |  |         initialValue: _enableDirectIPAccess, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |         onToggle: isOptionFixed(kOptionDirectServer) | 
					
						
							|  |  |  |             ? null | 
					
						
							|  |  |  |             : (_) async { | 
					
						
							|  |  |  |                 _enableDirectIPAccess = !_enableDirectIPAccess; | 
					
						
							|  |  |  |                 String value = | 
					
						
							|  |  |  |                     bool2option(kOptionDirectServer, _enableDirectIPAccess); | 
					
						
							|  |  |  |                 await bind.mainSetOption( | 
					
						
							|  |  |  |                     key: kOptionDirectServer, value: value); | 
					
						
							|  |  |  |                 setState(() {}); | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
										
										
											2023-09-13 13:45:40 +08:00
										 |  |  |       ), | 
					
						
							|  |  |  |       SettingsTile.switchTile( | 
					
						
							|  |  |  |         title: Row( | 
					
						
							|  |  |  |             mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |             crossAxisAlignment: CrossAxisAlignment.center, | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               Expanded( | 
					
						
							|  |  |  |                   child: Column( | 
					
						
							|  |  |  |                       crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                       children: [ | 
					
						
							|  |  |  |                     Text(translate("auto_disconnect_option_tip")), | 
					
						
							|  |  |  |                     Offstage( | 
					
						
							|  |  |  |                         offstage: !_allowAutoDisconnect, | 
					
						
							|  |  |  |                         child: Text( | 
					
						
							|  |  |  |                           '${_autoDisconnectTimeout.isEmpty ? '10' : _autoDisconnectTimeout} min', | 
					
						
							|  |  |  |                           style: Theme.of(context).textTheme.bodySmall, | 
					
						
							|  |  |  |                         )), | 
					
						
							|  |  |  |                   ])), | 
					
						
							|  |  |  |               Offstage( | 
					
						
							|  |  |  |                   offstage: !_allowAutoDisconnect, | 
					
						
							|  |  |  |                   child: IconButton( | 
					
						
							|  |  |  |                       padding: EdgeInsets.zero, | 
					
						
							|  |  |  |                       icon: Icon( | 
					
						
							|  |  |  |                         Icons.edit, | 
					
						
							|  |  |  |                         size: 20, | 
					
						
							|  |  |  |                       ), | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                       onPressed: isOptionFixed(kOptionAutoDisconnectTimeout) | 
					
						
							|  |  |  |                           ? null | 
					
						
							|  |  |  |                           : () async { | 
					
						
							|  |  |  |                               final timeout = await changeAutoDisconnectTimeout( | 
					
						
							|  |  |  |                                   _autoDisconnectTimeout); | 
					
						
							|  |  |  |                               setState(() { | 
					
						
							|  |  |  |                                 _autoDisconnectTimeout = timeout; | 
					
						
							|  |  |  |                               }); | 
					
						
							|  |  |  |                             })) | 
					
						
							| 
									
										
										
										
											2023-09-13 13:45:40 +08:00
										 |  |  |             ]), | 
					
						
							|  |  |  |         initialValue: _allowAutoDisconnect, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |         onToggle: isOptionFixed(kOptionAllowAutoDisconnect) | 
					
						
							|  |  |  |             ? null | 
					
						
							|  |  |  |             : (_) async { | 
					
						
							|  |  |  |                 _allowAutoDisconnect = !_allowAutoDisconnect; | 
					
						
							|  |  |  |                 String value = bool2option( | 
					
						
							|  |  |  |                     kOptionAllowAutoDisconnect, _allowAutoDisconnect); | 
					
						
							|  |  |  |                 await bind.mainSetOption( | 
					
						
							|  |  |  |                     key: kOptionAllowAutoDisconnect, value: value); | 
					
						
							|  |  |  |                 setState(() {}); | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
										
										
											2022-09-26 11:21:40 +08:00
										 |  |  |       ) | 
					
						
							|  |  |  |     ]; | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |     if (_hasIgnoreBattery) { | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:41 +08:00
										 |  |  |       enhancementsTiles.insert( | 
					
						
							|  |  |  |           0, | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |           SettingsTile.switchTile( | 
					
						
							|  |  |  |               initialValue: _ignoreBatteryOpt, | 
					
						
							| 
									
										
										
										
											2022-09-29 13:07:20 +08:00
										 |  |  |               title: Column( | 
					
						
							|  |  |  |                   crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                   children: [ | 
					
						
							|  |  |  |                     Text(translate('Keep RustDesk background service')), | 
					
						
							|  |  |  |                     Text('* ${translate('Ignore Battery Optimizations')}', | 
					
						
							|  |  |  |                         style: Theme.of(context).textTheme.bodySmall), | 
					
						
							|  |  |  |                   ]), | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |               onToggle: (v) async { | 
					
						
							|  |  |  |                 if (v) { | 
					
						
							| 
									
										
										
										
											2023-02-28 21:02:42 +09:00
										 |  |  |                   await AndroidPermissionManager.request( | 
					
						
							|  |  |  |                       kRequestIgnoreBatteryOptimizations); | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2023-06-10 07:08:10 +08:00
										 |  |  |                   final res = await gFFI.dialogManager.show<bool>( | 
					
						
							|  |  |  |                       (setState, close, context) => CustomAlertDialog( | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |                             title: Text(translate("Open System Setting")), | 
					
						
							|  |  |  |                             content: Text(translate( | 
					
						
							|  |  |  |                                 "android_open_battery_optimizations_tip")), | 
					
						
							|  |  |  |                             actions: [ | 
					
						
							| 
									
										
										
										
											2023-01-15 19:46:16 +08:00
										 |  |  |                               dialogButton("Cancel", | 
					
						
							|  |  |  |                                   onPressed: () => close(), isOutline: true), | 
					
						
							|  |  |  |                               dialogButton( | 
					
						
							|  |  |  |                                 "Open System Setting", | 
					
						
							|  |  |  |                                 onPressed: () => close(true), | 
					
						
							|  |  |  |                               ), | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |                             ], | 
					
						
							|  |  |  |                           )); | 
					
						
							|  |  |  |                   if (res == true) { | 
					
						
							| 
									
										
										
										
											2023-02-28 19:46:41 +09:00
										 |  |  |                     AndroidPermissionManager.startAction( | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |                         kActionApplicationDetailsSettings); | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:41 +08:00
										 |  |  |                   } | 
					
						
							| 
									
										
										
										
											2022-07-16 22:31:44 +08:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:41 +08:00
										 |  |  |               })); | 
					
						
							| 
									
										
										
										
											2022-07-14 17:44:37 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |     enhancementsTiles.add(SettingsTile.switchTile( | 
					
						
							|  |  |  |         initialValue: _enableStartOnBoot, | 
					
						
							|  |  |  |         title: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | 
					
						
							| 
									
										
										
										
											2023-11-06 20:12:01 +08:00
										 |  |  |           Text("${translate('Start on boot')} (beta)"), | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |           Text( | 
					
						
							| 
									
										
										
										
											2023-03-01 00:14:37 +09:00
										 |  |  |               '* ${translate('Start the screen sharing service on boot, requires special permissions')}', | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |               style: Theme.of(context).textTheme.bodySmall), | 
					
						
							|  |  |  |         ]), | 
					
						
							| 
									
										
										
										
											2023-02-28 21:02:42 +09:00
										 |  |  |         onToggle: (toValue) async { | 
					
						
							|  |  |  |           if (toValue) { | 
					
						
							|  |  |  |             // 1. request kIgnoreBatteryOptimizations
 | 
					
						
							|  |  |  |             if (!await AndroidPermissionManager.check( | 
					
						
							|  |  |  |                 kRequestIgnoreBatteryOptimizations)) { | 
					
						
							|  |  |  |               if (!await AndroidPermissionManager.request( | 
					
						
							|  |  |  |                   kRequestIgnoreBatteryOptimizations)) { | 
					
						
							|  |  |  |                 return; | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // 2. request kSystemAlertWindow
 | 
					
						
							|  |  |  |             if (!await AndroidPermissionManager.check(kSystemAlertWindow)) { | 
					
						
							|  |  |  |               if (!await AndroidPermissionManager.request(kSystemAlertWindow)) { | 
					
						
							|  |  |  |                 return; | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // (Optional) 3. request input permission
 | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2023-02-28 21:02:42 +09:00
										 |  |  |           setState(() => _enableStartOnBoot = toValue); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           gFFI.invokeMethod(AndroidChannel.kSetStartOnBootOpt, toValue); | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |         })); | 
					
						
							| 
									
										
										
										
											2022-07-14 17:44:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-07 11:04:18 +08:00
										 |  |  |     onFloatingWindowChanged(bool toValue) async { | 
					
						
							|  |  |  |       if (toValue) { | 
					
						
							|  |  |  |         if (!await AndroidPermissionManager.check(kSystemAlertWindow)) { | 
					
						
							|  |  |  |           if (!await AndroidPermissionManager.request(kSystemAlertWindow)) { | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       final disable = !toValue; | 
					
						
							|  |  |  |       bind.mainSetLocalOption( | 
					
						
							|  |  |  |           key: kOptionDisableFloatingWindow, | 
					
						
							|  |  |  |           value: disable ? 'Y' : defaultOptionNo); | 
					
						
							|  |  |  |       setState(() => _floatingWindowDisabled = disable); | 
					
						
							| 
									
										
										
										
											2024-06-13 19:24:38 +08:00
										 |  |  |       gFFI.serverModel.androidUpdatekeepScreenOn(); | 
					
						
							| 
									
										
										
										
											2024-06-07 11:04:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     enhancementsTiles.add(SettingsTile.switchTile( | 
					
						
							|  |  |  |         initialValue: !_floatingWindowDisabled, | 
					
						
							|  |  |  |         title: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | 
					
						
							|  |  |  |           Text(translate('Floating window')), | 
					
						
							|  |  |  |           Text('* ${translate('floating_window_tip')}', | 
					
						
							|  |  |  |               style: Theme.of(context).textTheme.bodySmall), | 
					
						
							|  |  |  |         ]), | 
					
						
							|  |  |  |         onToggle: bind.mainIsOptionFixed(key: kOptionDisableFloatingWindow) | 
					
						
							|  |  |  |             ? null | 
					
						
							|  |  |  |             : onFloatingWindowChanged)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-13 18:30:29 +08:00
										 |  |  |     enhancementsTiles.add(_getPopupDialogRadioEntry( | 
					
						
							|  |  |  |       title: 'Keep screen on', | 
					
						
							|  |  |  |       list: [ | 
					
						
							|  |  |  |         _RadioEntry('Never', _keepScreenOnToOption(KeepScreenOn.never)), | 
					
						
							|  |  |  |         _RadioEntry('During controlled', | 
					
						
							|  |  |  |             _keepScreenOnToOption(KeepScreenOn.duringControlled)), | 
					
						
							|  |  |  |         _RadioEntry('During service is on', | 
					
						
							|  |  |  |             _keepScreenOnToOption(KeepScreenOn.serviceOn)), | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |       getter: () => _keepScreenOnToOption(_floatingWindowDisabled | 
					
						
							|  |  |  |           ? KeepScreenOn.never | 
					
						
							|  |  |  |           : optionToKeepScreenOn( | 
					
						
							|  |  |  |               bind.mainGetLocalOption(key: kOptionKeepScreenOn))), | 
					
						
							|  |  |  |       asyncSetter: isOptionFixed(kOptionKeepScreenOn) || _floatingWindowDisabled | 
					
						
							|  |  |  |           ? null | 
					
						
							|  |  |  |           : (value) async { | 
					
						
							|  |  |  |               await bind.mainSetLocalOption( | 
					
						
							|  |  |  |                   key: kOptionKeepScreenOn, value: value); | 
					
						
							|  |  |  |               setState(() => _keepScreenOn = optionToKeepScreenOn(value)); | 
					
						
							|  |  |  |               gFFI.serverModel.androidUpdatekeepScreenOn(); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |     )); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |     final disabledSettings = bind.isDisableSettings(); | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |     final hideSecuritySettings = | 
					
						
							|  |  |  |         bind.mainGetBuildinOption(key: kOptionHideSecuritySetting) == 'Y'; | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |     final settings = SettingsList( | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |       sections: [ | 
					
						
							| 
									
										
										
										
											2024-04-19 12:44:52 +08:00
										 |  |  |         customClientSection, | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |         if (!bind.isDisableAccount()) | 
					
						
							|  |  |  |           SettingsSection( | 
					
						
							|  |  |  |             title: Text(translate('Account')), | 
					
						
							|  |  |  |             tiles: [ | 
					
						
							|  |  |  |               SettingsTile( | 
					
						
							|  |  |  |                 title: Obx(() => Text(gFFI.userModel.userName.value.isEmpty | 
					
						
							|  |  |  |                     ? translate('Login') | 
					
						
							|  |  |  |                     : '${translate('Logout')} (${gFFI.userModel.userName.value})')), | 
					
						
							|  |  |  |                 leading: Icon(Icons.person), | 
					
						
							|  |  |  |                 onPressed: (context) { | 
					
						
							|  |  |  |                   if (gFFI.userModel.userName.value.isEmpty) { | 
					
						
							|  |  |  |                     loginDialog(); | 
					
						
							|  |  |  |                   } else { | 
					
						
							|  |  |  |                     logOutConfirmDialog(); | 
					
						
							|  |  |  |                   } | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:41 +08:00
										 |  |  |         SettingsSection(title: Text(translate("Settings")), tiles: [ | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |           if (!disabledSettings && !_hideNetwork && !_hideServer) | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |             SettingsTile( | 
					
						
							|  |  |  |                 title: Text(translate('ID/Relay Server')), | 
					
						
							|  |  |  |                 leading: Icon(Icons.cloud), | 
					
						
							|  |  |  |                 onPressed: (context) { | 
					
						
							|  |  |  |                   showServerSettings(gFFI.dialogManager); | 
					
						
							|  |  |  |                 }), | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |           if (!isIOS && !_hideNetwork && !_hideProxy) | 
					
						
							| 
									
										
										
										
											2024-07-15 18:53:14 +08:00
										 |  |  |             SettingsTile( | 
					
						
							|  |  |  |                 title: Text(translate('Socks5/Http(s) Proxy')), | 
					
						
							|  |  |  |                 leading: Icon(Icons.network_ping), | 
					
						
							|  |  |  |                 onPressed: (context) { | 
					
						
							|  |  |  |                   changeSocks5Proxy(); | 
					
						
							|  |  |  |                 }), | 
					
						
							| 
									
										
										
										
											2023-09-01 12:46:05 +08:00
										 |  |  |           SettingsTile( | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  |               title: Text(translate('Language')), | 
					
						
							|  |  |  |               leading: Icon(Icons.translate), | 
					
						
							|  |  |  |               onPressed: (context) { | 
					
						
							| 
									
										
										
										
											2022-08-12 18:42:02 +08:00
										 |  |  |                 showLanguageSettings(gFFI.dialogManager); | 
					
						
							| 
									
										
										
										
											2022-09-19 20:26:39 +08:00
										 |  |  |               }), | 
					
						
							| 
									
										
										
										
											2023-09-01 12:46:05 +08:00
										 |  |  |           SettingsTile( | 
					
						
							| 
									
										
										
										
											2023-03-03 18:38:37 +01:00
										 |  |  |             title: Text(translate( | 
					
						
							|  |  |  |                 Theme.of(context).brightness == Brightness.light | 
					
						
							| 
									
										
										
										
											2024-06-23 11:26:15 +08:00
										 |  |  |                     ? 'Light Theme' | 
					
						
							|  |  |  |                     : 'Dark Theme')), | 
					
						
							| 
									
										
										
										
											2023-03-03 18:38:37 +01:00
										 |  |  |             leading: Icon(Theme.of(context).brightness == Brightness.light | 
					
						
							|  |  |  |                 ? Icons.dark_mode | 
					
						
							|  |  |  |                 : Icons.light_mode), | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |             onPressed: (context) { | 
					
						
							|  |  |  |               showThemeSettings(gFFI.dialogManager); | 
					
						
							| 
									
										
										
										
											2022-09-19 20:26:39 +08:00
										 |  |  |             }, | 
					
						
							|  |  |  |           ) | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:41 +08:00
										 |  |  |         ]), | 
					
						
							| 
									
										
										
										
											2024-05-13 12:39:04 +08:00
										 |  |  |         if (isAndroid) | 
					
						
							|  |  |  |           SettingsSection(title: Text(translate('Hardware Codec')), tiles: [ | 
					
						
							|  |  |  |             SettingsTile.switchTile( | 
					
						
							|  |  |  |               title: Text(translate('Enable hardware codec')), | 
					
						
							|  |  |  |               initialValue: _enableHardwareCodec, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |               onToggle: isOptionFixed(kOptionEnableHwcodec) | 
					
						
							|  |  |  |                   ? null | 
					
						
							|  |  |  |                   : (v) async { | 
					
						
							| 
									
										
										
										
											2024-06-10 11:01:39 +08:00
										 |  |  |                       await mainSetBoolOption(kOptionEnableHwcodec, v); | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                       final newValue = | 
					
						
							| 
									
										
										
										
											2024-06-10 11:01:39 +08:00
										 |  |  |                           await mainGetBoolOption(kOptionEnableHwcodec); | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                       setState(() { | 
					
						
							|  |  |  |                         _enableHardwareCodec = newValue; | 
					
						
							|  |  |  |                       }); | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2024-05-13 12:39:04 +08:00
										 |  |  |             ), | 
					
						
							|  |  |  |           ]), | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |         if (isAndroid && !outgoingOnly) | 
					
						
							| 
									
										
										
										
											2023-08-30 21:59:25 +08:00
										 |  |  |           SettingsSection( | 
					
						
							|  |  |  |             title: Text(translate("Recording")), | 
					
						
							|  |  |  |             tiles: [ | 
					
						
							|  |  |  |               SettingsTile.switchTile( | 
					
						
							|  |  |  |                 title: | 
					
						
							|  |  |  |                     Text(translate('Automatically record incoming sessions')), | 
					
						
							|  |  |  |                 leading: Icon(Icons.videocam), | 
					
						
							| 
									
										
										
										
											2024-06-18 08:29:10 +08:00
										 |  |  |                 description: Text( | 
					
						
							|  |  |  |                     "${translate("Directory")}: ${bind.mainVideoSaveDirectory(root: false)}"), | 
					
						
							| 
									
										
										
										
											2023-08-30 21:59:25 +08:00
										 |  |  |                 initialValue: _autoRecordIncomingSession, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 onToggle: isOptionFixed(kOptionAllowAutoRecordIncoming) | 
					
						
							|  |  |  |                     ? null | 
					
						
							|  |  |  |                     : (v) async { | 
					
						
							|  |  |  |                         await bind.mainSetOption( | 
					
						
							|  |  |  |                             key: kOptionAllowAutoRecordIncoming, | 
					
						
							|  |  |  |                             value: | 
					
						
							|  |  |  |                                 bool2option(kOptionAllowAutoRecordIncoming, v)); | 
					
						
							|  |  |  |                         final newValue = option2bool( | 
					
						
							|  |  |  |                             kOptionAllowAutoRecordIncoming, | 
					
						
							|  |  |  |                             await bind.mainGetOption( | 
					
						
							|  |  |  |                                 key: kOptionAllowAutoRecordIncoming)); | 
					
						
							|  |  |  |                         setState(() { | 
					
						
							|  |  |  |                           _autoRecordIncomingSession = newValue; | 
					
						
							|  |  |  |                         }); | 
					
						
							|  |  |  |                       }, | 
					
						
							| 
									
										
										
										
											2023-08-30 21:59:25 +08:00
										 |  |  |               ), | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |         if (isAndroid && | 
					
						
							|  |  |  |             !disabledSettings && | 
					
						
							|  |  |  |             !outgoingOnly && | 
					
						
							|  |  |  |             !hideSecuritySettings) | 
					
						
							| 
									
										
										
										
											2023-08-30 21:59:25 +08:00
										 |  |  |           SettingsSection( | 
					
						
							|  |  |  |             title: Text(translate("Share Screen")), | 
					
						
							|  |  |  |             tiles: shareScreenTiles, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2024-04-17 12:48:27 +08:00
										 |  |  |         if (!bind.isIncomingOnly()) defaultDisplaySection(), | 
					
						
							| 
									
										
										
										
											2024-07-19 23:55:52 +08:00
										 |  |  |         if (isAndroid && | 
					
						
							|  |  |  |             !disabledSettings && | 
					
						
							|  |  |  |             !outgoingOnly && | 
					
						
							|  |  |  |             !hideSecuritySettings) | 
					
						
							| 
									
										
										
										
											2023-08-30 21:59:25 +08:00
										 |  |  |           SettingsSection( | 
					
						
							|  |  |  |             title: Text(translate("Enhancements")), | 
					
						
							|  |  |  |             tiles: enhancementsTiles, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |         SettingsSection( | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  |           title: Text(translate("About")), | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |           tiles: [ | 
					
						
							| 
									
										
										
										
											2023-09-01 12:46:05 +08:00
										 |  |  |             SettingsTile( | 
					
						
							| 
									
										
										
										
											2022-04-15 17:50:15 +08:00
										 |  |  |                 onPressed: (context) async { | 
					
						
							| 
									
										
										
										
											2022-06-19 17:15:37 +01:00
										 |  |  |                   if (await canLaunchUrl(Uri.parse(url))) { | 
					
						
							|  |  |  |                     await launchUrl(Uri.parse(url)); | 
					
						
							| 
									
										
										
										
											2022-04-15 17:50:15 +08:00
										 |  |  |                   } | 
					
						
							|  |  |  |                 }, | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  |                 title: Text(translate("Version: ") + version), | 
					
						
							| 
									
										
										
										
											2022-04-15 17:50:15 +08:00
										 |  |  |                 value: Padding( | 
					
						
							|  |  |  |                   padding: EdgeInsets.symmetric(vertical: 8), | 
					
						
							|  |  |  |                   child: Text('rustdesk.com', | 
					
						
							|  |  |  |                       style: TextStyle( | 
					
						
							|  |  |  |                         decoration: TextDecoration.underline, | 
					
						
							|  |  |  |                       )), | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |                 ), | 
					
						
							|  |  |  |                 leading: Icon(Icons.info)), | 
					
						
							| 
									
										
										
										
											2023-09-01 12:46:05 +08:00
										 |  |  |             SettingsTile( | 
					
						
							| 
									
										
										
										
											2023-06-19 15:06:40 +08:00
										 |  |  |                 title: Text(translate("Build Date")), | 
					
						
							|  |  |  |                 value: Padding( | 
					
						
							|  |  |  |                   padding: EdgeInsets.symmetric(vertical: 8), | 
					
						
							|  |  |  |                   child: Text(_buildDate), | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |                 leading: Icon(Icons.query_builder)), | 
					
						
							| 
									
										
										
										
											2023-09-01 12:46:05 +08:00
										 |  |  |             if (isAndroid) | 
					
						
							|  |  |  |               SettingsTile( | 
					
						
							|  |  |  |                   onPressed: (context) => onCopyFingerprint(_fingerprint), | 
					
						
							|  |  |  |                   title: Text(translate("Fingerprint")), | 
					
						
							|  |  |  |                   value: Padding( | 
					
						
							|  |  |  |                     padding: EdgeInsets.symmetric(vertical: 8), | 
					
						
							|  |  |  |                     child: Text(_fingerprint), | 
					
						
							|  |  |  |                   ), | 
					
						
							|  |  |  |                   leading: Icon(Icons.fingerprint)), | 
					
						
							| 
									
										
										
										
											2023-09-08 11:29:47 +08:00
										 |  |  |             SettingsTile( | 
					
						
							|  |  |  |               title: Text(translate("Privacy Statement")), | 
					
						
							|  |  |  |               onPressed: (context) => | 
					
						
							|  |  |  |                   launchUrlString('https://rustdesk.com/privacy.html'), | 
					
						
							|  |  |  |               leading: Icon(Icons.privacy_tip), | 
					
						
							|  |  |  |             ) | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |           ], | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2024-04-19 12:44:52 +08:00
										 |  |  |     return settings; | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 22:26:47 +09:00
										 |  |  |   Future<bool> canStartOnBoot() async { | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |     // start on boot depends on ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS and SYSTEM_ALERT_WINDOW
 | 
					
						
							|  |  |  |     if (_hasIgnoreBattery && !_ignoreBatteryOpt) { | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-02-28 22:26:47 +09:00
										 |  |  |     if (!await AndroidPermissionManager.check(kSystemAlertWindow)) { | 
					
						
							| 
									
										
										
										
											2023-02-28 11:31:30 +09:00
										 |  |  |       return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return true; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   defaultDisplaySection() { | 
					
						
							|  |  |  |     return SettingsSection( | 
					
						
							|  |  |  |       title: Text(translate("Display Settings")), | 
					
						
							|  |  |  |       tiles: [ | 
					
						
							|  |  |  |         SettingsTile( | 
					
						
							|  |  |  |             title: Text(translate('Display Settings')), | 
					
						
							|  |  |  |             leading: Icon(Icons.desktop_windows_outlined), | 
					
						
							|  |  |  |             trailing: Icon(Icons.arrow_forward_ios), | 
					
						
							|  |  |  |             onPressed: (context) { | 
					
						
							|  |  |  |               Navigator.push(context, MaterialPageRoute(builder: (context) { | 
					
						
							|  |  |  |                 return _DisplayPage(); | 
					
						
							|  |  |  |               })); | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-12 18:42:02 +08:00
										 |  |  | void showServerSettings(OverlayDialogManager dialogManager) async { | 
					
						
							| 
									
										
										
										
											2022-08-08 17:53:51 +08:00
										 |  |  |   Map<String, dynamic> options = jsonDecode(await bind.mainGetOptions()); | 
					
						
							| 
									
										
										
										
											2022-12-21 16:24:01 +09:00
										 |  |  |   showServerSettingsWithValue(ServerConfig.fromOptions(options), dialogManager); | 
					
						
							| 
									
										
										
										
											2022-02-28 21:26:44 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-12 18:42:02 +08:00
										 |  |  | void showLanguageSettings(OverlayDialogManager dialogManager) async { | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  |   try { | 
					
						
							| 
									
										
										
										
											2022-08-08 22:27:27 +08:00
										 |  |  |     final langs = json.decode(await bind.mainGetLangs()) as List<dynamic>; | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |     var lang = bind.mainGetLocalOption(key: kCommConfKeyLang); | 
					
						
							| 
									
										
										
										
											2023-05-08 12:34:19 +08:00
										 |  |  |     dialogManager.show((setState, close, context) { | 
					
						
							| 
									
										
										
										
											2023-06-10 07:08:10 +08:00
										 |  |  |       setLang(v) async { | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  |         if (lang != v) { | 
					
						
							|  |  |  |           setState(() { | 
					
						
							|  |  |  |             lang = v; | 
					
						
							|  |  |  |           }); | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |           await bind.mainSetLocalOption(key: kCommConfKeyLang, value: v); | 
					
						
							| 
									
										
										
										
											2022-08-05 20:29:43 +08:00
										 |  |  |           HomePage.homeKey.currentState?.refreshPages(); | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  |           Future.delayed(Duration(milliseconds: 200), close); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |       final isOptFixed = isOptionFixed(kCommConfKeyLang); | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  |       return CustomAlertDialog( | 
					
						
							| 
									
										
										
										
											2023-03-30 01:51:29 +02:00
										 |  |  |         content: Column( | 
					
						
							|  |  |  |           children: [ | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 getRadio(Text(translate('Default')), defaultOptionLang, lang, | 
					
						
							|  |  |  |                     isOptFixed ? null : setLang), | 
					
						
							| 
									
										
										
										
											2023-03-30 01:51:29 +02:00
										 |  |  |                 Divider(color: MyTheme.border), | 
					
						
							|  |  |  |               ] + | 
					
						
							|  |  |  |               langs.map((e) { | 
					
						
							|  |  |  |                 final key = e[0] as String; | 
					
						
							|  |  |  |                 final name = e[1] as String; | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 return getRadio(Text(translate(name)), key, lang, | 
					
						
							|  |  |  |                     isOptFixed ? null : setLang); | 
					
						
							| 
									
										
										
										
											2023-03-30 01:51:29 +02:00
										 |  |  |               }).toList(), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ); | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  |     }, backDismiss: true, clickMaskDismiss: true); | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |   } catch (e) { | 
					
						
							|  |  |  |     //
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void showThemeSettings(OverlayDialogManager dialogManager) async { | 
					
						
							|  |  |  |   var themeMode = MyTheme.getThemeModePreference(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-08 12:34:19 +08:00
										 |  |  |   dialogManager.show((setState, close, context) { | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |     setTheme(v) { | 
					
						
							|  |  |  |       if (themeMode != v) { | 
					
						
							|  |  |  |         setState(() { | 
					
						
							|  |  |  |           themeMode = v; | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |         MyTheme.changeDarkMode(themeMode); | 
					
						
							|  |  |  |         Future.delayed(Duration(milliseconds: 200), close); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |     final isOptFixed = isOptionFixed(kCommConfKeyTheme); | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |     return CustomAlertDialog( | 
					
						
							| 
									
										
										
										
											2023-03-30 01:51:29 +02:00
										 |  |  |       content: Column(children: [ | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |         getRadio(Text(translate('Light')), ThemeMode.light, themeMode, | 
					
						
							|  |  |  |             isOptFixed ? null : setTheme), | 
					
						
							|  |  |  |         getRadio(Text(translate('Dark')), ThemeMode.dark, themeMode, | 
					
						
							|  |  |  |             isOptFixed ? null : setTheme), | 
					
						
							| 
									
										
										
										
											2023-04-12 09:41:13 +08:00
										 |  |  |         getRadio(Text(translate('Follow System')), ThemeMode.system, themeMode, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |             isOptFixed ? null : setTheme) | 
					
						
							| 
									
										
										
										
											2023-03-30 01:51:29 +02:00
										 |  |  |       ]), | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2022-09-22 15:12:23 +08:00
										 |  |  |   }, backDismiss: true, clickMaskDismiss: true); | 
					
						
							| 
									
										
										
										
											2022-08-04 17:24:02 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-12 18:42:02 +08:00
										 |  |  | void showAbout(OverlayDialogManager dialogManager) { | 
					
						
							| 
									
										
										
										
											2023-05-08 12:34:19 +08:00
										 |  |  |   dialogManager.show((setState, close, context) { | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  |     return CustomAlertDialog( | 
					
						
							| 
									
										
										
										
											2024-07-23 09:58:48 +09:00
										 |  |  |       title: Text(translate('About RustDesk')), | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  |       content: Wrap(direction: Axis.vertical, spacing: 12, children: [ | 
					
						
							|  |  |  |         Text('Version: $version'), | 
					
						
							|  |  |  |         InkWell( | 
					
						
							|  |  |  |             onTap: () async { | 
					
						
							|  |  |  |               const url = 'https://rustdesk.com/'; | 
					
						
							| 
									
										
										
										
											2022-06-19 17:15:37 +01:00
										 |  |  |               if (await canLaunchUrl(Uri.parse(url))) { | 
					
						
							|  |  |  |                 await launchUrl(Uri.parse(url)); | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  |               } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             child: Padding( | 
					
						
							|  |  |  |               padding: EdgeInsets.symmetric(vertical: 8), | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  |               child: Text('rustdesk.com', | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  |                   style: TextStyle( | 
					
						
							|  |  |  |                     decoration: TextDecoration.underline, | 
					
						
							|  |  |  |                   )), | 
					
						
							|  |  |  |             )), | 
					
						
							|  |  |  |       ]), | 
					
						
							| 
									
										
										
										
											2022-03-24 21:23:22 +08:00
										 |  |  |       actions: [], | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  |     ); | 
					
						
							| 
									
										
										
										
											2022-04-21 10:02:47 +08:00
										 |  |  |   }, clickMaskDismiss: true, backDismiss: true); | 
					
						
							| 
									
										
										
										
											2022-03-24 20:57:30 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-03-28 15:44:45 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-15 17:50:15 +08:00
										 |  |  | class ScanButton extends StatelessWidget { | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     return IconButton( | 
					
						
							|  |  |  |       icon: Icon(Icons.qr_code_scanner), | 
					
						
							|  |  |  |       onPressed: () { | 
					
						
							|  |  |  |         Navigator.push( | 
					
						
							|  |  |  |           context, | 
					
						
							|  |  |  |           MaterialPageRoute( | 
					
						
							|  |  |  |             builder: (BuildContext context) => ScanPage(), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | class _DisplayPage extends StatefulWidget { | 
					
						
							| 
									
										
										
										
											2024-02-12 21:39:19 +08:00
										 |  |  |   const _DisplayPage(); | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   State<_DisplayPage> createState() => __DisplayPageState(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class __DisplayPageState extends State<_DisplayPage> { | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     final Map codecsJson = jsonDecode(bind.mainSupportedHwdecodings()); | 
					
						
							|  |  |  |     final h264 = codecsJson['h264'] ?? false; | 
					
						
							|  |  |  |     final h265 = codecsJson['h265'] ?? false; | 
					
						
							|  |  |  |     var codecList = [ | 
					
						
							|  |  |  |       _RadioEntry('Auto', 'auto'), | 
					
						
							|  |  |  |       _RadioEntry('VP8', 'vp8'), | 
					
						
							|  |  |  |       _RadioEntry('VP9', 'vp9'), | 
					
						
							|  |  |  |       _RadioEntry('AV1', 'av1'), | 
					
						
							|  |  |  |       if (h264) _RadioEntry('H264', 'h264'), | 
					
						
							|  |  |  |       if (h265) _RadioEntry('H265', 'h265') | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  |     RxBool showCustomImageQuality = false.obs; | 
					
						
							|  |  |  |     return Scaffold( | 
					
						
							|  |  |  |       appBar: AppBar( | 
					
						
							|  |  |  |         leading: IconButton( | 
					
						
							|  |  |  |             onPressed: () => Navigator.pop(context), | 
					
						
							|  |  |  |             icon: Icon(Icons.arrow_back_ios)), | 
					
						
							|  |  |  |         title: Text(translate('Display Settings')), | 
					
						
							|  |  |  |         centerTitle: true, | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |       body: SettingsList(sections: [ | 
					
						
							|  |  |  |         SettingsSection( | 
					
						
							|  |  |  |           tiles: [ | 
					
						
							|  |  |  |             _getPopupDialogRadioEntry( | 
					
						
							|  |  |  |               title: 'Default View Style', | 
					
						
							|  |  |  |               list: [ | 
					
						
							|  |  |  |                 _RadioEntry('Scale original', kRemoteViewStyleOriginal), | 
					
						
							|  |  |  |                 _RadioEntry('Scale adaptive', kRemoteViewStyleAdaptive) | 
					
						
							|  |  |  |               ], | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |               getter: () => | 
					
						
							|  |  |  |                   bind.mainGetUserDefaultOption(key: kOptionViewStyle), | 
					
						
							|  |  |  |               asyncSetter: isOptionFixed(kOptionViewStyle) | 
					
						
							|  |  |  |                   ? null | 
					
						
							|  |  |  |                   : (value) async { | 
					
						
							|  |  |  |                       await bind.mainSetUserDefaultOption( | 
					
						
							|  |  |  |                           key: kOptionViewStyle, value: value); | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |             ), | 
					
						
							|  |  |  |             _getPopupDialogRadioEntry( | 
					
						
							|  |  |  |               title: 'Default Image Quality', | 
					
						
							|  |  |  |               list: [ | 
					
						
							|  |  |  |                 _RadioEntry('Good image quality', kRemoteImageQualityBest), | 
					
						
							|  |  |  |                 _RadioEntry('Balanced', kRemoteImageQualityBalanced), | 
					
						
							|  |  |  |                 _RadioEntry('Optimize reaction time', kRemoteImageQualityLow), | 
					
						
							|  |  |  |                 _RadioEntry('Custom', kRemoteImageQualityCustom), | 
					
						
							|  |  |  |               ], | 
					
						
							|  |  |  |               getter: () { | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                 final v = | 
					
						
							|  |  |  |                     bind.mainGetUserDefaultOption(key: kOptionImageQuality); | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |                 showCustomImageQuality.value = v == kRemoteImageQualityCustom; | 
					
						
							|  |  |  |                 return v; | 
					
						
							|  |  |  |               }, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |               asyncSetter: isOptionFixed(kOptionImageQuality) | 
					
						
							|  |  |  |                   ? null | 
					
						
							|  |  |  |                   : (value) async { | 
					
						
							|  |  |  |                       await bind.mainSetUserDefaultOption( | 
					
						
							|  |  |  |                           key: kOptionImageQuality, value: value); | 
					
						
							|  |  |  |                       showCustomImageQuality.value = | 
					
						
							|  |  |  |                           value == kRemoteImageQualityCustom; | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |               tail: customImageQualitySetting(), | 
					
						
							|  |  |  |               showTail: showCustomImageQuality, | 
					
						
							|  |  |  |               notCloseValue: kRemoteImageQualityCustom, | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             _getPopupDialogRadioEntry( | 
					
						
							|  |  |  |               title: 'Default Codec', | 
					
						
							|  |  |  |               list: codecList, | 
					
						
							|  |  |  |               getter: () => | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                   bind.mainGetUserDefaultOption(key: kOptionCodecPreference), | 
					
						
							|  |  |  |               asyncSetter: isOptionFixed(kOptionCodecPreference) | 
					
						
							|  |  |  |                   ? null | 
					
						
							|  |  |  |                   : (value) async { | 
					
						
							|  |  |  |                       await bind.mainSetUserDefaultOption( | 
					
						
							|  |  |  |                           key: kOptionCodecPreference, value: value); | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |             ), | 
					
						
							|  |  |  |           ], | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |         SettingsSection( | 
					
						
							|  |  |  |           title: Text(translate('Other Default Options')), | 
					
						
							| 
									
										
										
										
											2023-12-11 15:32:13 +08:00
										 |  |  |           tiles: | 
					
						
							|  |  |  |               otherDefaultSettings().map((e) => otherRow(e.$1, e.$2)).toList(), | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |         ), | 
					
						
							|  |  |  |       ]), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-11 15:32:13 +08:00
										 |  |  |   SettingsTile otherRow(String label, String key) { | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |     final value = bind.mainGetUserDefaultOption(key: key) == 'Y'; | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |     final isOptFixed = isOptionFixed(key); | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |     return SettingsTile.switchTile( | 
					
						
							|  |  |  |       initialValue: value, | 
					
						
							|  |  |  |       title: Text(translate(label)), | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |       onToggle: isOptFixed | 
					
						
							|  |  |  |           ? null | 
					
						
							|  |  |  |           : (b) async { | 
					
						
							|  |  |  |               await bind.mainSetUserDefaultOption( | 
					
						
							|  |  |  |                   key: key, value: b ? 'Y' : defaultOptionNo); | 
					
						
							|  |  |  |               setState(() {}); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class _RadioEntry { | 
					
						
							|  |  |  |   final String label; | 
					
						
							|  |  |  |   final String value; | 
					
						
							|  |  |  |   _RadioEntry(this.label, this.value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef _RadioEntryGetter = String Function(); | 
					
						
							|  |  |  | typedef _RadioEntrySetter = Future<void> Function(String); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-13 18:30:29 +08:00
										 |  |  | SettingsTile _getPopupDialogRadioEntry({ | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |   required String title, | 
					
						
							|  |  |  |   required List<_RadioEntry> list, | 
					
						
							|  |  |  |   required _RadioEntryGetter getter, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |   required _RadioEntrySetter? asyncSetter, | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |   Widget? tail, | 
					
						
							|  |  |  |   RxBool? showTail, | 
					
						
							|  |  |  |   String? notCloseValue, | 
					
						
							|  |  |  | }) { | 
					
						
							|  |  |  |   RxString groupValue = ''.obs; | 
					
						
							|  |  |  |   RxString valueText = ''.obs; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   init() { | 
					
						
							|  |  |  |     groupValue.value = getter(); | 
					
						
							|  |  |  |     final e = list.firstWhereOrNull((e) => e.value == groupValue.value); | 
					
						
							|  |  |  |     if (e != null) { | 
					
						
							|  |  |  |       valueText.value = e.label; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   init(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void showDialog() async { | 
					
						
							|  |  |  |     gFFI.dialogManager.show((setState, close, context) { | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |       final onChanged = asyncSetter == null | 
					
						
							|  |  |  |           ? null | 
					
						
							|  |  |  |           : (String? value) async { | 
					
						
							|  |  |  |               if (value == null) return; | 
					
						
							|  |  |  |               await asyncSetter(value); | 
					
						
							|  |  |  |               init(); | 
					
						
							|  |  |  |               if (value != notCloseValue) { | 
					
						
							|  |  |  |                 close(); | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             }; | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       return CustomAlertDialog( | 
					
						
							|  |  |  |           content: Obx( | 
					
						
							|  |  |  |         () => Column(children: [ | 
					
						
							|  |  |  |           ...list | 
					
						
							|  |  |  |               .map((e) => getRadio(Text(translate(e.label)), e.value, | 
					
						
							| 
									
										
											  
											
												Fix/custom client advanced settings (#8066)
* fix: custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, default options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: cargo test
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: remove prefix $ and unify option keys
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* refact: custom client, advanced options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* debug custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings. Add filter-transfer to display settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, advanced settings
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, codec
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* fix: custom client, advanced settings, whitelist
Signed-off-by: fufesou <shuanglongchen@yeah.net>
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
											
										 
											2024-05-17 14:19:11 +08:00
										 |  |  |                   groupValue.value, onChanged)) | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |               .toList(), | 
					
						
							|  |  |  |           Offstage( | 
					
						
							|  |  |  |             offstage: | 
					
						
							|  |  |  |                 !(tail != null && showTail != null && showTail.value == true), | 
					
						
							|  |  |  |             child: tail, | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ]), | 
					
						
							|  |  |  |       )); | 
					
						
							|  |  |  |     }, backDismiss: true, clickMaskDismiss: true); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return SettingsTile( | 
					
						
							|  |  |  |     title: Text(translate(title)), | 
					
						
							| 
									
										
										
										
											2024-06-13 18:30:29 +08:00
										 |  |  |     onPressed: asyncSetter == null ? null : (context) => showDialog(), | 
					
						
							| 
									
										
										
										
											2023-08-31 20:30:20 +08:00
										 |  |  |     value: Padding( | 
					
						
							|  |  |  |       padding: EdgeInsets.symmetric(vertical: 8), | 
					
						
							|  |  |  |       child: Obx(() => Text(translate(valueText.value))), | 
					
						
							|  |  |  |     ), | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  | } |