[android] add Enhancements settings
This commit is contained in:
parent
fb02fc1197
commit
55427bad2f
@ -50,45 +50,51 @@ class _SettingsState extends State<SettingsPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Provider.of<FfiModel>(context);
|
Provider.of<FfiModel>(context);
|
||||||
final username = getUsername();
|
final username = getUsername();
|
||||||
final settingsTiles = [
|
final enableAbr = FFI.getByName("option", "enable-abr") != 'N';
|
||||||
SettingsTile.navigation(
|
final enhancementsTiles = [
|
||||||
title: Text(translate('ID/Relay Server')),
|
SettingsTile.switchTile(
|
||||||
leading: Icon(Icons.cloud),
|
leading: Icon(Icons.more_horiz),
|
||||||
onPressed: (context) {
|
title: Text(translate('Adaptive Bitrate') + '(beta)'),
|
||||||
showServerSettings();
|
initialValue: enableAbr,
|
||||||
|
onToggle: (v) {
|
||||||
|
final msg = Map()
|
||||||
|
..["name"] = "enable-abr"
|
||||||
|
..["value"] = "";
|
||||||
|
if (!v) {
|
||||||
|
msg["value"] = "N";
|
||||||
|
}
|
||||||
|
FFI.setByName("option", json.encode(msg));
|
||||||
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
)
|
||||||
SettingsTile.navigation(
|
|
||||||
title: Text(translate('Enhancements')),
|
|
||||||
leading: Icon(Icons.tune),
|
|
||||||
onPressed: (context) {},
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
if (_showIgnoreBattery) {
|
if (_showIgnoreBattery) {
|
||||||
settingsTiles.add(SettingsTile.navigation(
|
enhancementsTiles.insert(
|
||||||
title: Text(translate('Keep RustDesk background service')),
|
0,
|
||||||
description: Text('* ${translate('Ignore Battery Optimizations')}'),
|
SettingsTile.navigation(
|
||||||
leading: Icon(Icons.settings_backup_restore),
|
title: Text(translate('Keep RustDesk background service')),
|
||||||
onPressed: (context) {
|
description:
|
||||||
PermissionManager.request("ignore_battery_optimizations");
|
Text('* ${translate('Ignore Battery Optimizations')}'),
|
||||||
var count = 0;
|
leading: Icon(Icons.battery_saver),
|
||||||
Timer.periodic(Duration(seconds: 1), (timer) async {
|
onPressed: (context) {
|
||||||
debugPrint("BatteryOpt Timer, count:$count");
|
PermissionManager.request("ignore_battery_optimizations");
|
||||||
if (count > 5) {
|
var count = 0;
|
||||||
count = 0;
|
Timer.periodic(Duration(seconds: 1), (timer) async {
|
||||||
timer.cancel();
|
if (count > 5) {
|
||||||
}
|
count = 0;
|
||||||
if (await PermissionManager.check(
|
timer.cancel();
|
||||||
"ignore_battery_optimizations")) {
|
}
|
||||||
count = 0;
|
if (await PermissionManager.check(
|
||||||
timer.cancel();
|
"ignore_battery_optimizations")) {
|
||||||
setState(() {
|
count = 0;
|
||||||
_showIgnoreBattery = false;
|
timer.cancel();
|
||||||
|
setState(() {
|
||||||
|
_showIgnoreBattery = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
count++;
|
||||||
});
|
});
|
||||||
}
|
}));
|
||||||
count++;
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SettingsList(
|
return SettingsList(
|
||||||
@ -111,9 +117,17 @@ class _SettingsState extends State<SettingsPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
SettingsSection(title: Text(translate("Settings")), tiles: [
|
||||||
|
SettingsTile.navigation(
|
||||||
|
title: Text(translate('ID/Relay Server')),
|
||||||
|
leading: Icon(Icons.cloud),
|
||||||
|
onPressed: (context) {
|
||||||
|
showServerSettings();
|
||||||
|
})
|
||||||
|
]),
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: Text(translate("Settings")),
|
title: Text(translate("Enhancements")),
|
||||||
tiles: settingsTiles,
|
tiles: enhancementsTiles,
|
||||||
),
|
),
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: Text(translate("About")),
|
title: Text(translate("About")),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user