@@ -104,8 +104,8 @@ final class AppState: ObservableObject {
104104 // MARK: - Globe Key
105105
106106 private func setupGlobeKey( ) {
107- globeKeyHandler = GlobeKeyHandler ( hotkey: hotkey) { [ weak self ] trigger in
108- Task { @MainActor in
107+ globeKeyHandler = GlobeKeyHandler ( hotkey: hotkey) { trigger in
108+ Task { @MainActor [ weak self ] in
109109 self ? . handleHotkeyTrigger ( trigger)
110110 }
111111 }
@@ -131,8 +131,8 @@ final class AppState: ObservableObject {
131131 forName: NSApplication . didBecomeActiveNotification,
132132 object: nil ,
133133 queue: . main
134- ) { [ weak self ] _ in
135- Task { @MainActor in
134+ ) { _ in
135+ Task { @MainActor [ weak self ] in
136136 self ? . refreshAccessibilityStatus ( )
137137 }
138138 }
@@ -141,8 +141,8 @@ final class AppState: ObservableObject {
141141 forName: NSApplication . didResignActiveNotification,
142142 object: nil ,
143143 queue: . main
144- ) { [ weak self ] _ in
145- Task { @MainActor in
144+ ) { _ in
145+ Task { @MainActor [ weak self ] in
146146 self ? . updateRecordingIndicatorVisibility ( )
147147 }
148148 }
@@ -220,8 +220,8 @@ final class AppState: ObservableObject {
220220 guard hotkeyCaptureMonitor == nil else { return }
221221 isCapturingHotkey = true
222222
223- hotkeyCaptureMonitor = NSEvent . addLocalMonitorForEvents ( matching: [ . keyDown] ) { [ weak self ] event in
224- Task { @MainActor in
223+ hotkeyCaptureMonitor = NSEvent . addLocalMonitorForEvents ( matching: [ . keyDown] ) { event in
224+ Task { @MainActor [ weak self ] in
225225 self ? . handleHotkeyCapture ( event)
226226 }
227227 return nil
@@ -254,14 +254,14 @@ final class AppState: ObservableObject {
254254 forName: NSWorkspace . didActivateApplicationNotification,
255255 object: nil ,
256256 queue: . main
257- ) { [ weak self ] notification in
257+ ) { notification in
258258 guard let app = notification. userInfo ? [ NSWorkspace . applicationUserInfoKey] as? NSRunningApplication else {
259259 return
260260 }
261261 let appName = app. localizedName ?? " Unknown "
262262 let bundleId = app. bundleIdentifier
263263
264- Task { @MainActor in
264+ Task { @MainActor [ weak self ] in
265265 self ? . handleAppActivation ( appName: appName, bundleId: bundleId)
266266 }
267267 }
@@ -321,11 +321,10 @@ final class AppState: ObservableObject {
321321 " writing_mode " : currentMode. rawValue
322322 ] )
323323
324- recordingTimer = Timer . scheduledTimer ( withTimeInterval: 0.1 , repeats: true ) { [ weak self] _ in
325- Task { @MainActor in
326- if let self = self , self . isRecording {
327- self . recordingDuration += 100
328- }
324+ recordingTimer = Timer . scheduledTimer ( withTimeInterval: 0.1 , repeats: true ) { _ in
325+ Task { @MainActor [ weak self] in
326+ guard let self, self . isRecording else { return }
327+ self . recordingDuration += 100
329328 }
330329 }
331330 } else {
0 commit comments