Agrego frontend app
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
class MainFlutterWindow: NSWindow {
|
||||
override func awakeFromNib() {
|
||||
// Esta app se relanza siempre por script (redirect al updater y
|
||||
// viceversa), nunca hay que "resumir" la ventana de una sesión anterior.
|
||||
// Sin esto, macOS puede intentar restaurar estado de ventana guardado en
|
||||
// un lanzamiento previo, fallar (log: "Unable to find className=(null)")
|
||||
// y aplicar una heurística que interfiere con esta ventana antes de que
|
||||
// Flutter pinte el primer frame — pantalla negra permanente sin error.
|
||||
self.isRestorable = false
|
||||
|
||||
let project = FlutterDartProject()
|
||||
// Reenvía los argumentos de línea de comandos a Dart (main(List<String> args))
|
||||
// para que --from-updater llegue correctamente desde soma_pro_updater.
|
||||
project.dartEntrypointArguments = Array(CommandLine.arguments.dropFirst())
|
||||
// `initWithProject:` crea y corre el engine internamente, ya asociado a
|
||||
// este view controller. Crearlo a mano y llamar engine.run() antes de que
|
||||
// exista el view controller (como se hacía antes) puede pedir el primer
|
||||
// frame sin que haya superficie para pintarlo — ventana negra permanente
|
||||
// sin ningún error, porque no vuelve a dispararse un repaint.
|
||||
let flutterViewController = FlutterViewController(project: project)
|
||||
let windowFrame = self.frame
|
||||
self.contentViewController = flutterViewController
|
||||
self.setFrame(windowFrame, display: true)
|
||||
|
||||
RegisterGeneratedPlugins(registry: flutterViewController)
|
||||
|
||||
super.awakeFromNib()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user