Skip to content

Commit 96a9c3b

Browse files
committed
Refactor transcription views and update project identifiers
1 parent e96f719 commit 96a9c3b

6 files changed

Lines changed: 384 additions & 403 deletions

File tree

Aural.xcodeproj/project.pbxproj

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 63;
6+
objectVersion = 77;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -18,8 +18,8 @@
1818
9C6D5EF24AFFE2AE0157C023 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D0B0EEA6F94CD5B7889405D /* AboutView.swift */; };
1919
A2FB95CAD1BF5DBCD361C98E /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36DA87A814E38A68FCF9B447 /* HistoryView.swift */; };
2020
A366B14BFB62C78FE83B0C26 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 31E3959D0929A5287D1A624F /* Assets.xcassets */; };
21+
A99E9DD346893ADEFEA3AC16 /* AdvancedTranscriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93DA3314E337533E7CA3A549 /* AdvancedTranscriptionView.swift */; };
2122
DB8A20E9F2DE59FD40D99E66 /* TranscriptionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BF79E9BB137291A06A75678 /* TranscriptionManager.swift */; };
22-
F60649ABFE9668C76C86ABBC /* MinimalTranscriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D814D29E857FBF63FC04A9B /* MinimalTranscriptionView.swift */; };
2323
/* End PBXBuildFile section */
2424

