Add connection info footer
This commit is contained in:
@@ -318,6 +318,12 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
return _outboundsStream = outboundsStream;
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<List<SingboxOutboundGroup>> watchActiveOutbounds() {
|
||||
// TODO: implement watchActiveOutbounds
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
TaskEither<String, Unit> selectOutbound(String groupTag, String outboundTag) {
|
||||
return TaskEither(
|
||||
|
||||
@@ -182,6 +182,23 @@ class PlatformSingboxService with InfraLogger implements SingboxService {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<List<SingboxOutboundGroup>> watchActiveOutbounds() {
|
||||
const channel = EventChannel("com.hiddify.app/active-groups");
|
||||
loggy.debug("watching active outbounds");
|
||||
return channel.receiveBroadcastStream().map(
|
||||
(event) {
|
||||
if (event case String _) {
|
||||
return (jsonDecode(event) as List).map((e) {
|
||||
return SingboxOutboundGroup.fromJson(e as Map<String, dynamic>);
|
||||
}).toList();
|
||||
}
|
||||
loggy.error("[active group client] unexpected type, msg: $event");
|
||||
throw "invalid type";
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<SingboxStatus> watchStatus() => _status;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ abstract interface class SingboxService {
|
||||
|
||||
Stream<List<SingboxOutboundGroup>> watchOutbounds();
|
||||
|
||||
Stream<List<SingboxOutboundGroup>> watchActiveOutbounds();
|
||||
|
||||
TaskEither<String, Unit> selectOutbound(String groupTag, String outboundTag);
|
||||
|
||||
TaskEither<String, Unit> urlTest(String groupTag);
|
||||
|
||||
Reference in New Issue
Block a user