Add connection info footer

This commit is contained in:
problematicconsumer
2024-02-09 12:02:52 +03:30
parent 37dc33667e
commit 7394f7c4c3
23 changed files with 520 additions and 65 deletions

View File

@@ -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(

View File

@@ -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;

View File

@@ -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);