2525
/* Begin PBXFileReference section */
@@ -32,8 +32,8 @@
3232
3BF79E9BB137291A06A75678 /* TranscriptionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TranscriptionManager.swift; sourceTree = "<group>"; };
3333
43AD4C3CAAA551B20034E2A3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
3434
5A9426C3785CBCC445AC3E57 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
35-
5D814D29E857FBF63FC04A9B /* MinimalTranscriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MinimalTranscriptionView.swift; sourceTree = "<group>"; };
36-
7E646A2CBF5CB0DA6AC615F7 /* Aural.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Aural.app; sourceTree = BUILT_PRODUCTS_DIR; };
35+
7E646A2CBF5CB0DA6AC615F7 /* Aural.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Aural.app; sourceTree = BUILT_PRODUCTS_DIR; };
36+
93DA3314E337533E7CA3A549 /* AdvancedTranscriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedTranscriptionView.swift; sourceTree = "<group>"; };
3737
9C80FC8B2BE7097ED045651C /* TranscriptionDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TranscriptionDetailView.swift; sourceTree = "<group>"; };
3838
E753F8F18224F7CC8AF5408E /* AuralApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuralApp.swift; sourceTree = "<group>"; };
3939
ED904D0402C83071A8E85CAC /* TranscriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TranscriptionView.swift; sourceTree = "<group>"; };
@@ -73,12 +73,12 @@
7373
isa = PBXGroup;
7474
children = (
7575
1D0B0EEA6F94CD5B7889405D /* AboutView.swift */,
76+
93DA3314E337533E7CA3A549 /* AdvancedTranscriptionView.swift */,
7677
31E3959D0929A5287D1A624F /* Assets.xcassets */,
7778
E753F8F18224F7CC8AF5408E /* AuralApp.swift */,
7879
43AD4C3CAAA551B20034E2A3 /* ContentView.swift */,
7980
36DA87A814E38A68FCF9B447 /* HistoryView.swift */,
8081
5A9426C3785CBCC445AC3E57 /* Info.plist */,
81-
5D814D29E857FBF63FC04A9B /* MinimalTranscriptionView.swift */,
8282
075E14F26905E59928194CCC /* NoiseShader.metal */,
8383
F1D3477DBCAFCCFB77C7C71D /* SettingsView.swift */,
8484
1CB7004D8320DB8D951F22C7 /* TopGradientView.swift */,
@@ -142,6 +142,7 @@
142142
packageReferences = (
143143
ECD03CDD50831244C32AAB50 /* XCLocalSwiftPackageReference "." */,
144144
);
145+
preferredProjectObjectVersion = 77;
145146
projectDirPath = "";
146147
projectRoot = "";
147148
targets = (
@@ -167,10 +168,10 @@
167168
buildActionMask = 2147483647;
168169
files = (
169170
9C6D5EF24AFFE2AE0157C023 /* AboutView.swift in Sources */,
171+
A99E9DD346893ADEFEA3AC16 /* AdvancedTranscriptionView.swift in Sources */,
170172
1BA6ADA6F8BCA88CEE5787CD /* AuralApp.swift in Sources */,
171173
986932F368883459B7FEF825 /* ContentView.swift in Sources */,
172174
A2FB95CAD1BF5DBCD361C98E /* HistoryView.swift in Sources */,
173-
F60649ABFE9668C76C86ABBC /* MinimalTranscriptionView.swift in Sources */,
174175
1CDE3454CD4ECDE7F6222F07 /* NoiseShader.metal in Sources */,
175176
953322660A1A1A62C0260615 /* SettingsView.swift in Sources */,
176177
700F97EB1758FA8AF4B964F7 /* TopGradientView.swift in Sources */,
@@ -188,7 +189,6 @@
188189
buildSettings = {
189190
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
190191
CODE_SIGN_IDENTITY = "iPhone Developer";
191-
DEVELOPMENT_TEAM = YQZQG7N4WG;
192192
ENABLE_PREVIEWS = YES;
193193
INFOPLIST_FILE = Aural/Info.plist;
194194
INFOPLIST_KEY_NSMicrophoneUsageDescription = "This app needs microphone access to transcribe speech.";
@@ -203,7 +203,7 @@
203203
"$(inherited)",
204204
"@executable_path/Frameworks",
205205
);
206-
PRODUCT_BUNDLE_IDENTIFIER = com.auralkit.aural;
206+
PRODUCT_BUNDLE_IDENTIFIER = com.rudrankriyam.aural;
207207
PRODUCT_NAME = Aural;
208208
SDKROOT = iphoneos;
209209
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -339,7 +339,6 @@
339339
buildSettings = {
340340
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
341341
CODE_SIGN_IDENTITY = "iPhone Developer";
342-
DEVELOPMENT_TEAM = YQZQG7N4WG;
343342
ENABLE_PREVIEWS = YES;
344343
INFOPLIST_FILE = Aural/Info.plist;
345344
INFOPLIST_KEY_NSMicrophoneUsageDescription = "This app needs microphone access to transcribe speech.";
@@ -354,7 +353,7 @@
354353
"$(inherited)",
355354
"@executable_path/Frameworks",
356355
);
357-
PRODUCT_BUNDLE_IDENTIFIER = com.auralkit.aural;
356+
PRODUCT_BUNDLE_IDENTIFIER = com.rudrankriyam.aural;
358357
PRODUCT_NAME = Aural;
359358
SDKROOT = iphoneos;
360359
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
import SwiftUI
2+
import AuralKit
3+
import Speech
4+
5+
// MARK: - Sub-views
6+
7+
struct TranscriptContentView: View {
8+
let finalizedText: AttributedString
9+
let volatileText: AttributedString
10+
let currentTimeRange: String
11+
let isTranscribing: Bool
12+
13+
var body: some View {
14+
VStack(alignment: .leading, spacing: 16) {
15+
if !finalizedText.characters.isEmpty {
16+
Text(finalizedText)
17+
.font(.body)
18+
.foregroundColor(.primary)
19+
.frame(maxWidth: .infinity, alignment: .leading)
20+
.padding()
21+
.background(Color.gray.opacity(0.1))
22+
.cornerRadius(12)
23+
}
24+
25+
if !volatileText.characters.isEmpty {
26+
VolatileTextView(
27+
volatileText: volatileText,
28+
currentTimeRange: currentTimeRange
29+
)
30+
}
31+
32+
if finalizedText.characters.isEmpty && volatileText.characters.isEmpty && !isTranscribing {
33+
EmptyStateView()
34+
}
35+
}
36+
.padding()
37+
}
38+
}
39+
40+
struct VolatileTextView: View {
41+
let volatileText: AttributedString
42+
let currentTimeRange: String
43+
44+
var body: some View {
45+
VStack(alignment: .leading, spacing: 8) {
46+
HStack(spacing: 8) {
47+
ProgressView()
48+
.scaleEffect(0.8)
49+
Text(volatileText)
50+
.font(.body)
51+
.italic()
52+
}
53+
54+
if !currentTimeRange.isEmpty {
55+
Label(currentTimeRange, systemImage: "clock")
56+
.font(.caption)
57+
.foregroundColor(.secondary)
58+
}
59+
60+
}
61+
.frame(maxWidth: .infinity, alignment: .leading)
62+
.padding()
63+
.background(Color.blue.opacity(0.1))
64+
.cornerRadius(12)
65+
}
66+
}
67+
68+
struct EmptyStateView: View {
69+
var body: some View {
70+
VStack(spacing: 12) {
71+
Image(systemName: "mic.circle")
72+
.font(.system(size: 60))
73+
.foregroundColor(.secondary)
74+
Text("Tap the button below to start transcribing")
75+
.font(.headline)
76+
.foregroundColor(.secondary)
77+
.multilineTextAlignment(.center)
78+
}
79+
.frame(maxWidth: .infinity, maxHeight: .infinity)
80+
.padding(.top, 100)
81+
}
82+
}
83+
84+
struct LanguageSelectorView: View {
85+
@Bindable var manager: TranscriptionManager
86+
let commonLocales: [Locale]
87+
88+
var body: some View {
89+
HStack {
90+
Image(systemName: "globe")
91+
.foregroundColor(.secondary)
92+
Text("Language:")
93+
.foregroundColor(.secondary)
94+
Spacer()
95+
Menu {
96+
ForEach(commonLocales, id: \.identifier) { locale in
97+
Button {
98+
manager.selectedLocale = locale
99+
} label: {
100+
HStack {
101+
Text(locale.localizedString(forIdentifier: locale.identifier) ?? locale.identifier)
102+
if locale == manager.selectedLocale {
103+
Image(systemName: "checkmark")
104+
}
105+
}
106+
}
107+
}
108+
} label: {
109+
HStack {
110+
Text(manager.selectedLocale.localizedString(forIdentifier: manager.selectedLocale.identifier) ?? manager.selectedLocale.identifier)
111+
.foregroundColor(.primary)
112+
Image(systemName: "chevron.down")
113+
.font(.caption)
114+
.foregroundColor(.secondary)
115+
}
116+
.padding(.horizontal, 12)
117+
.padding(.vertical, 6)
118+
.background(Color.gray.opacity(0.1))
119+
.cornerRadius(8)
120+
}
121+
}
122+
.padding(.horizontal)
123+
}
124+
}
125+
126+
struct RecordButtonView: View {
127+
let isTranscribing: Bool
128+
let isDisabled: Bool
129+
let action: () -> Void
130+
@Binding var animationScale: CGFloat
131+
132+
var body: some View {
133+
Button(action: action) {
134+
ZStack {
135+
Circle()
136+
.fill(isTranscribing ? Color.red : Color.blue)
137+
.frame(width: 80, height: 80)
138+
.scaleEffect(animationScale)
139+
140+
Image(systemName: isTranscribing ? "stop.fill" : "mic.fill")
141+
.font(.system(size: 30))
142+
.foregroundColor(.white)
143+
}
144+
}
145+
.disabled(isDisabled)
146+
}
147+
}
148+
149+
struct ErrorView: View {
150+
let error: String
151+
152+
var body: some View {
153+
Text(error)
154+
.font(.caption)
155+
.foregroundColor(.red)
156+
.padding(.horizontal)
157+
.padding(.vertical, 8)
158+
.background(Color.red.opacity(0.1))
159+
.cornerRadius(8)
160+
.padding(.horizontal)
161+
}
162+
}
163+
164+
struct ControlsView: View {
165+
@Bindable var manager: TranscriptionManager
166+
@Binding var animationScale: CGFloat
167+
let commonLocales: [Locale]
168+
169+
var body: some View {
170+
VStack(spacing: 20) {
171+
LanguageSelectorView(
172+
manager: manager,
173+
commonLocales: commonLocales
174+
)
175+
176+
RecordButtonView(
177+
isTranscribing: manager.isTranscribing,
178+
isDisabled: manager.error != nil,
179+
action: manager.toggleTranscription,
180+
animationScale: $animationScale
181+
)
182+
183+
Text(manager.isTranscribing ? "Listening..." : "Tap to start")
184+
.font(.caption)
185+
.foregroundColor(.secondary)
186+
.padding(.bottom)
187+
}
188+
.padding(.vertical)
189+
#if os(iOS)
190+
.background(Color(UIColor.systemBackground))
191+
#else
192+
.background(Color(NSColor.windowBackgroundColor))
193+
#endif
194+
.shadow(color: .black.opacity(0.1), radius: 10, y: -5)
195+
}
196+
}
197+
198+
// MARK: - Main View
199+
200+
struct AdvancedTranscriptionView: View {
201+
@Bindable var manager: TranscriptionManager
202+
@State private var animationScale: CGFloat = 1.0
203+
@State private var showPermissionsAlert = false
204+
205+
var body: some View {
206+
NavigationStack {
207+
VStack(spacing: 0) {
208+
// Transcript Display
209+
ScrollView {
210+
TranscriptContentView(
211+
finalizedText: manager.finalizedText,
212+
volatileText: manager.volatileText,
213+
currentTimeRange: manager.currentTimeRange,
214+
isTranscribing: manager.isTranscribing
215+
)
216+
}
217+
.frame(maxHeight: .infinity)
218+
219+
// Error Display
220+
if let error = manager.error {
221+
ErrorView(error: error)
222+
}
223+
224+
// Controls
225+
ControlsView(
226+
manager: manager,
227+
animationScale: $animationScale,
228+
commonLocales: commonLocales
229+
)
230+
}
231+
.navigationTitle("AuralKit Demo")
232+
#if os(iOS)
233+
.navigationBarTitleDisplayMode(.large)
234+
#endif
235+
.toolbar {
236+
ToolbarItemGroup(placement: .automatic) {
237+
if !manager.currentTranscript.isEmpty {
238+
ShareLink(item: manager.currentTranscript) {
239+
Image(systemName: "square.and.arrow.up")
240+
}
241+
}
242+
243+
Menu {
244+
Label("iOS 26+ Features Active", systemImage: "checkmark.circle.fill")
245+
.foregroundColor(.green)
246+
} label: {
247+
Image(systemName: "ellipsis.circle")
248+
}
249+
}
250+
}
251+
}
252+
.onAppear {
253+
withAnimation(.easeInOut(duration: 1.0).repeatForever(autoreverses: true)) {
254+
animationScale = manager.isTranscribing ? 1.2 : 1.0
255+
}
256+
}
257+
.onChange(of: manager.isTranscribing) { _, isTranscribing in
258+
withAnimation(.easeInOut(duration: 1.0).repeatForever(autoreverses: true)) {
259+
animationScale = isTranscribing ? 1.2 : 1.0
260+
}
261+
}
262+
}
263+
264+
var commonLocales: [Locale] {
265+
[
266+
Locale(identifier: "en-US"),
267+
Locale(identifier: "es-ES"),
268+
Locale(identifier: "fr-FR"),
269+
Locale(identifier: "de-DE"),
270+
Locale(identifier: "it-IT"),
271+
Locale(identifier: "pt-BR"),
272+
Locale(identifier: "zh-CN"),
273+
Locale(identifier: "ja-JP"),
274+
Locale(identifier: "ko-KR")
275+
]
276+
}
277+
}

Aural/ContentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct ContentView: View {
99
if showAdvanced {
1010
AdvancedContentView(showAdvanced: $showAdvanced)
1111
} else {
12-
MinimalTranscriptionView()
12+
TranscriptionView()
1313
.toolbar {
1414
ToolbarItem(placement: .automatic) {
1515
Button("Advanced") {
@@ -30,7 +30,7 @@ struct AdvancedContentView: View {
3030

3131
var body: some View {
3232
TabView(selection: $selectedTab) {
33-
TranscriptionView(manager: transcriptionManager)
33+
AdvancedTranscriptionView(manager: transcriptionManager)
3434
.tabItem {
3535
Label("Transcribe", systemImage: "mic.circle.fill")
3636
}

0 commit comments

Comments
 (0)