mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: add check update
Closes #112 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -83,11 +83,15 @@ class _AboutPageState extends State<AboutPage> {
|
||||
),
|
||||
Obx(
|
||||
() => ListTile(
|
||||
// onTap: () => _aboutController.tapOnVersion(),
|
||||
onTap: Utils.checkUpdate,
|
||||
onLongPress: () =>
|
||||
Utils.copyText(_aboutController.currentVersion.value),
|
||||
title: const Text('当前版本'),
|
||||
leading: const Icon(Icons.commit_outlined),
|
||||
trailing: Text(_aboutController.currentVersion.value,
|
||||
style: subTitleStyle),
|
||||
trailing: Text(
|
||||
_aboutController.currentVersion.value,
|
||||
style: subTitleStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
@@ -100,6 +104,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
|
||||
leading: const Icon(Icons.info_outline),
|
||||
onTap: () => Utils.launchURL(
|
||||
'https://github.com/bggRGjQaUbCoE/PiliPlus/commit/${BuildConfig.commitHash}'),
|
||||
onLongPress: () => Utils.copyText(BuildConfig.commitHash),
|
||||
),
|
||||
// Obx(
|
||||
// () => ListTile(
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/pages/home/view.dart';
|
||||
import 'package:PiliPlus/pages/media/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -41,6 +42,9 @@ class MainController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
if (GStorage.autoUpdate) {
|
||||
Utils.checkUpdate();
|
||||
}
|
||||
hideTabBar =
|
||||
GStorage.setting.get(SettingBoxKey.hideTabBar, defaultValue: true);
|
||||
isLogin.value = GStorage.isLogin;
|
||||
|
||||
@@ -29,6 +29,7 @@ import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/recommend_filter.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:auto_orientation/auto_orientation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -1886,4 +1887,17 @@ List<SettingsModel> get extraSettings => [
|
||||
setKey: SettingBoxKey.autoClearCache,
|
||||
defaultVal: false,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '检查更新',
|
||||
subtitle: '每次启动时检查是否需要更新',
|
||||
leading: const Icon(Icons.system_update_alt_outlined),
|
||||
setKey: SettingBoxKey.autoUpdate,
|
||||
defaultVal: true,
|
||||
onChanged: (val) {
|
||||
if (val) {
|
||||
Utils.checkUpdate();
|
||||
}
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
@@ -84,9 +84,6 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
||||
val = value ?? !val;
|
||||
|
||||
await GStorage.setting.put(widget.setKey, val);
|
||||
// if (widget.setKey == SettingBoxKey.autoUpdate && value == true) {
|
||||
// Utils.checkUpdate();
|
||||
// }
|
||||
widget.onChanged?.call(val);
|
||||
if (widget.needReboot == true) {
|
||||
SmartDialog.showToast('重启生效');
|
||||
|
||||
Reference in New Issue
Block a user