add WebDAV

add Auto check updates

Optimize more details
This commit is contained in:
chen08209
2024-05-20 15:15:09 +08:00
parent c4b470ffaf
commit 91d30c0f0e
65 changed files with 2866 additions and 1565 deletions

View File

@@ -116,7 +116,7 @@ class AppController {
);
}
applyProfile() async {
Future applyProfile() async {
await globalState.applyProfile(
appState: appState,
config: config,
@@ -208,6 +208,17 @@ class AppController {
}
}
autoCheckUpdate() async {
final res = await Request.checkForUpdate();
if(res.type != ResultType.success) return;
globalState.showMessage(
title: appLocalizations.checkUpdate,
message: TextSpan(
text: res.data,
),
);
}
afterInit() async {
if (config.autoRun) {
await updateSystemProxy(true);
@@ -220,6 +231,7 @@ class AppController {
if (!config.silentLaunch) {
window?.show();
}
autoCheckUpdate();
}
healthcheck() {
@@ -244,8 +256,7 @@ class AppController {
}
toPage(int index, {bool hasAnimate = false}) {
final nextLabel = globalState.currentNavigationItems[index].label;
appState.currentLabel = nextLabel;
appState.currentLabel = appState.currentNavigationItems[index].label;
if ((config.isAnimateToPage || hasAnimate)) {
globalState.pageController?.animateToPage(
index,
@@ -257,12 +268,9 @@ class AppController {
}
}
updatePackages() async {
await globalState.updatePackages(appState);
}
toProfiles() {
final index = globalState.currentNavigationItems.indexWhere(
final index = appState.currentNavigationItems.indexWhere(
(element) => element.label == "profiles",
);
if (index != -1) {
@@ -385,4 +393,13 @@ class AppController {
globalState.updateCurrentDelay(showProxyDelay);
}
}
updateViewWidth(){
appState.viewWidth = context.width;
if(appState.viewWidth == 0){
Future.delayed(moreDuration,(){
updateViewWidth();
});
}
}
}