feat: replace forceAppUpdate with customed reloadWindow

This commit is contained in:
Kingtous
2022-10-26 14:39:13 +08:00
parent ee796b7a06
commit 2301d09303
13 changed files with 214 additions and 117 deletions

View File

@@ -5,6 +5,7 @@ import 'dart:convert';
import 'package:flutter/material.dart' hide MenuItem;
import 'package:flutter/services.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/desktop/pages/connection_page.dart';
import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart';
import 'package:flutter_hbb/desktop/pages/desktop_tab_page.dart';
@@ -452,6 +453,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
'scaleFactor': screen.scaleFactor,
});
}
} else if (call.method == kWindowActionRebuild) {
reloadCurrentWindow();
}
});
Future.delayed(Duration.zero, () {

View File

@@ -406,7 +406,7 @@ class _GeneralState extends State<_General> {
initialKey: currentKey,
onChanged: (key) async {
await bind.mainSetLocalOption(key: "lang", value: key);
Get.forceAppUpdate();
reloadAllWindows();
bind.mainChangeLanguage(lang: key);
},
).marginOnly(left: _kContentHMargin);

View File

@@ -47,7 +47,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
print(
"call ${call.method} with args ${call.arguments} from window ${fromWindowId} to ${windowId()}");
"[FileTransfer] call ${call.method} with args ${call.arguments} from window ${fromWindowId} to ${windowId()}");
// for simplify, just replace connectionId
if (call.method == "new_file_transfer") {
final args = jsonDecode(call.arguments);
@@ -62,6 +62,8 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
page: FileManagerPage(key: ValueKey(id), id: id)));
} else if (call.method == "onDestroy") {
tabController.clear();
} else if (call.method == kWindowActionRebuild) {
reloadCurrentWindow();
}
});
Future.delayed(Duration.zero, () {

View File

@@ -70,6 +70,8 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
page: PortForwardPage(id: id, isRDP: isRDP)));
} else if (call.method == "onDestroy") {
tabController.clear();
} else if (call.method == kWindowActionRebuild) {
reloadCurrentWindow();
}
});
Future.delayed(Duration.zero, () {

View File

@@ -89,6 +89,8 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
))));
} else if (call.method == "onDestroy") {
tabController.clear();
} else if (call.method == kWindowActionRebuild) {
reloadCurrentWindow();
}
_update_remote_count();
});