@@ -58,6 +58,7 @@ struct AboutView: View {
5858 @State private var uninstalling = false
5959 @State private var uninstallFailed = false
6060 @State private var targetTag : String ? = nil
61+ @State private var latestAvailable = false
6162
6263 var body : some View {
6364 VStack {
@@ -168,15 +169,15 @@ struct AboutView: View {
168169 } label: {
169170 Text ( " Switch to Release " )
170171 } . disabled (
171- targetTag == nil || viewModel. state == . downloading || viewModel. state == . installing
172+ !latestAvailable || viewModel. state == . downloading || viewModel. state == . installing
172173 )
173174 } else {
174175 Button {
175176 showSwitchToDebug = true
176177 } label: {
177178 Text ( " Switch to Debug " )
178179 } . disabled (
179- targetTag != " latest " || viewModel. state == . downloading
180+ !latestAvailable || viewModel. state == . downloading
180181 || viewModel. state == . installing
181182 ) . sheet (
182183 isPresented: $showSwitchToDebug
@@ -305,6 +306,7 @@ struct AboutView: View {
305306 viewModel. state = . checking
306307 checkMainUpdate { success, latestCompatible, latest, stable in
307308 if success {
309+ latestAvailable = latestCompatible
308310 if let stable = stable {
309311 // latest >= stable > current
310312 targetTag = stable. tag
@@ -331,7 +333,7 @@ struct AboutView: View {
331333 }
332334
333335 func update( debug: Bool ) {
334- guard let tag = targetTag else {
336+ guard let tag = latestAvailable ? " latest " : targetTag else {
335337 FCITX_ERROR ( " Calling update with nil tag " )
336338 return
337339 }
0 commit comments