Compare commits

..

1 Commits

Author SHA1 Message Date
chen08209
d8bd7fedd4 Add sqlite store
Optimize android quick action

Optimize backup and restore

Optimize more details
2026-01-25 16:38:52 +08:00
7 changed files with 19 additions and 28 deletions

View File

@@ -26,10 +26,6 @@ class Tray {
return system.isWindows ? 'ico' : 'png';
}
Future<void> destroy() async {
await trayManager.destroy();
}
String getTryIcon({required bool isStart, required bool tunEnable}) {
if (system.isMacOS || !isStart) {
return 'assets/images/icon/status_1.$trayIconSuffix';

View File

@@ -83,7 +83,6 @@ class Window {
}
Future<void> close() async {
await windowManager.close();
exit(0);
}

View File

@@ -138,11 +138,6 @@ extension InitControllerExt on AppController {
}
Future<void> _initStatus() async {
if (!globalState.needInitStatus) {
commonPrint.log('init status cancel');
return;
}
commonPrint.log('init status');
if (system.isAndroid) {
await globalState.updateStartTime();
}
@@ -555,6 +550,9 @@ extension SetupControllerExt on AppController {
Future<void> updateStatus(bool isStart, {bool isInit = false}) async {
if (isStart) {
_ref.read(runTimeProvider.notifier).update((state) {
return state ?? 0;
});
if (!isInit) {
final res = await tryStartCore(true);
if (res) {
@@ -566,7 +564,6 @@ extension SetupControllerExt on AppController {
await globalState.handleStart([updateRunTime, updateTraffic]);
applyProfileDebounce(force: true, silence: true);
} else {
globalState.needInitStatus = false;
await applyProfile(
force: true,
preloadInvoke: () async {
@@ -732,7 +729,6 @@ extension SetupControllerExt on AppController {
if (!force && !await needSetup()) {
return;
}
commonPrint.log('setup ===>');
var profile = _ref.read(currentProfileProvider);
final nextProfile = await profile?.checkAndUpdateAndCopy();
if (nextProfile != null) {
@@ -846,7 +842,7 @@ extension CoreControllerExt on AppController {
if (coreController.isCompleted) {
return false;
}
await restartCore(start);
await restartCore();
return true;
}
@@ -872,13 +868,12 @@ extension SystemControllerExt on AppController {
system.exit();
});
try {
await Future.wait([
if (needSave) preferences.saveConfig(config),
if (macOS != null) macOS!.updateDns(true),
if (proxy != null) proxy!.stopProxy(),
coreController.destroy(),
if (tray != null) tray!.destroy(),
]);
if (needSave) {
await preferences.saveConfig(config);
}
await proxy?.stopProxy();
await macOS?.updateDns(true);
await coreController.destroy();
commonPrint.log('exit');
} finally {
system.exit();

View File

@@ -1,4 +1,3 @@
import 'package:fl_clash/common/color.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -50,9 +49,9 @@ class InitErrorScreen extends StatelessWidget {
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: colorScheme.errorContainer.opacity50,
color: colorScheme.errorContainer.withOpacity(0.5),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: colorScheme.error.opacity50),
border: Border.all(color: colorScheme.error.withOpacity(0.5)),
),
child: SelectableText(
error.toString(),
@@ -72,7 +71,7 @@ class InitErrorScreen extends StatelessWidget {
? Colors.grey[900]
: Colors.grey[200],
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey.opacity50),
border: Border.all(color: Colors.grey.withOpacity(0.5)),
),
child: SelectableText(
stack.toString(),

View File

@@ -38,7 +38,6 @@ class GlobalState {
late Measure measure;
late CommonTheme theme;
late Color accentColor;
bool needInitStatus = true;
CorePalette? corePalette;
DateTime? startTime;
UpdateTasks tasks = [];

View File

@@ -33,7 +33,10 @@ class _StartButtonState extends ConsumerState<StartButton>
parent: _controller!,
curve: Curves.easeOutBack,
);
ref.listenManual(isStartProvider, (prev, next) {
ref.listenManual(runTimeProvider.select((state) => state != null), (
prev,
next,
) {
if (next != isStart) {
isStart = next;
updateController();
@@ -52,7 +55,7 @@ class _StartButtonState extends ConsumerState<StartButton>
isStart = !isStart;
updateController();
debouncer.call(FunctionTag.updateStatus, () {
appController.updateStatus(isStart, isInit: !ref.read(initProvider));
appController.updateStatus(isStart);
}, duration: commonDuration);
}

View File

@@ -1,7 +1,7 @@
name: fl_clash
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
publish_to: 'none'
version: 0.8.92+2026012504
version: 0.8.92+2026012502
environment:
sdk: '>=3.8.0 <4.0.0'