知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
fix(ios): AI service and key pages check the key again when opened after a failure, with a Check again button and pull to refresh
wquguru55a395d28605
diff --git a/ios/Sources/Cicada/AIServicePage.swift b/ios/Sources/Cicada/AIServicePage.swiftindex f5f1a57..1730d3a 100644--- a/ios/Sources/Cicada/AIServicePage.swift+++ b/ios/Sources/Cicada/AIServicePage.swift@@ -138,6 +138,8 @@ struct AIServicePage: View {}.background(Ink.ground).navigationTitle(Text("AI 服务"))+ .onAppear { ling.recheckIfFailed() }+ .refreshable { await ling.check() }.navigationBarTitleDisplayMode(.inline)}@@ -194,6 +196,17 @@ struct AIServicePage: View {}}+extension LingClient {+ /// Opening AI 服务 after a failed check asks again: what was wrong may have been fixed on the+ /// service's side (a key's model list, its credit) without anything changing here.+ func recheckIfFailed() {+ switch keyState {+ case .invalid, .unreachable, .unchecked: Task { await check() }+ default: break+ }+ }+}+extension AppModel {/// The service, its address or a model changed: LingClient checks again and 面对面 takes the/// service's voices.diff --git a/ios/Sources/Cicada/SettingsView.swift b/ios/Sources/Cicada/SettingsView.swiftindex c22f743..c70e1d2 100644--- a/ios/Sources/Cicada/SettingsView.swift+++ b/ios/Sources/Cicada/SettingsView.swift@@ -313,7 +313,9 @@ struct KeyPage: View {}if ling.key != nil && !editing {HStack {- if case .unreachable = ling.keyState { Button("重试") { Task { await ling.check() } } }+ // Any state: a key fixed on the service's side (its model list, its credit) is checked again here.+ Button("重新检查") { Task { await ling.check() } }+ .disabled(ling.keyState == .checking)Spacer()Button("移除", role: .destructive) { ling.removeKey() }}@@ -327,6 +329,7 @@ struct KeyPage: View {}.background(Ink.ground).navigationTitle(Text(verbatim: ling.provider.id == .custom ? "Key" : "\(ling.provider.name) key"))+ .onAppear { ling.recheckIfFailed() }.navigationBarTitleDisplayMode(.inline)}