Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ui/flutter/lib/api/model/downloader_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ExtraConfig {
bool lastDeleteTaskKeep;
bool defaultDirectDownload;
bool defaultBtClient;
bool notifyWhenNewVersion;

ExtraConfigBt bt = ExtraConfigBt();

Expand All @@ -90,6 +91,7 @@ class ExtraConfig {
this.lastDeleteTaskKeep = false,
this.defaultDirectDownload = false,
this.defaultBtClient = true,
this.notifyWhenNewVersion = true,
});

factory ExtraConfig.fromJson(Map<String, dynamic>? json) =>
Expand Down
2 changes: 2 additions & 0 deletions ui/flutter/lib/api/model/downloader_config.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ class AppController extends GetxController with WindowListener, TrayListener {
}

Future<void> _initCheckUpdate() async {
// Check if auto check update is enabled
if (!downloaderConfig.value.extra.notifyWhenNewVersion) {
return;
}

final versionInfo = await checkUpdate();
if (versionInfo != null) {
await showUpdateDialog(Get.context!, versionInfo);
Expand Down
20 changes: 20 additions & 0 deletions ui/flutter/lib/app/modules/setting/views/setting_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,25 @@ class SettingView extends GetView<SettingController> {
);
}

final buildAutoCheckUpdate = _buildConfigItem(
'notifyWhenNewVersion',
() =>
downloaderCfg.value.extra.notifyWhenNewVersion ? 'on'.tr : 'off'.tr,
(Key key) {
return Container(
alignment: Alignment.centerLeft,
child: Switch(
value: downloaderCfg.value.extra.notifyWhenNewVersion,
onChanged: (bool value) async {
downloaderCfg.update((val) {
val!.extra.notifyWhenNewVersion = value;
});
await debounceSave();
},
),
);
});

buildThanks() {
const thankPage =
'https://github.com/GopeedLab/gopeed/graphs/contributors';
Expand Down Expand Up @@ -957,6 +976,7 @@ class SettingView extends GetView<SettingController> {
children: _addDivider([
buildHomepage(),
buildVersion(),
buildAutoCheckUpdate(),
buildThanks(),
]),
)),
Expand Down
1 change: 1 addition & 0 deletions ui/flutter/lib/i18n/langs/en_us.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const enUS = {
'themeLight': 'Light',
'themeDark': 'Dark',
'locale': 'Language',
'notifyWhenNewVersion': 'Notify for updates',
'about': 'About',
'homepage': 'Homepage',
'version': 'Version',
Expand Down
1 change: 1 addition & 0 deletions ui/flutter/lib/i18n/langs/zh_cn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const zhCN = {
'themeLight': '明亮主题',
'themeDark': '暗黑主题',
'locale': '语言',
'notifyWhenNewVersion': '有新版本时提醒',
'about': '关于',
'homepage': '主页',
'version': '版本',
Expand Down
Loading