[Enhancement] 不在主界面,或者已显示对话框的情况下,暂时不弹出启动器更新对话框#5768
[Enhancement] 不在主界面,或者已显示对话框的情况下,暂时不弹出启动器更新对话框#5768Calboot wants to merge 9 commits intoHMCL-dev:mainfrom
Conversation
|
没测试过,因为太菜了不会在开发环境搞版本更新 : (
12th Mar. 2026 更新:测试过了,应该没啥问题 |
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc30519074
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a dialog queuing system to prevent overlapping UI elements, specifically for update notifications. It adds showLater functionality to DialogUtils and DecoratorController, allowing dialogs to be displayed sequentially. In MainPage, the update dialog logic was refactored to use this new system and bound to application state in Controllers. Feedback was provided regarding the use of identity comparison for RemoteVersion objects, suggesting Objects.equals() to ensure consistent behavior when checking for previously shown versions.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a dialog queuing mechanism to ensure that multiple dialogs are displayed sequentially rather than overlapping. It refactors the update notification logic in the main page to use this new 'show later' functionality and binds the update dialog's visibility to the application's navigation state. A review comment suggests adding a null check for the dialog action in DialogUtils to prevent potential null pointer exceptions.
| public static void showLater(StackPane container, Runnable showDialogAction) { | ||
| FXUtils.checkFxUserThread(); | ||
|
|
||
| if (container.getProperties().get(PROPERTY_DIALOG_INSTANCE) == null) { | ||
| showDialogAction.run(); | ||
| return; | ||
| } | ||
| Queue<Runnable> queue = (Queue<Runnable>) container.getProperties().get(PROPERTY_DIALOG_SHOW_LATER); | ||
| if (queue == null) { | ||
| queue = new LinkedList<>(); | ||
| container.getProperties().put(PROPERTY_DIALOG_SHOW_LATER, queue); | ||
| } | ||
| queue.add(showDialogAction); | ||
| } |
There was a problem hiding this comment.
It is recommended to add a null check for showDialogAction before adding it to the queue to prevent potential NullPointerException when the action is eventually executed.
| public static void showLater(StackPane container, Runnable showDialogAction) { | |
| FXUtils.checkFxUserThread(); | |
| if (container.getProperties().get(PROPERTY_DIALOG_INSTANCE) == null) { | |
| showDialogAction.run(); | |
| return; | |
| } | |
| Queue<Runnable> queue = (Queue<Runnable>) container.getProperties().get(PROPERTY_DIALOG_SHOW_LATER); | |
| if (queue == null) { | |
| queue = new LinkedList<>(); | |
| container.getProperties().put(PROPERTY_DIALOG_SHOW_LATER, queue); | |
| } | |
| queue.add(showDialogAction); | |
| } | |
| @SuppressWarnings("unchecked") | |
| public static void showLater(StackPane container, Runnable showDialogAction) { | |
| FXUtils.checkFxUserThread(); | |
| if (showDialogAction == null) return; | |
| if (container.getProperties().get(PROPERTY_DIALOG_INSTANCE) == null) { | |
| showDialogAction.run(); | |
| return; | |
| } | |
| Queue<Runnable> queue = (Queue<Runnable>) container.getProperties().get(PROPERTY_DIALOG_SHOW_LATER); | |
| if (queue == null) { | |
| queue = new LinkedList<>(); | |
| container.getProperties().put(PROPERTY_DIALOG_SHOW_LATER, queue); | |
| } | |
| queue.add(showDialogAction); | |
| } |
Closes #5762
Fixes #5490
如果不在主界面,则会在切换回主界面之后再显示;如果已经有对话框,则在对话框关闭后再显示