mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-02-17 14:07:28 +08:00
Improve code quality: use named constant and clearer error logs
- Extract 0.1 second delay to named constant 'registrationDelay' with explanatory comment - Split error message into separate log lines for better readability Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
@@ -229,12 +229,15 @@ class MainFlutterWindow: NSWindow {
|
|||||||
captureSession.commitConfiguration()
|
captureSession.commitConfiguration()
|
||||||
// Start and immediately stop the session to trigger registration
|
// Start and immediately stop the session to trigger registration
|
||||||
captureSession.startRunning()
|
captureSession.startRunning()
|
||||||
// Keep a strong reference and stop after a brief moment
|
// Minimum delay required for macOS to register the app in System Settings
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [captureSession] in
|
let registrationDelay: TimeInterval = 0.1
|
||||||
|
// Keep a strong reference and stop after the registration delay
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + registrationDelay) { [captureSession] in
|
||||||
captureSession.stopRunning()
|
captureSession.stopRunning()
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
NSLog("[RustDesk] Error creating audio capture session for permission registration: %@. The app may not appear in System Settings > Privacy & Security > Microphone. Please verify permissions manually.", error.localizedDescription)
|
NSLog("[RustDesk] Failed to create audio capture session: %@", error.localizedDescription)
|
||||||
|
NSLog("[RustDesk] The app may not appear in System Settings > Privacy & Security > Microphone")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user