mirror of https://github.com/CympleTech/ESSE.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
998 B
33 lines
998 B
import Cocoa |
|
import FlutterMacOS |
|
|
|
public class EsseCorePlugin: NSObject, FlutterPlugin { |
|
public static func register(with registrar: FlutterPluginRegistrar) { |
|
let channel = FlutterMethodChannel(name: "esse_core", binaryMessenger: registrar.messenger) |
|
let instance = EsseCorePlugin() |
|
registrar.addMethodCallDelegate(instance, channel: channel) |
|
} |
|
|
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { |
|
switch call.method { |
|
case "getPlatformVersion": |
|
result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString) |
|
case "daemon": |
|
guard let args = call.arguments else { |
|
return |
|
} |
|
if let myArgs = args as? [String: Any], |
|
let path = myArgs["path"] as? String |
|
{ |
|
DispatchQueue.global().async { |
|
start(path) |
|
} |
|
result("Daemon success") |
|
} else { |
|
result("Daemon path invalid") |
|
} |
|
default: |
|
result(FlutterMethodNotImplemented) |
|
} |
|
} |
|
}
|
|
|