From f8041a3de596a7de46baaf53b9c051b4eaec5004 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 10 Jun 2024 19:53:02 +0800 Subject: [PATCH] fix merge problem of last commit --- flutter/lib/common.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 06dfec194..a349fb3bd 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1430,7 +1430,7 @@ bool option2bool(String option, String value) { if (option.startsWith("enable-")) { res = value != "N"; } else if (option.startsWith("allow-") || - option == "stop-service" || + option == kOptionStopService || option == kOptionDirectServer || option == kOptionForceAlwaysRelay) { res = value == "Y"; @@ -1446,7 +1446,7 @@ String bool2option(String option, bool b) { if (option.startsWith('enable-')) { res = b ? defaultOptionYes : 'N'; } else if (option.startsWith('allow-') || - option == "stop-service" || + option == kOptionStopService || option == kOptionDirectServer || option == kOptionForceAlwaysRelay) { res = b ? 'Y' : defaultOptionNo; @@ -1483,9 +1483,9 @@ bool mainGetPeerBoolOptionSync(String id, String key) { return option2bool(key, bind.mainGetPeerOptionSync(id: id, key: key)); } -mainSetPeerBoolOptionSync(String id, String key, bool v) { - bind.mainSetPeerOptionSync(id: id, key: key, value: bool2option(key, v)); -} +// Don't use `option2bool()` and `bool2option()` to convert the session option. +// Use `sessionGetToggleOption()` and `sessionToggleOption()` instead. +// Because all session options use `Y` and `` as values. Future matchPeer(String searchText, Peer peer) async { if (searchText.isEmpty) { @@ -2670,7 +2670,7 @@ Future start_service(bool is_start) async { !isMacOS || await callMainCheckSuperUserPermission(); if (checked) { - bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y"); + mainSetBoolOption(kOptionStopService, !is_start); } }