Skip to content

Commit f7e4cc7

Browse files
authored
fix: upgrading/switching to release considers stable first (#241)
1 parent 1a21bc0 commit f7e4cc7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/config/about.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ struct AboutView: View {
5757
@State private var removeUserData = false
5858
@State private var uninstalling = false
5959
@State private var uninstallFailed = false
60+
// The value is based on check update, and is only used for upgrading to release.
61+
// If upgrading/switching to debug, always use latest regardless of this value.
6062
@State private var targetTag: String? = nil
63+
// If current version is latest, this is still true (for build type switch).
6164
@State private var latestAvailable = false
6265

6366
var body: some View {
@@ -169,7 +172,13 @@ struct AboutView: View {
169172
} label: {
170173
Text("Switch to Release")
171174
}.disabled(
172-
!latestAvailable || viewModel.state == .downloading || viewModel.state == .installing
175+
(!latestAvailable
176+
&& targetTag
177+
== nil // We should always allow debug build to switch to release build,
178+
// so we drop OS version support only immediately after a new tag release.
179+
// Plus we don't provide debug build for tag release, this condition shouldn't be true.
180+
)
181+
|| viewModel.state == .downloading || viewModel.state == .installing
173182
)
174183
} else {
175184
Button {
@@ -333,7 +342,8 @@ struct AboutView: View {
333342
}
334343

335344
func update(debug: Bool) {
336-
guard let tag = latestAvailable ? "latest" : targetTag else {
345+
// See comment of targetTag.
346+
guard let tag = debug && latestAvailable ? "latest" : targetTag else {
337347
FCITX_ERROR("Calling update with nil tag")
338348
return
339349
}

0 commit comments

Comments
 (0)