add basic routing options, auto update routing assets,use ruleset, remove geo assets

This commit is contained in:
hiddify-com
2024-07-04 21:04:44 +02:00
parent 93f4bbca32
commit c6d34e7455
27 changed files with 773 additions and 835 deletions

View File

@@ -15,16 +15,13 @@ class ConfigOptionNotifier extends _$ConfigOptionNotifier with AppLogger {
@override
Future<bool> build() async {
final serviceRunning = await ref.watch(serviceRunningProvider.future);
final serviceSingboxOptions =
ref.read(connectionRepositoryProvider).configOptionsSnapshot;
final serviceSingboxOptions = ref.read(connectionRepositoryProvider).configOptionsSnapshot;
ref.listen(
ConfigOptions.singboxConfigOptions,
(previous, next) async {
if (!serviceRunning || serviceSingboxOptions == null) return;
if (next case AsyncData(:final value) when next != previous) {
if (_lastUpdate == null ||
DateTime.now().difference(_lastUpdate!) >
const Duration(milliseconds: 100)) {
if (_lastUpdate == null || DateTime.now().difference(_lastUpdate!) > const Duration(milliseconds: 100)) {
_lastUpdate = DateTime.now();
state = AsyncData(value != serviceSingboxOptions);
}
@@ -63,8 +60,7 @@ class ConfigOptionNotifier extends _$ConfigOptionNotifier with AppLogger {
Future<bool> importFromClipboard() async {
try {
final input =
await Clipboard.getData("text/plain").then((value) => value?.text);
final input = await Clipboard.getData("text/plain").then((value) => value?.text);
if (input == null) return false;
if (jsonDecode(input) case final Map<String, dynamic> map) {
for (final option in ConfigOptions.preferences.entries) {