Add reset tunnel option on ios
This commit is contained in:
@@ -224,6 +224,13 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, Unit> resetTunnel() {
|
||||
throw UnimplementedError(
|
||||
"reset tunnel function unavailable on platform",
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<SingboxStatus> watchStatus() => _status;
|
||||
|
||||
|
||||
@@ -147,6 +147,24 @@ class PlatformSingboxService with InfraLogger implements SingboxService {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, Unit> resetTunnel() {
|
||||
return TaskEither(
|
||||
() async {
|
||||
// only available on iOS (and macOS later)
|
||||
if (!Platform.isIOS) {
|
||||
throw UnimplementedError(
|
||||
"reset tunnel function unavailable on platform",
|
||||
);
|
||||
}
|
||||
|
||||
loggy.debug("resetting tunnel");
|
||||
await _methodChannel.invokeMethod("reset");
|
||||
return right(unit);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<List<SingboxOutboundGroup>> watchOutbounds() {
|
||||
const channel = EventChannel("com.hiddify.app/groups");
|
||||
|
||||
@@ -52,6 +52,8 @@ abstract interface class SingboxService {
|
||||
bool disableMemoryLimit,
|
||||
);
|
||||
|
||||
TaskEither<String, Unit> resetTunnel();
|
||||
|
||||
Stream<List<SingboxOutboundGroup>> watchOutbounds();
|
||||
|
||||
TaskEither<String, Unit> selectOutbound(String groupTag, String outboundTag);
|
||||
|
||||
Reference in New Issue
Block a user