Skip to content

Commit bef740f

Browse files
author
Ivo Bellin Salarin
committed
fix: recording the system audio at last
1 parent 6c29f1e commit bef740f

8 files changed

Lines changed: 20 additions & 11 deletions

File tree

Recap/Audio/Processing/AudioRecordingCoordinator/AudioRecordingCoordinator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class AudioRecordingCoordinator: AudioRecordingCoordinatorType {
1111
private let systemWideTap: SystemWideTap?
1212

1313
private var isRunning = false
14-
private var tapRecorder: AudioTapRecorderType?
14+
private var tapRecorder: (any AudioTapRecorderType)?
1515

1616
init(
1717
configuration: RecordingConfiguration,

Recap/Frameworks/Toast/AlertToast.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,9 @@ public extension View{
735735

736736
@ViewBuilder fileprivate func valueChanged<T: Equatable>(value: T, onChange: @escaping (T) -> Void) -> some View {
737737
if #available(iOS 14.0, *) {
738-
self.onChange(of: value, perform: onChange)
738+
self.onChange(of: value) { oldValue, newValue in
739+
onChange(newValue)
740+
}
739741
} else {
740742
self.onReceive(Just(value)) { (value) in
741743
onChange(value)

Recap/MenuBar/Dropdowns/DropdownWindowManager.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ final class DropdownWindowManager: ObservableObject {
6565
guard let window = dropdownWindow else { return }
6666

6767
animateDropdownOut(window: window) {
68-
window.orderOut(nil)
69-
self.dropdownWindow = nil
68+
Task { @MainActor in
69+
window.orderOut(nil)
70+
self.dropdownWindow = nil
71+
}
7072
}
7173

7274
if let monitor = globalMonitor {
@@ -95,7 +97,7 @@ final class DropdownWindowManager: ObservableObject {
9597
}
9698
}
9799

98-
private func animateDropdownOut(window: NSWindow, completion: @escaping () -> Void) {
100+
private func animateDropdownOut(window: NSWindow, completion: @Sendable @escaping () -> Void) {
99101
NSAnimationContext.runAnimationGroup({ context in
100102
context.duration = 0.2
101103
context.timingFunction = CAMediaTimingFunction(name: .easeIn)

Recap/Services/Processing/SystemLifecycle/SystemLifecycleManager.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ protocol SystemLifecycleDelegate: AnyObject {
77
func systemDidWake()
88
}
99

10+
@MainActor
1011
final class SystemLifecycleManager {
1112
weak var delegate: SystemLifecycleDelegate?
1213

@@ -26,15 +27,19 @@ final class SystemLifecycleManager {
2627
object: nil,
2728
queue: .main
2829
) { [weak self] _ in
29-
self?.delegate?.systemWillSleep()
30+
Task { @MainActor in
31+
self?.delegate?.systemWillSleep()
32+
}
3033
}
3134

3235
wakeObserver = notificationCenter.addObserver(
3336
forName: NSWorkspace.didWakeNotification,
3437
object: nil,
3538
queue: .main
3639
) { [weak self] _ in
37-
self?.delegate?.systemDidWake()
40+
Task { @MainActor in
41+
self?.delegate?.systemDidWake()
42+
}
3843
}
3944
}
4045

Recap/UIComponents/Buttons/DownloadPillButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct DownloadPillButton: View {
6161
iconOffset = 3
6262
}
6363
}
64-
.onChange(of: isDownloading) { _, newValue in
64+
.onChange(of: isDownloading) { oldValue, newValue in
6565
if newValue {
6666
iconOffset = 3
6767
} else {

Recap/UseCases/Settings/Components/MeetingDetection/MeetingDetectionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct MeetingDetectionView<ViewModel: MeetingDetectionSettingsViewModelType>: V
7676
await viewModel.checkPermissionStatus()
7777
}
7878
}
79-
.onChange(of: viewModel.autoDetectMeetings) { enabled in
79+
.onChange(of: viewModel.autoDetectMeetings) { oldValue, enabled in
8080
if enabled {
8181
Task {
8282
await viewModel.checkPermissionStatus()

Recap/UseCases/Settings/Components/Reusable/CustomDropdown.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct CustomDropdown<T: Hashable>: View {
3939
.frame(width: 285)
4040
.frame(maxHeight: showSearch ? 350 : 300)
4141
}
42-
.onChange(of: isExpanded) { _, expanded in
42+
.onChange(of: isExpanded) { oldValue, expanded in
4343
if !expanded {
4444
searchText = ""
4545
}

Recap/UseCases/Settings/Components/Reusable/CustomTextEditor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct CustomTextEditor: View {
6565
.focused($isFocused)
6666
.lineLimit(nil)
6767
.textSelection(.enabled)
68-
.onChange(of: isFocused) { _, focused in
68+
.onChange(of: isFocused) { oldValue, focused in
6969
withAnimation(.easeInOut(duration: 0.2)) {
7070
isEditing = focused
7171
}

0 commit comments

Comments
 (0)