Feature: Display feedback form when updating Terracotta. (#4611)

This commit is contained in:
Burning_TNT
2025-10-05 20:35:49 +08:00
committed by GitHub
parent 460134cc1e
commit c98dbe6694
6 changed files with 25 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ public final class TerracottaMetadata {
@SerializedName("version_legacy") String legacy, @SerializedName("version_legacy") String legacy,
@SerializedName("version_recent") List<String> recent, @SerializedName("version_recent") List<String> recent,
@SerializedName("version_latest") String latest, @SerializedName("version_latest") String latest,
@SerializedName("feedback_url") String feedbackURL,
@SerializedName("classifiers") Map<String, String> classifiers, @SerializedName("classifiers") Map<String, String> classifiers,
@SerializedName("downloads") List<String> downloads, @SerializedName("downloads") List<String> downloads,
@@ -86,7 +87,8 @@ public final class TerracottaMetadata {
public static final ITerracottaProvider PROVIDER; public static final ITerracottaProvider PROVIDER;
public static final String PACKAGE_NAME; public static final String PACKAGE_NAME;
private static final List<Link> PACKAGE_LINKS; public static final List<Link> PACKAGE_LINKS;
public static final String FEEDBACK_LINK;
private static final Pattern LEGACY; private static final Pattern LEGACY;
private static final List<String> RECENT; private static final List<String> RECENT;
@@ -103,6 +105,7 @@ public final class TerracottaMetadata {
LEGACY = Pattern.compile(config.legacy); LEGACY = Pattern.compile(config.legacy);
RECENT = config.recent; RECENT = config.recent;
LATEST = config.latest; LATEST = config.latest;
FEEDBACK_LINK = config.feedbackURL;
ProviderContext context = locateProvider(config); ProviderContext context = locateProvider(config);
PROVIDER = context != null ? context.provider() : null; PROVIDER = context != null ? context.provider() : null;
@@ -131,10 +134,6 @@ public final class TerracottaMetadata {
} }
} }
public static List<Link> getPackageLinks() {
return PACKAGE_LINKS;
}
@Nullable @Nullable
private static ProviderContext locateProvider(Config config) { private static ProviderContext locateProvider(Config config) {
String architecture = switch (Architecture.SYSTEM_ARCH) { String architecture = switch (Architecture.SYSTEM_ARCH) {

View File

@@ -84,10 +84,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import static org.jackhuang.hmcl.setting.ConfigHolder.config;
import static org.jackhuang.hmcl.setting.ConfigHolder.globalConfig; import static org.jackhuang.hmcl.setting.ConfigHolder.globalConfig;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n; import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public class TerracottaControllerPage extends StackPane { public class TerracottaControllerPage extends StackPane {
private static final String FEEDBACK_TIP = "terracotta-feedback";
private static final ObjectProperty<TerracottaState> UI_STATE = new SimpleObjectProperty<>(); private static final ObjectProperty<TerracottaState> UI_STATE = new SimpleObjectProperty<>();
static { static {
@@ -187,6 +189,17 @@ public class TerracottaControllerPage extends StackPane {
if (s != null) { if (s != null) {
UI_STATE.set(s); UI_STATE.set(s);
} }
if (uninitialized.hasLegacy() && I18n.isUseChinese()) {
Object feedback = config().getShownTips().get(FEEDBACK_TIP);
if (!(feedback instanceof Number number) || number.intValue() < 1) {
Controllers.confirm(i18n("terracotta.feedback.desc"), i18n("terracotta.feedback.title"), () -> {
FXUtils.openLink(TerracottaMetadata.FEEDBACK_LINK);
config().getShownTips().put(FEEDBACK_TIP, 1);
}, () -> {
});
}
}
} else { } else {
Controllers.confirmActionDanger(i18n("terracotta.confirm.desc"), i18n("terracotta.confirm.title"), () -> { Controllers.confirmActionDanger(i18n("terracotta.confirm.desc"), i18n("terracotta.confirm.title"), () -> {
globalConfig().setTerracottaAgreementVersion(1); globalConfig().setTerracottaAgreementVersion(1);
@@ -552,7 +565,7 @@ public class TerracottaControllerPage extends StackPane {
header.setSubtitle(i18n("terracotta.from_local.desc")); header.setSubtitle(i18n("terracotta.from_local.desc"));
locals.setHeaderLeft(header); locals.setHeaderLeft(header);
for (TerracottaMetadata.Link link : TerracottaMetadata.getPackageLinks()) { for (TerracottaMetadata.Link link : TerracottaMetadata.PACKAGE_LINKS) {
HBox node = new HBox(); HBox node = new HBox();
node.setAlignment(Pos.CENTER_LEFT); node.setAlignment(Pos.CENTER_LEFT);
node.setPadding(new Insets(10, 16, 10, 16)); node.setPadding(new Insets(10, 16, 10, 16));

View File

@@ -1418,6 +1418,8 @@ terracotta.easytier=About EasyTier
terracotta.terracotta=Terracotta | Multiplayer terracotta.terracotta=Terracotta | Multiplayer
terracotta.status=Lobby terracotta.status=Lobby
terracotta.back=Exit terracotta.back=Exit
terracotta.feedback.title=Fill Out Feedback Form
terracotta.feedback.desc=As HMCL updates Multiplayer Core, we hope you can take 10 seconds to fill out the feedback form.
terracotta.sudo_installing=HMCL must verify your password before installing Multiplayer Core terracotta.sudo_installing=HMCL must verify your password before installing Multiplayer Core
terracotta.from_local.title=Third-party download channels for Multiplayer Core terracotta.from_local.title=Third-party download channels for Multiplayer Core
terracotta.from_local.desc=In some areas, the built-in default download channel may be unstable. terracotta.from_local.desc=In some areas, the built-in default download channel may be unstable.

View File

@@ -1206,6 +1206,8 @@ terracotta.easytier=關於 EasyTier
terracotta.terracotta=Terracotta | 陶瓦聯機 terracotta.terracotta=Terracotta | 陶瓦聯機
terracotta.status=聯機大廳 terracotta.status=聯機大廳
terracotta.back=退出 terracotta.back=退出
terracotta.feedback.title=填寫回饋表
terracotta.feedback.desc=在 HMCL 更新聯機核心時,我們歡迎您用 10 秒時間填寫聯機品質回饋收集表。
terracotta.sudo_installing=HMCL 需要驗證您的密碼才能安裝線上核心 terracotta.sudo_installing=HMCL 需要驗證您的密碼才能安裝線上核心
terracotta.from_local.title=線上核心第三方下載管道 terracotta.from_local.title=線上核心第三方下載管道
terracotta.from_local.desc=在部分地區,內建的預設下載管道可能不穩定或連線緩慢 terracotta.from_local.desc=在部分地區,內建的預設下載管道可能不穩定或連線緩慢

View File

@@ -1216,6 +1216,8 @@ terracotta.easytier=关于 EasyTier
terracotta.terracotta=Terracotta | 陶瓦联机 terracotta.terracotta=Terracotta | 陶瓦联机
terracotta.status=联机大厅 terracotta.status=联机大厅
terracotta.back=退出 terracotta.back=退出
terracotta.feedback.title=填写反馈表
terracotta.feedback.desc=在 HMCL 更新联机核心时,我们欢迎您用 10 秒时间填写联机质量反馈收集表。
terracotta.sudo_installing=HMCL 需要验证您的密码才能安装联机核心 terracotta.sudo_installing=HMCL 需要验证您的密码才能安装联机核心
terracotta.from_local.title=联机核心第三方下载渠道 terracotta.from_local.title=联机核心第三方下载渠道
terracotta.from_local.desc=在部分地区HMCL 内置的默认下载渠道可能不稳定或连接缓慢 terracotta.from_local.desc=在部分地区HMCL 内置的默认下载渠道可能不稳定或连接缓慢

View File

@@ -4,6 +4,7 @@
"0.3.9-rc.10" "0.3.9-rc.10"
], ],
"version_latest": "0.3.10", "version_latest": "0.3.10",
"feedback_url": "https://f.kdocs.cn/ksform/w/write/njMwdtgD?channel=n4awqa",
"classifiers": { "classifiers": {
"linux-arm64": "sha256:001b6b1e220e98dffd84198a3e16855644cad27900562c78d610b0bf50138d17", "linux-arm64": "sha256:001b6b1e220e98dffd84198a3e16855644cad27900562c78d610b0bf50138d17",
"linux-x86_64": "sha256:b133ddb796ff52879fb0c38e68ef7ea968d3eaec77f27ea274c701888e795782", "linux-x86_64": "sha256:b133ddb796ff52879fb0c38e68ef7ea968d3eaec77f27ea274c701888e795782",