mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-23 16:45:27 +01:00
#77 new: also when backing app
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 380;
|
||||
static const int build = 387;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-07-20 18:08:32.806339";
|
||||
static const int modifications = 14;
|
||||
static const String buildAt = "2023-07-21 18:06:24.239059";
|
||||
static const int modifications = 2;
|
||||
}
|
||||
|
||||
@@ -15,3 +15,4 @@ const maxDebugLogLines = 100;
|
||||
/// Method Channels
|
||||
const pkgName = 'tech.lolli.toolbox';
|
||||
const bgRunChannel = MethodChannel('$pkgName/app_retain');
|
||||
const homeWidgetChannel = MethodChannel('$pkgName/home_widget');
|
||||
|
||||
@@ -95,4 +95,7 @@ class SettingStore extends PersistentStore {
|
||||
|
||||
StoreProperty<NetViewType> get netViewType =>
|
||||
property('netViewType', defaultValue: NetViewType.speed);
|
||||
|
||||
// Only valid on iOS
|
||||
StoreProperty<bool> get autoUpdateHomeWidget => property('autoUpdateHomeWidget', defaultValue: isIOS);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"alreadyLastDir": "Bereits im letzten Verzeichnis.",
|
||||
"attention": "Achtung",
|
||||
"auto": "System folgen",
|
||||
"autoUpdateHomeWidget": "Home-Widget automatisch aktualisieren",
|
||||
"backup": "Backup",
|
||||
"backupAndRestore": "Backup und Wiederherstellung",
|
||||
"backupTip": "Das Backup wird nur einfach verschlüsselt.\nBitte bewahre die Datei sicher auf.",
|
||||
@@ -204,5 +205,6 @@
|
||||
"versionUpdated": "v1.0.{build} ist bereits die neueste Version",
|
||||
"viewErr": "Fehler anzeigen",
|
||||
"waitConnection": "Bitte warte, bis die Verbindung hergestellt wurde.",
|
||||
"whenOpenApp": "Beim Öffnen der App",
|
||||
"willTakEeffectImmediately": "Wird sofort angewendet"
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"alreadyLastDir": "Already in last directory.",
|
||||
"attention": "Attention",
|
||||
"auto": "Auto",
|
||||
"autoUpdateHomeWidget": "Auto update home widget",
|
||||
"backup": "Backup",
|
||||
"backupAndRestore": "Backup and Restore",
|
||||
"backupTip": "The exported data is simply encrypted. \nPlease keep it safe.",
|
||||
@@ -204,5 +205,6 @@
|
||||
"versionUpdated": "Current: v1.0.{build}, is up to date",
|
||||
"viewErr": "See error",
|
||||
"waitConnection": "Please wait for the connection to be established.",
|
||||
"whenOpenApp": "When opening the app",
|
||||
"willTakEeffectImmediately": "Will take effect immediately"
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"alreadyLastDir": "已经是最上层目录了",
|
||||
"attention": "注意",
|
||||
"auto": "自动",
|
||||
"autoUpdateHomeWidget": "自动更新桌面小部件",
|
||||
"backup": "备份",
|
||||
"backupAndRestore": "备份和恢复",
|
||||
"backupTip": "导出的数据仅进行了简单加密,请妥善保管。",
|
||||
@@ -204,5 +205,6 @@
|
||||
"versionUpdated": "当前:v1.0.{build}, 已是最新版本",
|
||||
"viewErr": "查看错误",
|
||||
"waitConnection": "请等待连接建立",
|
||||
"whenOpenApp": "当打开 App 时",
|
||||
"willTakEeffectImmediately": "更改将会立即生效"
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"alreadyLastDir": "已經是最上層目錄了",
|
||||
"attention": "注意",
|
||||
"auto": "自動",
|
||||
"autoUpdateHomeWidget": "自動更新桌面小部件",
|
||||
"backup": "備份",
|
||||
"backupAndRestore": "備份和還原",
|
||||
"backupTip": "導出的數據僅進行了簡單加密,請妥善保管。",
|
||||
@@ -204,5 +205,6 @@
|
||||
"versionUpdated": "當前:v1.0.{build}, 已是最新版本",
|
||||
"viewErr": "查看錯誤",
|
||||
"waitConnection": "請等待連接建立",
|
||||
"whenOpenApp": "當打開 App 時",
|
||||
"willTakEeffectImmediately": "更改將會立即生效"
|
||||
}
|
||||
@@ -85,6 +85,7 @@ class _HomePageState extends State<HomePage>
|
||||
if (!_serverProvider.isAutoRefreshOn) {
|
||||
_serverProvider.startAutoRefresh();
|
||||
}
|
||||
updateHomeWidget();
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
// Keep running in background on Android device
|
||||
@@ -306,6 +307,7 @@ class _HomePageState extends State<HomePage>
|
||||
@override
|
||||
Future<void> afterFirstLayout(BuildContext context) async {
|
||||
doUpdate(context);
|
||||
updateHomeWidget();
|
||||
await GetIt.I.allReady();
|
||||
await _serverProvider.loadLocalData();
|
||||
await _serverProvider.refreshData();
|
||||
@@ -313,4 +315,10 @@ class _HomePageState extends State<HomePage>
|
||||
Analysis.init();
|
||||
}
|
||||
}
|
||||
|
||||
void updateHomeWidget() {
|
||||
if (_setting.autoUpdateHomeWidget.fetch()!) {
|
||||
homeWidgetChannel.invokeMethod('update');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
];
|
||||
if (isIOS) {
|
||||
children.add(_buildPushToken());
|
||||
children.add(_buildAutoUpdateHomeWidget());
|
||||
}
|
||||
if (isAndroid) {
|
||||
children.add(_buildBgRun());
|
||||
@@ -928,4 +929,12 @@ class _SettingPageState extends State<SettingPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAutoUpdateHomeWidget() {
|
||||
return ListTile(
|
||||
title: Text(_s.autoUpdateHomeWidget),
|
||||
subtitle: Text(_s.whenOpenApp, style: grey),
|
||||
trailing: buildSwitch(context, _setting.autoUpdateHomeWidget),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user