refactor service start/stop

This commit is contained in:
rustdesk
2023-06-06 21:51:40 +08:00
parent d2bb866e48
commit a5d56fcd3f
3 changed files with 36 additions and 37 deletions

View File

@@ -2043,3 +2043,12 @@ void onCopyFingerprint(String value) {
showToast(translate("no fingerprints"));
}
}
Future<void> start_service(bool is_start) async {
bool checked = !bind.mainIsInstalled() ||
!Platform.isMacOS ||
await bind.mainCheckSuperUserPermission();
if (checked) {
bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y");
}
}