Skip to content

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

Open
CalbootOnceMore wants to merge 14 commits intoHMCL-dev:mainfrom
CalbootOnceMore:update-dialog
Open

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

Conversation

@CalbootOnceMore
Copy link
Copy Markdown
Contributor

#5768 由于原账号被封,无法推进,现重新打开一个新pr。原pr应该 Close as not planned

Closes #5762
Fixes #5490

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines the launcher update notification UX so the update dialog won’t interrupt users while they’re not on the main page, and will wait until any currently-open dialog is closed—addressing dialog-overlapping issues like #5762 and state issues like #5490.

Changes:

  • Add a “show dialog later” mechanism to queue dialogs behind an active dialog stack.
  • Split update bubble animation from update dialog display, and gate dialog display on being at the root (non-backable) UI state.
  • Adjust update-check completion ordering to better coordinate checkingUpdate vs. latestVersion updates.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java Tweaks update-check completion sequencing to update latestVersion before clearing checkingUpdate.
HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java Moves update bubble binding responsibility out of RootPage (now done during controller initialization).
HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java Introduces a separate showUpdateDialog property and dialog display logic using the new deferred-dialog API.
HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorController.java Exposes navigation “backable” state and adds showDialogLater delegation.
HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogUtils.java Adds dialog queuing (showLater) and runs queued dialogs after closing the active dialog.
HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java Binds update bubble + dialog gating centrally and adds Controllers.dialogLater(...).
Comments suppressed due to low confidence (2)

HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogUtils.java:169

  • JFXDialog.close() is asynchronous, but DialogUtils.close triggers the next queued dialog immediately after calling close() (see showNextDialogAction.run() later in this method). This can result in the next dialog being shown while the previous one is still closing/visible. Consider invoking the queued action from the setOnDialogClosed(...) callback (after the close animation and cleanup complete).
        if (dialog != null && pane != null) {
            if (pane.size() == 1 && pane.peek().orElse(null) == content) {
                dialog.setOnDialogClosed(e -> pane.pop(content));
                dialog.close();

HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java:293

  • The dialog’s cancel button is added with addCancel(null), so dismissing the update prompt does not set config().setPromptedVersion(...). Since showUpdateDialog gates on config().getPromptedVersion(), users who dismiss the dialog may be prompted again for the same version on later checks/runs. If the intent is “don’t show again for this version”, set promptedVersion on cancel as well; otherwise consider using a different button text than “Cancel” to clarify it will reappear.
                    .addAction(i18n("button.view"), () -> {
                        config().setPromptedVersion(getLatestVersion().getVersion());
                        onUpgrade();
                    })
                    .addCancel(null)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogUtils.java Outdated
CalbootOnceMore and others added 3 commits April 30, 2026 21:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
# Conflicts:
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants