Skip to content

Commit e10a724

Browse files
committed
细化是否弹出更新提示信息的配置选项
1 parent 37e863d commit e10a724

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

src/main/java/com/github/balloonupdate/mcpatch/client/Work.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,9 @@ boolean run2(Servers server) throws IOException, McpatchBusinessException {
609609

610610
// 3.弹出更新记录窗口
611611
if (window != null) {
612-
String content = String.format("已经从 %s 更新到 %s\r\n\r\n%s", currentVersion, latestVersion, changelogs.trim().replace("\n", "\r\n"));
612+
if (!missingVersions.isEmpty() && config.showHasUpdateMessage) {
613+
String content = String.format("已经从 %s 更新到 %s\r\n\r\n%s", currentVersion, latestVersion, changelogs.trim().replace("\n", "\r\n"));
613614

614-
if (config.showFinishMessage) {
615615
ChangeLogs cl = new ChangeLogs();
616616

617617
cl.setTitleText(config.windowTitle);
@@ -634,7 +634,7 @@ boolean run2(Servers server) throws IOException, McpatchBusinessException {
634634
if (window != null) {
635635
window.setLabelText("暂时没有更新");
636636

637-
if (config.showFinishMessage) {
637+
if (config.showNoUpdateMessage) {
638638
String title = config.windowTitle;
639639
String content = "暂时没有更新,当前版本:" + currentVersion;
640640

src/main/java/com/github/balloonupdate/mcpatch/client/config/AppConfig.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ public class AppConfig {
2929
public boolean allowError;
3030

3131
/**
32-
* 在没有更新时,是否显示“资源文件暂无更新!”提示框<p>
33-
* 在有更新时,此选项不生效
32+
* 在没有更新时,是否显示“资源文件暂无更新!”提示框
3433
*/
35-
public boolean showFinishMessage;
34+
public boolean showNoUpdateMessage;
35+
36+
/**
37+
* 在有更新时,是否显示更新日志提示框
38+
*/
39+
public boolean showHasUpdateMessage;
3640

3741
/**
3842
* 自动关闭更新日志的时间,单位为毫秒。设置为0代表不会自动关闭更新日志窗口,需要手点
@@ -117,11 +121,12 @@ public AppConfig(Map<String, Object> map) {
117121
List<String> urls = getList(map, "urls", null, new ArrayList<>());
118122
String versionFilePath = getString(map, "version-file-path", null, "version-label.txt");
119123
boolean allowError = getBoolean(map, "allow-error", null, false);
120-
boolean showFinishMessage = getBoolean(map, "show-finish-message", null, true);
124+
boolean showNoUpdateMessage = getBoolean(map, "show-no-update-message", "show-finish-message", true);
125+
boolean showHasUpdateMessage = getBoolean(map, "show-has-update-message", "show-finish-message", true);
121126
int autoCloseChangelogs = getInt(map, "auto-close-changelogs", null, 0);
122127
boolean silentMode = getBoolean(map, "silent-mode", null, false);
123128
boolean disableTheme = getBoolean(map, "disable-theme", null, false);
124-
String windowTitle = getString(map, "window-title", null, "Mcpatch");
129+
String windowTitle = getString(map, "window-title", "changelogs_window_title", "Mcpatch");
125130
String basePath = getString(map, "base-path", null, "");
126131
int privateTimeout = getInt(map, "private-timeout", null, 7000);
127132
Map<String, String> httpHeaders = getMap(map, "http-headers", null, new HashMap<>());
@@ -137,7 +142,8 @@ public AppConfig(Map<String, Object> map) {
137142
this.urls = urls;
138143
this.versionFilePath = versionFilePath;
139144
this.allowError = allowError;
140-
this.showFinishMessage = showFinishMessage;
145+
this.showNoUpdateMessage = showNoUpdateMessage;
146+
this.showHasUpdateMessage = showHasUpdateMessage;
141147
this.autoCloseChangelogs = autoCloseChangelogs;
142148
this.silentMode = silentMode;
143149
this.windowTitle = windowTitle;

src/main/resources/mcpatch.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ version-file-path: version-label.txt
2727
allow-error: false
2828

2929
# 在没有更新时,是否显示“资源文件暂无更新!”提示框
30-
# 在有更新时,此选项不生效
31-
show-finish-message: true
30+
show-no-update-message: true
31+
32+
# 在有更新时,是否显示更新日志提示框
33+
show-has-update-message: true
3234

3335
# 自动关闭更新日志的时间,单位为毫秒。设置为0代表不会自动关闭更新日志窗口,需要手点
3436
auto-close-changelogs: 0

0 commit comments

Comments
 (0)