Fix profile update bug

This commit is contained in:
problematicconsumer
2023-09-22 23:52:20 +03:30
parent 9cd4fe48bd
commit 92538d137b
11 changed files with 73 additions and 32 deletions

View File

@@ -84,12 +84,20 @@ class FFISingboxService
}
@override
TaskEither<String, Unit> parseConfig(String path) {
TaskEither<String, Unit> parseConfig(
String path,
String tempPath,
bool debug,
) {
return TaskEither(
() => CombineWorker().execute(
() {
final err = _box
.parse(path.toNativeUtf8().cast())
.parse(
path.toNativeUtf8().cast(),
tempPath.toNativeUtf8().cast(),
debug ? 1 : 0,
)
.cast<Utf8>()
.toDartString();
if (err.isNotEmpty) {

View File

@@ -42,12 +42,16 @@ class MobileSingboxService
TaskEither.of(unit);
@override
TaskEither<String, Unit> parseConfig(String path) {
TaskEither<String, Unit> parseConfig(
String path,
String tempPath,
bool debug,
) {
return TaskEither(
() async {
final message = await _methodChannel.invokeMethod<String>(
"parse_config",
{"path": path},
{"path": path, "tempPath": tempPath, "debug": debug},
);
if (message == null || message.isEmpty) return right(unit);
return left(message);

View File

@@ -24,7 +24,11 @@ abstract interface class SingboxService {
String tempDir,
);
TaskEither<String, Unit> parseConfig(String path);
TaskEither<String, Unit> parseConfig(
String path,
String tempPath,
bool debug,
);
TaskEither<String, Unit> changeConfigOptions(ConfigOptions options);