Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 在启动器检测到“运行目录/配置目录位于临时位置(可能导致退出后数据丢失)”时,引入带倒计时的确认对话框,降低用户误点确认后丢实例/数据的概率。
Changes:
- 新增
showAlertWithCountdown(...):在对话框中禁用确认按钮并显示倒计时文案,到时后才允许确认。 - macOS App Translocation 场景改为使用倒计时确认对话框。
- 配置目录位于临时目录的告警改为使用倒计时确认对话框。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| && ConfigHolder.isNewlyCreated() | ||
| && System.getProperty("user.dir").startsWith("/private/var/folders/")) { | ||
| if (showAlert(AlertType.WARNING, i18n("fatal.mac_app_translocation"), ButtonType.YES, ButtonType.NO) == ButtonType.NO) | ||
| if (showAlertWithCountdown(AlertType.WARNING, i18n("fatal.mac_app_translocation"), 5, ButtonType.YES, ButtonType.NO) == ButtonType.NO) |
| private static void checkConfigInTempDir() { | ||
| if (ConfigHolder.isNewlyCreated() && isConfigInTempDir() | ||
| && showAlert(AlertType.WARNING, i18n("fatal.config_in_temp_dir"), ButtonType.YES, ButtonType.NO) == ButtonType.NO) { | ||
| && showAlertWithCountdown(AlertType.WARNING, i18n("fatal.config_in_temp_dir"), 5, ButtonType.YES, ButtonType.NO) == ButtonType.NO) { |
| alert.setOnShown(e -> timeline.play()); | ||
| alert.setOnCloseRequest(e -> timeline.stop()); | ||
|
|
||
| return alert.showAndWait().orElse(null); |
Comment on lines
+189
to
+200
| Button okButton = (Button) alert.getDialogPane().lookupButton(ButtonType.YES); | ||
|
|
||
| okButton.setDisable(true); | ||
|
|
||
| KeyFrame[] keyFrames = new KeyFrame[seconds + 1]; | ||
| for (int i = 0; i < seconds; i++) { | ||
| keyFrames[i] = new KeyFrame(Duration.seconds(i), | ||
| new KeyValue(okButton.textProperty(), i18n("button.ok.countdown", seconds - i))); | ||
| } | ||
| keyFrames[seconds] = new KeyFrame(Duration.seconds(seconds), | ||
| new KeyValue(okButton.textProperty(), i18n("button.ok")), | ||
| new KeyValue(okButton.disableProperty(), false)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
被 macOS 隔离或者在压缩包中运行(临时目录)都会导致游戏数据在启动器退出后丢失,但观察到用户群很多人看都不看直接点确认回头问自己实例怎么没了