fix: bug in warp config
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -7,6 +7,8 @@
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"program": "lib/main.dart",
|
||||
// "args": ["-d","192.168.1.35:36463"]
|
||||
|
||||
},
|
||||
{
|
||||
"name": "Hiddify Dev Release",
|
||||
@@ -36,7 +38,7 @@
|
||||
"program": "lib/main.dart",
|
||||
"args": [
|
||||
"--app-id",
|
||||
"com.hiddify.ios"
|
||||
"app.hiddify.com"
|
||||
],
|
||||
"deviceId": "designed-for-ipad",
|
||||
}
|
||||
|
||||
@@ -65,7 +65,9 @@ class WarpOptionNotifier extends _$WarpOptionNotifier with AppLogger {
|
||||
await ref
|
||||
.read(ConfigOptions.warpAccessToken.notifier)
|
||||
.update(warp.accessToken);
|
||||
|
||||
await ref
|
||||
.read(ConfigOptions.warpWireguardConfig.notifier)
|
||||
.update(warp.wireguardConfig);
|
||||
return warp.log;
|
||||
});
|
||||
|
||||
|
||||
@@ -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,9 +46,30 @@ 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);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
2
libcore
2
libcore
Submodule libcore updated: 84e5933d9d...4bdcb7c4c9
Reference in New Issue
Block a user