知了 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): notes come first, on the left of subtitles, while listening and in meeting records
wquguru12a16b2a6983
diff --git a/ios/Sources/Cicada/CicadaApp.swift b/ios/Sources/Cicada/CicadaApp.swiftindex c81b663..9bbafca 100644--- a/ios/Sources/Cicada/CicadaApp.swift+++ b/ios/Sources/Cicada/CicadaApp.swift@@ -148,9 +148,9 @@ final class AppModel: ObservableObject {/// The record page's picked speaker (scheme A: only they are drawn in ink).@Published var focusSpeaker: Int?@Published var tab: AppTab = .records- @Published var selection: String?+ @Published var selection: String? { didSet { if selection != oldValue { recordPage = firstPage(selection) } } }/// A meeting opened from 搜索 (iPhone).- @Published var searchPath: [String] = []+ @Published var searchPath: [String] = [] { didSet { if searchPath.last != oldValue.last { recordPage = firstPage(searchPath.last) } } }/// The record page's 文字记录 / 纪要 switch, kept here so a debug command can flip it.@Published var recordPage: RecordPage = .transcript@Published var query = ""@@ -206,6 +206,8 @@ final class AppModel: ObservableObject {selection = nilsearchPath = []tab = .records+ // 纪要 first, as the Mac's notes window; without a key there are none, so 字幕.+ livePage = ling.hasKey ? .notes : .subtitlesfixes.meetingStarted()room.start(source: Pref.sourceLang.locale, target: Pref.target(for: Pref.sourceLang.code), voices: UserDefaults.standard.bool(forKey: Pref.voices),speaker: Pref.speakerMode)@@ -257,6 +259,11 @@ final class AppModel: ObservableObject {}}+ /// 纪要 first, as on the Mac; a meeting without notes opens on its 文字记录.+ private func firstPage(_ id: String?) -> RecordPage {+ store.session(id)?.notes == nil ? .transcript : .notes+ }+/// Full notes for a stored meeting, as the Mac's 生成纪要.func generateNotes(_ id: String) {guard ling.hasKey else { return }diff --git a/ios/Sources/Cicada/LiveViews.swift b/ios/Sources/Cicada/LiveViews.swiftindex 066cc2f..538d8a4 100644--- a/ios/Sources/Cicada/LiveViews.swift+++ b/ios/Sources/Cicada/LiveViews.swift@@ -172,23 +172,24 @@ struct LivePhone: View {@EnvironmentObject var model: AppModel@EnvironmentObject var room: RoomListen@EnvironmentObject var notes: NotesEngine- @State private var page: LivePage = .subtitlesvar body: some View {VStack(alignment: .leading, spacing: 0) {VStack(alignment: .leading, spacing: 16) {HomeTitle()ListenBar()- PillSwitch(selection: $page, options: [(.subtitles, "字幕"), (.notes, notesTitle)])+ PillSwitch(selection: $model.livePage, options: [(.notes, notesTitle), (.subtitles, "字幕")])+ EndingStrip()TranslateDownCard()if let id = room.sessionID { FixAskCard(fixes: model.fixes, session: id) }}.padding(.horizontal, 16).padding(.top, 6)- switch page {+ switch model.livePage {case .subtitles: LiveLines().padding(.top, 12)case .notes:ScrollView { NotesPage(notes: notes.notes).padding(20) }+ .safeAreaInset(edge: .bottom) { SayingNow().padding(.horizontal, 16).padding(.bottom, 8) }}}.background(alignment: .topLeading) { PiPHost(pip: model.pip).frame(width: 4, height: 4) }@@ -196,7 +197,7 @@ struct LivePhone: View {.overlay(alignment: .bottom) { FixToast(fixes: model.fixes).padding(.horizontal, 16).padding(.bottom, 8) }.animation(.snappy(duration: 0.2), value: model.fixes.toast).animation(.snappy(duration: 0.2), value: model.translationDown)- .onChange(of: model.livePage) { page = model.livePage }+ .animation(.snappy(duration: 0.2), value: model.ending)}private var notesTitle: LocalizedStringKey {@@ -206,6 +207,37 @@ struct LivePhone: View {enum LivePage: String { case subtitles, notes }+/// Under 纪要: what is being said now (else the newest line), so the notes page still shows the+/// room live; a tap goes to 字幕.+struct SayingNow: View {+ @EnvironmentObject var model: AppModel+ @EnvironmentObject var room: RoomListen++ var body: some View {+ let live = !room.draft.isEmpty+ let last = room.lines.last+ if live || last != nil {+ Button { withAnimation(.snappy(duration: 0.2)) { model.livePage = .subtitles } } label: {+ VStack(alignment: .leading, spacing: 4) {+ HStack {+ Text(live ? L("正在说") : L("刚才")).font(.caption.weight(.semibold)).foregroundStyle(live ? Ink.accentText : Ink.secondary)+ Spacer()+ Text("点开看字幕").font(.caption).foregroundStyle(Ink.secondary)+ }+ Text(verbatim: live ? room.draft : last?.src ?? "").font(.footnote).foregroundStyle(Ink.secondary).lineLimit(1)+ let dst = live ? room.draftTranslation : last?.dst ?? ""+ if !dst.isEmpty { Text(verbatim: dst).font(.callout).foregroundStyle(Ink.ink).lineLimit(2) }+ }+ .padding(.horizontal, 16).padding(.vertical, 12)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(Color.white, in: RoundedRectangle(cornerRadius: 20, style: .continuous))+ .overlay { RoundedRectangle(cornerRadius: 20, style: .continuous).strokeBorder(Ink.accent.opacity(live ? 0.35 : 0), lineWidth: 1.5) }+ }+ .buttonStyle(.plain)+ }+ }+}+/// 连不上翻译: why the subtitles are only the original. Without a key, the key is the fix (Ling/// needs no proxy in mainland China), so the card opens 设置; with one, it comes back by itself.struct TranslateDownCard: View {@@ -293,7 +325,6 @@ struct LivePad: View {@EnvironmentObject var model: AppModel@EnvironmentObject var room: RoomListen@EnvironmentObject var notes: NotesEngine- @State private var page: LivePage = .subtitlesvar body: some View {VStack(spacing: 0) {@@ -303,21 +334,22 @@ struct LivePad: View {}GeometryReader { g inif g.size.width >= 820 {+ // 纪要 on the left and wider, 字幕 beside it, as the Mac's notes window reads.HStack(alignment: .top, spacing: 22) {- column("字幕") { LiveLines().padding(.horizontal, -16) }column(notesTitle) {ScrollView {NotesPage(notes: notes.notes).padding(20).background(Color.white, in: RoundedRectangle(cornerRadius: 22, style: .continuous))}}- .frame(width: g.size.width * 0.42)+ column("字幕") { LiveLines().padding(.horizontal, -16) }+ .frame(width: g.size.width * 0.42)}.padding(.horizontal, 20).padding(.top, 18)} else {VStack(alignment: .leading, spacing: 12) {- PillSwitch(selection: $page, options: [(.subtitles, "字幕"), (.notes, notesTitle)]).frame(maxWidth: 320)- if page == .subtitles { LiveLines().padding(.horizontal, -16) } else {+ PillSwitch(selection: $model.livePage, options: [(.notes, notesTitle), (.subtitles, "字幕")]).frame(maxWidth: 320)+ if model.livePage == .subtitles { LiveLines().padding(.horizontal, -16) } else {ScrollView { NotesPage(notes: notes.notes).padding(20).background(Color.white, in: RoundedRectangle(cornerRadius: 22)) }}}@@ -330,7 +362,6 @@ struct LivePad: View {.overlay(alignment: .bottom) { FixToast(fixes: model.fixes).frame(maxWidth: 560).padding(.horizontal, 20).padding(.bottom, 12) }.animation(.snappy(duration: 0.2), value: model.fixes.toast).animation(.snappy(duration: 0.2), value: model.fixes.asking(in: room.sessionID ?? "")?.fix)- .onChange(of: model.livePage) { page = model.livePage }}private var notesTitle: LocalizedStringKey {diff --git a/ios/Sources/Cicada/RecordView.swift b/ios/Sources/Cicada/RecordView.swiftindex 5808167..431d536 100644--- a/ios/Sources/Cicada/RecordView.swift+++ b/ios/Sources/Cicada/RecordView.swift@@ -53,7 +53,7 @@ struct RecordView: View {.font(.footnote).foregroundStyle(Ink.secondary).padding(.top, 6)}PillSwitch(selection: $model.recordPage,- options: [(.transcript, "文字记录"), (.notes, "纪要")])+ options: [(.notes, "纪要"), (.transcript, "文字记录")]).padding(.top, 16)switch model.recordPage {