Add android dynamic notification

This commit is contained in:
problematicconsumer
2023-12-14 14:50:10 +03:30
parent b9f1e83473
commit af64efec00
19 changed files with 251 additions and 95 deletions

View File

@@ -158,7 +158,11 @@ class FFISingboxService with InfraLogger implements SingboxService {
}
@override
TaskEither<String, Unit> start(String configPath, bool disableMemoryLimit) {
TaskEither<String, Unit> start(
String configPath,
String name,
bool disableMemoryLimit,
) {
loggy.debug("starting, memory limit: [${!disableMemoryLimit}]");
return TaskEither(
() => CombineWorker().execute(
@@ -195,7 +199,11 @@ class FFISingboxService with InfraLogger implements SingboxService {
}
@override
TaskEither<String, Unit> restart(String configPath, bool disableMemoryLimit) {
TaskEither<String, Unit> restart(
String configPath,
String name,
bool disableMemoryLimit,
) {
loggy.debug("restarting, memory limit: [${!disableMemoryLimit}]");
return TaskEither(
() => CombineWorker().execute(

View File

@@ -89,13 +89,17 @@ class PlatformSingboxService with InfraLogger implements SingboxService {
}
@override
TaskEither<String, Unit> start(String path, bool disableMemoryLimit) {
TaskEither<String, Unit> start(
String path,
String name,
bool disableMemoryLimit,
) {
return TaskEither(
() async {
loggy.debug("starting");
await _methodChannel.invokeMethod(
"start",
{"path": path},
{"path": path, "name": name},
);
return right(unit);
},
@@ -114,13 +118,17 @@ class PlatformSingboxService with InfraLogger implements SingboxService {
}
@override
TaskEither<String, Unit> restart(String path, bool disableMemoryLimit) {
TaskEither<String, Unit> restart(
String path,
String name,
bool disableMemoryLimit,
) {
return TaskEither(
() async {
loggy.debug("restarting");
await _methodChannel.invokeMethod(
"restart",
{"path": path},
{"path": path, "name": name},
);
return right(unit);
},

View File

@@ -38,11 +38,19 @@ abstract interface class SingboxService {
String path,
);
TaskEither<String, Unit> start(String path, bool disableMemoryLimit);
TaskEither<String, Unit> start(
String path,
String name,
bool disableMemoryLimit,
);
TaskEither<String, Unit> stop();
TaskEither<String, Unit> restart(String path, bool disableMemoryLimit);
TaskEither<String, Unit> restart(
String path,
String name,
bool disableMemoryLimit,
);
Stream<List<SingboxOutboundGroup>> watchOutbounds();