opt. & fix.

fix: setting page update item display issue.
fix: `bgRun` condition issue.
opt: `r_upgrade` use 0.3.8+2
This commit is contained in:
lollipopkit
2023-04-04 17:38:00 +08:00
parent 0ac6984576
commit 19baff5dde
5 changed files with 18 additions and 14 deletions

View File

@@ -27,8 +27,6 @@ Future<bool> isFileAvailable(String url) async {
Future<void> doUpdate(BuildContext context, {bool force = false}) async {
final update = await locator<AppService>().getUpdate();
locator<AppProvider>().setNewestBuild(update.newest);
final newest = () {
if (isAndroid) {
return update.androidbuild;
@@ -40,6 +38,8 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
return update.newest;
}();
locator<AppProvider>().setNewestBuild(newest);
if (!force && newest <= BuildData.build) {
_logger.info('Update ignored due to current: ${BuildData.build}, '
'update: $newest');

View File

@@ -9,7 +9,7 @@ import '../../locator.dart';
/// Must put this func out of any Class.
///
/// Because of this function is called by [compute] in [ServerProvider.genClient].
/// Because of this function is called by [compute].
///
/// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure
List<SSHKeyPair> loadIndentity(String key) {

View File

@@ -44,8 +44,11 @@ class _MyHomePageState extends State<MyHomePage>
AutomaticKeepAliveClientMixin,
AfterLayoutMixin,
WidgetsBindingObserver {
late final ServerProvider _serverProvider;
final _serverProvider = locator<ServerProvider>();
final _setting = locator<SettingStore>();
late final PageController _pageController;
late int _selectIndex;
late double _width;
late S _s;
@@ -53,9 +56,8 @@ class _MyHomePageState extends State<MyHomePage>
@override
void initState() {
super.initState();
_serverProvider = locator<ServerProvider>();
WidgetsBinding.instance.addObserver(this);
_selectIndex = locator<SettingStore>().launchPage.fetch()!;
_selectIndex = _setting.launchPage.fetch()!;
_pageController = PageController(initialPage: _selectIndex);
}
@@ -85,7 +87,7 @@ class _MyHomePageState extends State<MyHomePage>
}
break;
case AppLifecycleState.paused:
if (isAndroid) {
if (isAndroid && _setting.bgRun.fetch()!) {
// Keep running in background on Android device
bgRunChannel.invokeMethod('sendToBackground');
} else {