知了 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
feat(ios): pause and continue listening from the bar, and collapse the live view to browse meetings while it keeps listening
wqugurube9785d562df
diff --git a/ios/Sources/Cicada/CicadaApp.swift b/ios/Sources/Cicada/CicadaApp.swiftindex 03add3c..b537692 100644--- a/ios/Sources/Cicada/CicadaApp.swift+++ b/ios/Sources/Cicada/CicadaApp.swift@@ -190,6 +190,8 @@ final class AppModel: ObservableObject {var endTimesOverride: (Double, Double)?/// 正在听's 字幕 / 纪要 switch, so a debug command can flip it.@Published var livePage: LivePage = .subtitles+ /// 收起 on the iPhone's 正在听: the meetings again while listening goes on; the bar brings it back.+ @Published var liveHidden = false/// The record page's picked speaker (scheme A: only they are drawn in ink).@Published var focusSpeaker: Int?@Published var tab: AppTab = .records@@ -257,6 +259,7 @@ final class AppModel: ObservableObject {func startListening() {guard !room.isRunning else { return }selection = nil+ liveHidden = falsesearchPath = []tab = .records// 纪要 first, as the Mac's notes window; without a key there are none, so 字幕.diff --git a/ios/Sources/Cicada/Debug.swift b/ios/Sources/Cicada/Debug.swiftindex 1bcdcd0..d28b43f 100644--- a/ios/Sources/Cicada/Debug.swift+++ b/ios/Sources/Cicada/Debug.swift@@ -63,6 +63,12 @@ extension AppModel {debugLog("window: \(arg) \(devWindow.map { "\($0)" } ?? "screen")")case "stop":stopListening()+ case "pause":+ // pause:on|off, the bar's 暂停 / 继续+ room.setPaused(arg != "off")+ case "liveHidden":+ // liveHidden:on|off, 正在听's 收起 / tapping the bar+ liveHidden = arg != "off"case "welcome":// welcome:<0|1|2> opens 第一次打开 at that step; welcome:done closes it as 开始用知了 doesif arg == "done" { finishWelcome() } else { welcomeStep = Int(arg) ?? 0; showWelcome = true }diff --git a/ios/Sources/Cicada/LiveViews.swift b/ios/Sources/Cicada/LiveViews.swiftindex 0969353..1cd5e10 100644--- a/ios/Sources/Cicada/LiveViews.swift+++ b/ios/Sources/Cicada/LiveViews.swift@@ -11,6 +11,8 @@ struct HomeTitle: View {var logo: CGFloat = 52var titleSize: CGFloat = 28var trailing: AnyView? = nil+ /// What stands at the right while listening (the iPhone's 收起).+ var liveTrailing: AnyView? = nilvar body: some View {HStack(spacing: 12) {@@ -19,14 +21,16 @@ struct HomeTitle: View {if room.isRunning {TimelineView(.periodic(from: .now, by: 1)) { _ inHStack(spacing: 6) {- LiveDot()- Text(L("正在听 · \(TranscriptExport.clock(room.elapsed))"))+ if room.paused { Circle().fill(Ink.secondary).frame(width: 8, height: 8) } else { LiveDot() }+ Text(room.paused ? L("已暂停") : L("正在听 · \(TranscriptExport.clock(room.elapsed))"))}.font(.footnote.weight(.semibold).monospacedDigit())- .foregroundStyle(Ink.accentText)+ .foregroundStyle(room.paused ? Ink.secondary : Ink.accentText)}let pair = Pref.pairText(room.languagePair.source, room.languagePair.target)- Text(room.speakerMode ? L("外放 · \(pair)") : L("会议室 · \(pair)"))+ // Same language both sides (Chinese heard, Chinese shown): no pair to name.+ Text(pair.isEmpty ? (room.speakerMode ? L("外放") : L("会议室"))+ : (room.speakerMode ? L("外放 · \(pair)") : L("会议室 · \(pair)"))).font(.system(size: titleSize - 4, weight: .bold)).foregroundStyle(Ink.ink).lineLimit(1).minimumScaleFactor(0.7)} else {@@ -38,6 +42,7 @@ struct HomeTitle: View {}Spacer(minLength: 0)if let trailing, !room.isRunning { trailing }+ if let liveTrailing, room.isRunning { liveTrailing }}.padding(.horizontal, 4)}@@ -125,11 +130,32 @@ struct ListenBar: View {private var live: some View {Group {- Wave(level: room.level).padding(.leading, 16)- let people = room.speakerCount- Text(people >= 2 ? L("\(people) 人在说") : (room.status.isEmpty ? L("正在听") : room.status))- .font(.subheadline).foregroundStyle(Ink.secondary).lineLimit(1)- .frame(maxWidth: .infinity, alignment: .leading)+ // 收起 left the meetings on screen: the wave and who is talking bring 正在听 back.+ Button { model.liveHidden = false } label: {+ HStack(spacing: 10) {+ Wave(level: room.level)+ let people = room.speakerCount+ Text(people >= 2 ? L("\(people) 人在说") : (room.status.isEmpty ? L("正在听") : room.status))+ .font(.subheadline).foregroundStyle(Ink.secondary).lineLimit(1)+ if model.liveHidden {+ Image(systemName: "chevron.up").font(.footnote.weight(.semibold)).foregroundStyle(Ink.secondary)+ }+ }+ .padding(.leading, 16)+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)+ .contentShape(Rectangle())+ }+ .buttonStyle(.plain)+ .disabled(!model.liveHidden)+ Button { room.setPaused(!room.paused) } label: {+ Image(systemName: room.paused ? "play.fill" : "pause.fill")+ .font(.system(size: 16, weight: .bold))+ .foregroundStyle(Ink.ink)+ .frame(width: 46, height: 46)+ .background(Ink.ground, in: Circle())+ }+ .buttonStyle(.plain)+ .accessibilityLabel(room.paused ? Text("继续") : Text("暂停"))Button { model.stopListening() } label: {Text("结束").font(.headline).foregroundStyle(.white).padding(.horizontal, 20).frame(height: 46)@@ -177,7 +203,10 @@ struct LivePhone: View {var body: some View {VStack(alignment: .leading, spacing: 0) {VStack(alignment: .leading, spacing: 16) {- HomeTitle()+ HomeTitle(liveTrailing: AnyView(+ Button { model.liveHidden = true } label: { GlassIcon(systemName: "chevron.down") }+ .buttonStyle(.plain)+ .accessibilityLabel(Text("收起"))))ListenBar()PillSwitch(selection: $model.livePage, options: [(.notes, notesTitle), (.subtitles, "字幕")])EndingStrip()diff --git a/ios/Sources/Cicada/RecordsView.swift b/ios/Sources/Cicada/RecordsView.swiftindex a35dcc3..10dc701 100644--- a/ios/Sources/Cicada/RecordsView.swift+++ b/ios/Sources/Cicada/RecordsView.swift@@ -9,7 +9,7 @@ struct RecordsSplit: View {@ObservedObject var store: SessionStorevar body: some View {- if room.isRunning {+ if room.isRunning && !model.liveHidden {LivePhone()} else {recordsdiff --git a/ios/Sources/Cicada/RootView.swift b/ios/Sources/Cicada/RootView.swiftindex 199da4b..ce4b517 100644--- a/ios/Sources/Cicada/RootView.swift+++ b/ios/Sources/Cicada/RootView.swift@@ -57,7 +57,7 @@ struct PhoneRoot: View {private var barShown: Bool {switch model.tab {- case .records: model.selection == nil && !model.room.isRunning+ case .records: model.selection == nil && (!model.room.isRunning || model.liveHidden)case .settings: truecase .search: model.searchPath.isEmpty}