opt.: display err if home widget fails (#659)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-12-15 23:39:38 +08:00
committed by GitHub
parent 2f6db2961f
commit aaa1eddeaf
13 changed files with 202 additions and 165 deletions

View File

@@ -1,14 +1,15 @@
import 'package:flutter/services.dart';
import 'package:server_box/data/res/misc.dart';
abstract final class BgRunMC {
static const _channel = MethodChannel('${Miscs.pkgName}/app_retain');
abstract final class MethodChans {
static const _channel = MethodChannel('${Miscs.pkgName}/main_chan');
static void moveToBg() {
_channel.invokeMethod('sendToBackground');
}
/// TODO: try fix the fn, then uncomment it and [stopService]
/// Issues #639
static void startService() {
// _channel.invokeMethod('startService');
}
@@ -16,4 +17,9 @@ abstract final class BgRunMC {
static void stopService() {
// _channel.invokeMethod('stopService');
}
static void updateHomeWidget() async {
//if (!Stores.setting.autoUpdateHomeWidget.fetch()) return;
await _channel.invokeMethod('updateHomeWidget');
}
}

View File

@@ -1,12 +0,0 @@
import 'package:flutter/services.dart';
import 'package:server_box/data/res/misc.dart';
import 'package:server_box/data/res/store.dart';
abstract final class HomeWidgetMC {
static const _channel = MethodChannel('${Miscs.pkgName}/home_widget');
static void update() {
if (!Stores.setting.autoUpdateHomeWidget.fetch()) return;
_channel.invokeMethod('update');
}
}