import Cocoa
import FlutterMacOS

class MainFlutterWindow: NSWindow {
  override func awakeFromNib() {
    let flutterViewController = FlutterViewController()
    let windowFrame = self.frame
    self.contentViewController = flutterViewController
    self.setFrame(windowFrame, display: true)

    RegisterGeneratedPlugins(registry: flutterViewController)
    (NSApp.delegate as? AppDelegate)?.registerApplicationChannels(
      for: flutterViewController
    )

    super.awakeFromNib()

    DispatchQueue.main.async {
      if !self.isZoomed {
        self.zoom(nil)
      }
    }
  }
}
