mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
buildin options and add to mobile (#8759)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -3319,7 +3319,8 @@ Widget buildPresetPasswordWarning() {
|
||||
return Text(
|
||||
'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error
|
||||
} else if (snapshot.hasData && snapshot.data == true) {
|
||||
if (bind.mainGetLocalOption(key: "remove-preset-password-warning") !=
|
||||
if (bind.mainGetBuildinOption(
|
||||
key: kOptionRemovePresetPasswordWarning) !=
|
||||
'N') {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ class _PeerCardState extends State<_PeerCard>
|
||||
Widget _buildPeerTile(
|
||||
BuildContext context, Peer peer, Rx<BoxDecoration?>? deco) {
|
||||
hideUsernameOnCard ??=
|
||||
bind.mainGetLocalOption(key: kHideUsernameOnCard) == 'Y';
|
||||
bind.mainGetBuildinOption(key: kHideUsernameOnCard) == 'Y';
|
||||
final name = hideUsernameOnCard == true
|
||||
? peer.hostname
|
||||
: '${peer.username}${peer.username.isNotEmpty && peer.hostname.isNotEmpty ? '@' : ''}${peer.hostname}';
|
||||
@@ -245,7 +245,7 @@ class _PeerCardState extends State<_PeerCard>
|
||||
Widget _buildPeerCard(
|
||||
BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {
|
||||
hideUsernameOnCard ??=
|
||||
bind.mainGetLocalOption(key: kHideUsernameOnCard) == 'Y';
|
||||
bind.mainGetBuildinOption(key: kHideUsernameOnCard) == 'Y';
|
||||
final name = hideUsernameOnCard == true
|
||||
? peer.hostname
|
||||
: '${peer.username}${peer.username.isNotEmpty && peer.hostname.isNotEmpty ? '@' : ''}${peer.hostname}';
|
||||
|
||||
@@ -136,8 +136,16 @@ const String kOptionAllowRemoveWallpaper = "allow-remove-wallpaper";
|
||||
const String kOptionStopService = "stop-service";
|
||||
const String kOptionDirectxCapture = "enable-directx-capture";
|
||||
const String kOptionAllowRemoteCmModification = "allow-remote-cm-modification";
|
||||
|
||||
// buildin opitons
|
||||
const String kOptionHideServerSetting = "hide-server-settings";
|
||||
const String kOptionHideProxySetting = "hide-proxy-settings";
|
||||
const String kOptionHideSecuritySetting = "hide-security-settings";
|
||||
const String kOptionHideNetworkSetting = "hide-network-settings";
|
||||
const String kOptionRemovePresetPasswordWarning =
|
||||
"remove-preset-password-warning";
|
||||
const kHideUsernameOnCard = "hide-username-on-card";
|
||||
const String kOptionHideHelpCards = "hide-help-cards";
|
||||
|
||||
const String kOptionToggleViewOnly = "view-only";
|
||||
|
||||
@@ -306,8 +314,6 @@ const kRequestIgnoreBatteryOptimizations =
|
||||
const kSystemAlertWindow = "android.permission.SYSTEM_ALERT_WINDOW";
|
||||
const kAndroid13Notification = "android.permission.POST_NOTIFICATIONS";
|
||||
|
||||
const kHideUsernameOnCard = "hide-username-on-card";
|
||||
|
||||
/// Android channel invoke type key
|
||||
class AndroidChannel {
|
||||
static final kStartAction = "start_action";
|
||||
|
||||
@@ -546,7 +546,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
String? link,
|
||||
bool? closeButton,
|
||||
String? closeOption}) {
|
||||
if (bind.mainGetLocalOption(key: 'hide-help-cards') == 'Y' &&
|
||||
if (bind.mainGetBuildinOption(key: kOptionHideHelpCards) == 'Y' &&
|
||||
content != 'install_daemon_tip') {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ class DesktopSettingPage extends StatefulWidget {
|
||||
SettingsTabKey.general,
|
||||
if (!bind.isOutgoingOnly() &&
|
||||
!bind.isDisableSettings() &&
|
||||
bind.mainGetLocalOption(key: "hide-security-settings") != 'Y')
|
||||
bind.mainGetBuildinOption(key: kOptionHideSecuritySetting) != 'Y')
|
||||
SettingsTabKey.safety,
|
||||
if (!bind.isDisableSettings() &&
|
||||
bind.mainGetLocalOption(key: "hide-network-settings") != 'Y')
|
||||
bind.mainGetBuildinOption(key: kOptionHideNetworkSetting) != 'Y')
|
||||
SettingsTabKey.network,
|
||||
if (!bind.isIncomingOnly()) SettingsTabKey.display,
|
||||
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
|
||||
@@ -1289,9 +1289,9 @@ class _NetworkState extends State<_Network> with AutomaticKeepAliveClientMixin {
|
||||
bool enabled = !locked;
|
||||
final scrollController = ScrollController();
|
||||
final hideServer =
|
||||
bind.mainGetLocalOption(key: kOptionHideServerSetting) == 'Y';
|
||||
bind.mainGetBuildinOption(key: kOptionHideServerSetting) == 'Y';
|
||||
final hideProxy =
|
||||
bind.mainGetLocalOption(key: kOptionHideProxySetting) == 'Y';
|
||||
bind.mainGetBuildinOption(key: kOptionHideProxySetting) == 'Y';
|
||||
return DesktopScrollWrapper(
|
||||
scrollController: scrollController,
|
||||
child: ListView(
|
||||
|
||||
@@ -23,7 +23,22 @@ class ServerPage extends StatefulWidget implements PageShape {
|
||||
final icon = const Icon(Icons.mobile_screen_share);
|
||||
|
||||
@override
|
||||
final appBarActions = [
|
||||
final appBarActions = (!bind.isDisableSettings() &&
|
||||
bind.mainGetBuildinOption(key: kOptionHideSecuritySetting) != 'Y')
|
||||
? [_DropDownAction()]
|
||||
: [];
|
||||
|
||||
ServerPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ServerPageState();
|
||||
}
|
||||
|
||||
class _DropDownAction extends StatelessWidget {
|
||||
_DropDownAction();
|
||||
|
||||
// should only have one action
|
||||
final actions = [
|
||||
PopupMenuButton<String>(
|
||||
tooltip: "",
|
||||
icon: const Icon(Icons.more_vert),
|
||||
@@ -136,10 +151,10 @@ class ServerPage extends StatefulWidget implements PageShape {
|
||||
})
|
||||
];
|
||||
|
||||
ServerPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ServerPageState();
|
||||
Widget build(BuildContext context) {
|
||||
return actions[0];
|
||||
}
|
||||
}
|
||||
|
||||
class _ServerPageState extends State<ServerPage> {
|
||||
|
||||
@@ -86,6 +86,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
var _autoDisconnectTimeout = "";
|
||||
var _hideServer = false;
|
||||
var _hideProxy = false;
|
||||
var _hideNetwork = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -112,8 +113,11 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
bind.mainGetOptionSync(key: kOptionAllowAutoDisconnect));
|
||||
_autoDisconnectTimeout =
|
||||
bind.mainGetOptionSync(key: kOptionAutoDisconnectTimeout);
|
||||
_hideServer = bind.mainGetLocalOption(key: kOptionHideServerSetting) == 'Y';
|
||||
_hideProxy = bind.mainGetLocalOption(key: kOptionHideProxySetting) == 'Y';
|
||||
_hideServer =
|
||||
bind.mainGetBuildinOption(key: kOptionHideServerSetting) == 'Y';
|
||||
_hideProxy = bind.mainGetBuildinOption(key: kOptionHideProxySetting) == 'Y';
|
||||
_hideNetwork =
|
||||
bind.mainGetBuildinOption(key: kOptionHideNetworkSetting) == 'Y';
|
||||
|
||||
() async {
|
||||
var update = false;
|
||||
@@ -535,6 +539,8 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
));
|
||||
|
||||
final disabledSettings = bind.isDisableSettings();
|
||||
final hideSecuritySettings =
|
||||
bind.mainGetBuildinOption(key: kOptionHideSecuritySetting) == 'Y';
|
||||
final settings = SettingsList(
|
||||
sections: [
|
||||
customClientSection,
|
||||
@@ -558,14 +564,14 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
],
|
||||
),
|
||||
SettingsSection(title: Text(translate("Settings")), tiles: [
|
||||
if (!disabledSettings && !_hideServer)
|
||||
if (!disabledSettings && !_hideNetwork && !_hideServer)
|
||||
SettingsTile(
|
||||
title: Text(translate('ID/Relay Server')),
|
||||
leading: Icon(Icons.cloud),
|
||||
onPressed: (context) {
|
||||
showServerSettings(gFFI.dialogManager);
|
||||
}),
|
||||
if (!isIOS && !_hideProxy)
|
||||
if (!isIOS && !_hideNetwork && !_hideProxy)
|
||||
SettingsTile(
|
||||
title: Text(translate('Socks5/Http(s) Proxy')),
|
||||
leading: Icon(Icons.network_ping),
|
||||
@@ -637,13 +643,19 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (isAndroid && !disabledSettings && !outgoingOnly)
|
||||
if (isAndroid &&
|
||||
!disabledSettings &&
|
||||
!outgoingOnly &&
|
||||
!hideSecuritySettings)
|
||||
SettingsSection(
|
||||
title: Text(translate("Share Screen")),
|
||||
tiles: shareScreenTiles,
|
||||
),
|
||||
if (!bind.isIncomingOnly()) defaultDisplaySection(),
|
||||
if (isAndroid && !disabledSettings && !outgoingOnly)
|
||||
if (isAndroid &&
|
||||
!disabledSettings &&
|
||||
!outgoingOnly &&
|
||||
!hideSecuritySettings)
|
||||
SettingsSection(
|
||||
title: Text(translate("Enhancements")),
|
||||
tiles: enhancementsTiles,
|
||||
|
||||
Reference in New Issue
Block a user