@@ -13,7 +13,7 @@ struct RecordMeeting {
13
13
var transcript = " "
14
14
15
15
var durationRemaining : Duration {
16
- self . syncUp. duration - . seconds( self . secondsElapsed)
16
+ syncUp. duration - . seconds( secondsElapsed)
17
17
}
18
18
}
19
19
@@ -41,11 +41,11 @@ struct RecordMeeting {
41
41
Reduce { state, action in
42
42
switch action {
43
43
case . alert( . presented( . confirmDiscard) ) :
44
- return . run { _ in await self . dismiss ( ) }
44
+ return . run { _ in await dismiss ( ) }
45
45
46
46
case . alert( . presented( . confirmSave) ) :
47
47
state. syncUp. insert ( transcript: state. transcript)
48
- return . run { _ in await self . dismiss ( ) }
48
+ return . run { _ in await dismiss ( ) }
49
49
50
50
case . alert:
51
51
return . none
@@ -68,18 +68,18 @@ struct RecordMeeting {
68
68
case . onTask:
69
69
return . run { send in
70
70
let authorization =
71
- await self . speechClient. authorizationStatus ( ) == . notDetermined
72
- ? self . speechClient. requestAuthorization ( )
73
- : self . speechClient. authorizationStatus ( )
71
+ await speechClient. authorizationStatus ( ) == . notDetermined
72
+ ? speechClient. requestAuthorization ( )
73
+ : speechClient. authorizationStatus ( )
74
74
75
75
await withTaskGroup ( of: Void . self) { group in
76
76
if authorization == . authorized {
77
77
group. addTask {
78
- await self . startSpeechRecognition ( send: send)
78
+ await startSpeechRecognition ( send: send)
79
79
}
80
80
}
81
81
group. addTask {
82
- await self . startTimer ( send: send)
82
+ await startTimer ( send: send)
83
83
}
84
84
}
85
85
}
@@ -92,9 +92,9 @@ struct RecordMeeting {
92
92
93
93
let secondsPerAttendee = Int ( state. syncUp. durationPerAttendee. components. seconds)
94
94
if state. secondsElapsed. isMultiple ( of: secondsPerAttendee) {
95
- if state. speakerIndex == state. syncUp. attendees . count - 1 {
95
+ if state. secondsElapsed == state. syncUp. duration . components . seconds {
96
96
state. syncUp. insert ( transcript: state. transcript)
97
- return . run { _ in await self . dismiss ( ) }
97
+ return . run { _ in await dismiss ( ) }
98
98
}
99
99
state. speakerIndex += 1
100
100
}
@@ -118,7 +118,7 @@ struct RecordMeeting {
118
118
119
119
private func startSpeechRecognition( send: Send < Action > ) async {
120
120
do {
121
- let speechTask = await self . speechClient. startTask ( SFSpeechAudioBufferRecognitionRequest ( ) )
121
+ let speechTask = await speechClient. startTask ( SFSpeechAudioBufferRecognitionRequest ( ) )
122
122
for try await result in speechTask {
123
123
await send ( . speechResult( result) )
124
124
}
@@ -128,7 +128,7 @@ struct RecordMeeting {
128
128
}
129
129
130
130
private func startTimer( send: Send < Action > ) async {
131
- for await _ in self . clock. timer ( interval: . seconds( 1 ) ) {
131
+ for await _ in clock. timer ( interval: . seconds( 1 ) ) {
132
132
await send ( . timerTick)
133
133
}
134
134
}
@@ -138,7 +138,7 @@ extension SyncUp {
138
138
fileprivate mutating func insert( transcript: String ) {
139
139
@Dependency ( \. date. now) var now
140
140
@Dependency ( \. uuid) var uuid
141
- self . meetings. insert (
141
+ meetings. insert (
142
142
Meeting (
143
143
id: Meeting . ID ( uuid ( ) ) ,
144
144
date: now,
@@ -239,22 +239,22 @@ struct MeetingHeaderView: View {
239
239
240
240
var body : some View {
241
241
VStack {
242
- ProgressView ( value: self . progress)
243
- . progressViewStyle ( MeetingProgressViewStyle ( theme: self . theme) )
242
+ ProgressView ( value: progress)
243
+ . progressViewStyle ( MeetingProgressViewStyle ( theme: theme) )
244
244
HStack {
245
245
VStack ( alignment: . leading) {
246
246
Text ( " Time Elapsed " )
247
247
. font ( . caption)
248
248
Label (
249
- Duration . seconds ( self . secondsElapsed) . formatted ( . units( ) ) ,
249
+ Duration . seconds ( secondsElapsed) . formatted ( . units( ) ) ,
250
250
systemImage: " hourglass.bottomhalf.fill "
251
251
)
252
252
}
253
253
Spacer ( )
254
254
VStack ( alignment: . trailing) {
255
255
Text ( " Time Remaining " )
256
256
. font ( . caption)
257
- Label ( self . durationRemaining. formatted ( . units( ) ) , systemImage: " hourglass.tophalf.fill " )
257
+ Label ( durationRemaining. formatted ( . units( ) ) , systemImage: " hourglass.tophalf.fill " )
258
258
. font ( . body. monospacedDigit ( ) )
259
259
. labelStyle ( . trailingIcon)
260
260
}
@@ -264,12 +264,12 @@ struct MeetingHeaderView: View {
264
264
}
265
265
266
266
private var totalDuration : Duration {
267
- . seconds( self . secondsElapsed) + self . durationRemaining
267
+ . seconds( secondsElapsed) + durationRemaining
268
268
}
269
269
270
270
private var progress : Double {
271
- guard self . totalDuration > . seconds( 0 ) else { return 0 }
272
- return Double ( self . secondsElapsed) / Double( self . totalDuration. components. seconds)
271
+ guard totalDuration > . seconds( 0 ) else { return 0 }
272
+ return Double ( secondsElapsed) / Double( totalDuration. components. seconds)
273
273
}
274
274
}
275
275
@@ -279,11 +279,11 @@ struct MeetingProgressViewStyle: ProgressViewStyle {
279
279
func makeBody( configuration: Configuration ) -> some View {
280
280
ZStack {
281
281
RoundedRectangle ( cornerRadius: 10 )
282
- . fill ( self . theme. accentColor)
282
+ . fill ( theme. accentColor)
283
283
. frame ( height: 20 )
284
284
285
285
ProgressView ( configuration)
286
- . tint ( self . theme. mainColor)
286
+ . tint ( theme. mainColor)
287
287
. frame ( height: 12 )
288
288
. padding ( . horizontal)
289
289
}
@@ -300,8 +300,8 @@ struct MeetingTimerView: View {
300
300
. overlay {
301
301
VStack {
302
302
Group {
303
- if self . speakerIndex < self . syncUp. attendees. count {
304
- Text ( self . syncUp. attendees [ self . speakerIndex] . name)
303
+ if speakerIndex < syncUp. attendees. count {
304
+ Text ( syncUp. attendees [ speakerIndex] . name)
305
305
} else {
306
306
Text ( " Someone " )
307
307
}
@@ -312,14 +312,14 @@ struct MeetingTimerView: View {
312
312
. font ( . largeTitle)
313
313
. padding ( . top)
314
314
}
315
- . foregroundStyle ( self . syncUp. theme. accentColor)
315
+ . foregroundStyle ( syncUp. theme. accentColor)
316
316
}
317
317
. overlay {
318
- ForEach ( Array ( self . syncUp. attendees. enumerated ( ) ) , id: \. element. id) { index, attendee in
319
- if index < self . speakerIndex + 1 {
320
- SpeakerArc ( totalSpeakers: self . syncUp. attendees. count, speakerIndex: index)
318
+ ForEach ( Array ( syncUp. attendees. enumerated ( ) ) , id: \. element. id) { index, attendee in
319
+ if index < speakerIndex + 1 {
320
+ SpeakerArc ( totalSpeakers: syncUp. attendees. count, speakerIndex: index)
321
321
. rotation ( Angle ( degrees: - 90 ) )
322
- . stroke ( self . syncUp. theme. mainColor, lineWidth: 12 )
322
+ . stroke ( syncUp. theme. mainColor, lineWidth: 12 )
323
323
}
324
324
}
325
325
}
@@ -339,21 +339,21 @@ struct SpeakerArc: Shape {
339
339
path. addArc (
340
340
center: center,
341
341
radius: radius,
342
- startAngle: self . startAngle,
343
- endAngle: self . endAngle,
342
+ startAngle: startAngle,
343
+ endAngle: endAngle,
344
344
clockwise: false
345
345
)
346
346
}
347
347
}
348
348
349
349
private var degreesPerSpeaker : Double {
350
- 360 / Double( self . totalSpeakers)
350
+ 360 / Double( totalSpeakers)
351
351
}
352
352
private var startAngle : Angle {
353
- Angle ( degrees: self . degreesPerSpeaker * Double( self . speakerIndex) + 1 )
353
+ Angle ( degrees: degreesPerSpeaker * Double( speakerIndex) + 1 )
354
354
}
355
355
private var endAngle : Angle {
356
- Angle ( degrees: self . startAngle. degrees + self . degreesPerSpeaker - 1 )
356
+ Angle ( degrees: startAngle. degrees + degreesPerSpeaker - 1 )
357
357
}
358
358
}
359
359
@@ -365,13 +365,13 @@ struct MeetingFooterView: View {
365
365
var body : some View {
366
366
VStack {
367
367
HStack {
368
- if self . speakerIndex < self . syncUp. attendees. count - 1 {
369
- Text ( " Speaker \( self . speakerIndex + 1 ) of \( self . syncUp. attendees. count) " )
368
+ if speakerIndex < syncUp. attendees. count - 1 {
369
+ Text ( " Speaker \( speakerIndex + 1 ) of \( syncUp. attendees. count) " )
370
370
} else {
371
371
Text ( " No more speakers. " )
372
372
}
373
373
Spacer ( )
374
- Button ( action: self . nextButtonTapped) {
374
+ Button ( action: nextButtonTapped) {
375
375
Image ( systemName: " forward.fill " )
376
376
}
377
377
}
0 commit comments