fix: bug in warp config
This commit is contained in:
@@ -9,14 +9,11 @@ import 'package:hiddify/singbox/model/singbox_outbound.dart';
|
||||
import 'package:hiddify/singbox/model/singbox_stats.dart';
|
||||
import 'package:hiddify/singbox/model/singbox_status.dart';
|
||||
import 'package:hiddify/singbox/model/warp_account.dart';
|
||||
import 'package:hiddify/singbox/service/core_singbox_service.dart';
|
||||
import 'package:hiddify/singbox/service/singbox_service.dart';
|
||||
import 'package:hiddify/utils/custom_loggers.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
class PlatformSingboxService extends CoreSingboxService
|
||||
with InfraLogger
|
||||
implements SingboxService {
|
||||
class PlatformSingboxService with InfraLogger implements SingboxService {
|
||||
static const channelPrefix = "com.hiddify.app";
|
||||
|
||||
static const methodChannel = MethodChannel("$channelPrefix/method");
|
||||
@@ -49,13 +46,34 @@ class PlatformSingboxService extends CoreSingboxService
|
||||
TaskEither<String, Unit> setup(Directories directories, bool debug) {
|
||||
return TaskEither(
|
||||
() async {
|
||||
await methodChannel.invokeMethod("setup");
|
||||
if (!Platform.isIOS) {
|
||||
return right(unit);
|
||||
}
|
||||
|
||||
await methodChannel.invokeMethod("setup");
|
||||
return right(unit);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, Unit> validateConfigByPath(
|
||||
String path,
|
||||
String tempPath,
|
||||
bool debug,
|
||||
) {
|
||||
return TaskEither(
|
||||
() async {
|
||||
final message = await methodChannel.invokeMethod<String>(
|
||||
"parse_config",
|
||||
{"path": path, "tempPath": tempPath, "debug": debug},
|
||||
);
|
||||
if (message == null || message.isEmpty) return right(unit);
|
||||
return left(message);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, Unit> changeOptions(SingboxConfigOption options) {
|
||||
return TaskEither(
|
||||
@@ -70,6 +88,23 @@ class PlatformSingboxService extends CoreSingboxService
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, String> generateFullConfigByPath(String path) {
|
||||
return TaskEither(
|
||||
() async {
|
||||
loggy.debug("generating full config by path");
|
||||
final configJson = await methodChannel.invokeMethod<String>(
|
||||
"generate_config",
|
||||
{"path": path},
|
||||
);
|
||||
if (configJson == null || configJson.isEmpty) {
|
||||
return left("null response");
|
||||
}
|
||||
return right(configJson);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, Unit> start(
|
||||
String path,
|
||||
|
||||
Reference in New Issue
Block a user