import Cocoa import FlutterMacOS import AVFoundation @main class AppDelegate: FlutterAppDelegate { override func applicationDidFinishLaunching(_ notification: Notification) { super.applicationDidFinishLaunching(notification) DispatchQueue.global(qos: .utility).async { ChanoraSileroSelfTest.run() } // Ask for microphone access on launch rather than on first // voice-channel join. Matches user expectations for a voice // chat client and saves the user from a surprising prompt // mid-flow. macOS caches the choice; subsequent launches skip // the prompt. AVCaptureDevice.requestAccess(for: .audio) { granted in NSLog("chanora_flutter: microphone permission granted=\(granted)") } } override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } }