-
Notifications
You must be signed in to change notification settings - Fork 861
feat: 修改主页下载稳定版功能为在应用内更新 #5957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: 修改主页下载稳定版功能为在应用内更新 #5957
Changes from all commits
8aa165a
cf211fa
91e92d7
d01199b
8e33bc7
214bea6
d4810d1
b3265fd
b07de03
6e80372
3ea88fa
6c8bfbf
30a8eef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import javafx.animation.KeyValue; | ||
| import javafx.animation.Timeline; | ||
| import javafx.beans.property.*; | ||
| import javafx.beans.value.ChangeListener; | ||
| import javafx.collections.FXCollections; | ||
| import javafx.collections.ObservableList; | ||
| import javafx.event.EventHandler; | ||
|
|
@@ -63,6 +64,7 @@ | |
| import org.jackhuang.hmcl.ui.versions.GameListPopupMenu; | ||
| import org.jackhuang.hmcl.ui.versions.Versions; | ||
| import org.jackhuang.hmcl.upgrade.RemoteVersion; | ||
| import org.jackhuang.hmcl.upgrade.UpdateChannel; | ||
| import org.jackhuang.hmcl.upgrade.UpdateChecker; | ||
| import org.jackhuang.hmcl.upgrade.UpdateHandler; | ||
| import org.jackhuang.hmcl.util.*; | ||
|
|
@@ -368,6 +370,23 @@ private void closeUpdateBubble() { | |
| showUpdate.set(false); | ||
| } | ||
|
|
||
| public void onSwitchToStableChannel() { | ||
| Controllers.confirm(i18n("update.switch_to_stable.confirm"), i18n("update.switch_to_stable.title"), () -> { | ||
| UpdateChecker.requestCheckUpdate(UpdateChannel.STABLE, config().acceptPreviewUpdateProperty().get()); | ||
| Holder<ChangeListener<Boolean>> holder = new Holder<>(); | ||
| holder.value = (observable, old, now) -> { | ||
| if (!now) { | ||
| UpdateChecker.checkingUpdateProperty().removeListener(holder.value); | ||
| RemoteVersion target = UpdateChecker.getLatestVersion(); | ||
| if (target != null) { | ||
| UpdateHandler.updateFrom(target); | ||
|
Comment on lines
+380
to
+382
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This callback upgrades from Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
| }; | ||
| UpdateChecker.checkingUpdateProperty().addListener(holder.value); | ||
| }, null); | ||
| } | ||
|
|
||
| @Override | ||
| public ReadOnlyObjectWrapper<State> stateProperty() { | ||
| return state; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new “switch to stable” flow passes
acceptPreviewUpdateintorequestCheckUpdate, so users who enabled preview updates will querystable-previewrather than stable. That conflicts with the UI text promising installation of the latest stable version and can keep users on pre-release builds after choosing this action.Useful? React with 👍 / 👎.