Branchwell

Jotley / app · jotley.ai / macOS / Views / SettingsView+GeneralTab.swift

Raw 10.0 KB on c22c50f3614b055549c1ecbf54af0165e0bc8df1
1import SwiftUI
2import AppKit
3
4extension SettingsView {
5 var generalView: some View {
6 ScrollView {
7 VStack(alignment: .leading, spacing: 24) {
8 VStack(alignment: .leading, spacing: 28) {
9 Text("General")
10 .font(.title2)
11 .fontWeight(.semibold)
12
13 VStack(alignment: .leading, spacing: 16) {
14 Text("Appearance")
15 .font(.headline)
16
17 VStack(alignment: .leading, spacing: 12) {
18 HStack {
19 Text("Appearance Mode")
20 .frame(width: 120, alignment: .leading)
21
22 Picker("", selection: $themeManager.currentAppearanceMode) {
23 Text("Light").tag(AppearanceMode.light)
24 Text("Dark").tag(AppearanceMode.dark)
25 Text("System").tag(AppearanceMode.system)
26 }
27 .pickerStyle(.segmented)
28 .frame(width: 200)
29 .tint(.themePrimaryAccent)
30 }
31
32 SettingsDropdown(title: "Theme Color", selection: $themeManager.currentThemeColor,
33 options: ThemeColor.allCases, optionTitle: { $0.displayName },
34 swatch: { $0.color(in: themeManager.effectiveColorScheme ?? colorScheme) })
35 .accessibilityIdentifier("settingsThemePicker")
36 }
37 }
38
39 VStack(alignment: .leading, spacing: 12) {
40 Text("Summaries").font(.headline)
41 SettingsDropdown(title: "Summary Style", selection: $summaryDisplayStyle,
42 options: SummaryDisplayStyle.allCases, optionTitle: { $0.title })
43 .accessibilityIdentifier("summaryDisplayStylePicker")
44 Text("Cards adds visual sections. Standard Text uses clean headings and bullets. Your choice applies to every note and can also be changed from a note’s More menu.")
45 .font(.caption).foregroundStyle(.secondary)
46 }
47
48 VStack(alignment: .leading, spacing: 16) {
49 Text("Note Organization").font(.headline)
50 JotleyNoteOrganizationSettings()
51 Text("Auto Tags adds up to three topics when you generate a summary. Auto File Notes organizes completed recordings and unfiled summaries into a matching project or broad folder.")
52 .font(.caption).foregroundStyle(.secondary)
53 }
54
55 VStack(alignment: .leading, spacing: 16) {
56 Text("Notifications").font(.headline)
57 JotleySummaryNotificationSettings()
58 }
59
60 VStack(alignment: .leading, spacing: 16) {
61 Text("Display Options")
62 .font(.headline)
63
64 VStack(alignment: .leading, spacing: 12) {
65 Toggle("Show Tags", isOn: $showTags)
66 .frame(maxWidth: .infinity, alignment: .leading)
67 Toggle("Show Transcription Indicator When Jotley Is in Background", isOn: $showRecordingWidget)
68 .frame(maxWidth: .infinity, alignment: .leading)
69 }
70 }
71
72 VStack(alignment: .leading, spacing: 16) {
73 Text("Transcription")
74 .font(.headline)
75
76 VStack(alignment: .leading, spacing: 12) {
77
78 SettingsDropdown(title: "Preferred Language", selection: $transcriptionLanguage,
79 options: speechLanguages.map(\.id), placeholder: "Choose a supported language",
80 optionTitle: { id in speechLanguages.first { $0.id == id }?.name ?? id })
81 .disabled(isSettingUpSpeech)
82 .accessibilityIdentifier("settingsLanguagePicker")
83
84 Text("Choose an Apple Intelligence language supported by this Mac for transcription, summaries and Ask AI. Apple speech may need a one-time setup; existing notes and the app’s interface language stay unchanged.")
85 .font(.caption)
86 .foregroundColor(.secondary)
87 CustomSpeechWordsButton().disabled(isSettingUpSpeech)
88 Toggle("Transcribe microphone and system audio", isOn: $recordSystemAudio)
89 Text(speechStatus).font(.caption).foregroundColor(.secondary)
90 if isSettingUpSpeech {
91 ProgressView("Setting up Apple speech…", value: speechSetupProgress).tint(.themePrimaryAccent)
92 Button("Cancel Setup") { speechSetupTask?.cancel() }
93 .jotleyDismissButtonStyle()
94 } else if speechNeedsSetup {
95 Button("Set Up On-Device Speech") { setUpSpeech() }
96 .accessibilityIdentifier("settingsSpeechSetupButton")
97 }
98 if let speechSetupError { Text(speechSetupError).font(.caption) }
99 Text("Speech setup installs the selected language's model from Apple once and requires internet access. After setup, transcription and summaries run on-device and work offline. Audio and notes are never sent to an AI service.")
100 .font(.caption).foregroundColor(.secondary)
101
102 }
103 }
104
105 VStack(alignment: .leading, spacing: 12) {
106 Text("iCloud Sync").font(.headline)
107 if NoteSyncMode.configuredIdentifier(in: Bundle.main.infoDictionary ?? [:]) != nil {
108 Toggle("Sync notes with iCloud after restarting Jotley", isOn: $iCloudSyncEnabled)
109 .accessibilityIdentifier("settingsICloudSyncToggle")
110 }
111 Text("Sync is on by default in iCloud-enabled builds. You can turn it off here. It sends notes, transcripts, summaries, folders and tags to your private iCloud database. Audio and AI processing stay on this Mac. Changes take effect after quitting and reopening Jotley; disabling does not delete data already in iCloud.")
112 .font(.caption).foregroundColor(.secondary)
113 Text(NoteSyncMode.configuredIdentifier(in: Bundle.main.infoDictionary ?? [:]) == nil
114 ? "iCloud sync requires a signed build configured with an iCloud container. This build saves notes only on this Mac."
115 : (persistenceController.syncMode.isEnabled ? "iCloud sync is enabled for this session. Apple schedules synchronization when available." : "iCloud sync is off for this session."))
116 .font(.caption).foregroundColor(.secondary)
117 }
118
119 VStack(alignment: .leading, spacing: 12) {
120 Text("Backup & Restore").font(.headline)
121 LibraryBackupControls()
122 }
123
124 if updates.isEnabled {
125 VStack(alignment: .leading, spacing: 12) {
126 Text("App Updates").font(.headline)
127 Toggle("Check for updates automatically", isOn: Binding(
128 get: { updates.automaticChecks }, set: { updates.setAutomaticChecks($0) }
129 ))
130 Button("Check for Updates…") { updates.check() }
131 .disabled(!updates.canCheck || !updates.isIdle)
132 Text("Sparkle checks jotley.ai for signed app updates. Updates require internet access; transcription and summaries continue to work offline. Your notes and audio are never included in update checks.")
133 .font(.caption).foregroundColor(.secondary)
134 }
135 }
136 VStack(alignment: .leading, spacing: 16) {
137 Text("About")
138 .font(.headline)
139 JotleyAboutLogo()
140
141 VStack(alignment: .leading, spacing: 8) {
142 HStack {
143 Text("Version")
144 .frame(width: 120, alignment: .leading)
145 Text(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "2.0")
146 .foregroundColor(.secondary)
147 .font(.callout)
148 }
149 HStack {
150 Text("Build")
151 .frame(width: 120, alignment: .leading)
152 Text(Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1")
153 .foregroundColor(.secondary)
154 .font(.callout)
155 }
156 }
157 Divider()
158 Button("Welcome to Jotley", systemImage: "sparkles") { onShowWelcome() }
159 .accessibilityIdentifier("settingsWelcomeJotley")
160 }
161
162 }
163 }
164 .padding(32)
165 }
166 .task(id: [transcriptionLanguage, customWords]) { await checkModels() }
167 .onDisappear { speechSetupTask?.cancel() }
168
169 }
170}