Skip to content

[Enhancement] 不在主界面,或者已显示对话框的情况下,暂时不弹出启动器更新对话框#5768

Open
Calboot wants to merge 9 commits intoHMCL-dev:mainfrom
Calboot:update-dialog
Open

[Enhancement] 不在主界面,或者已显示对话框的情况下,暂时不弹出启动器更新对话框#5768
Calboot wants to merge 9 commits intoHMCL-dev:mainfrom
Calboot:update-dialog

Conversation

@Calboot
Copy link
Copy Markdown
Contributor

@Calboot Calboot commented Mar 11, 2026

Closes #5762
Fixes #5490

如果不在主界面,则会在切换回主界面之后再显示;如果已经有对话框,则在对话框关闭后再显示

@Calboot
Copy link
Copy Markdown
Contributor Author

Calboot commented Mar 11, 2026

没测试过,因为太菜了不会在开发环境搞版本更新 : (

俺寻思能跑

12th Mar. 2026 更新:测试过了,应该没啥问题

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 4, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 5, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +137 to +150
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);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants